Mathematical functions

Write and save the Python functions, corresponding to the following mathematical functions into the same file named funcmat.py. Use the same name of the mathematical functions as the name of the Python function.

  1. \(f(x) = \frac{5}{2}x^4 + \frac{x^2}{6} + 7\).

    See the following examples:

    >>> a = f(0.0)
    >>> print(round(a, 4))
    7.0
    >>> print(round(f(10.1), 4))
    26039.1019
    >>> print(round(f(-1.4), 4))
    16.9307
    >>> print(round(f(6.0), 4))
    3253.0
    >>> print(round(f(-0.12345), 4))
    7.0031
    

    Note

    More tests are provided in the test-funcmat1.txt file.

  2. \(g(x)= \frac{(3x-2)}{2} + \frac{(x-7)^3}{7} + 2\)

    See the following examples:

    >>> print(round(g(0.0), 4))
    -48.0
    >>> print(round(g(7.0), 4))
    11.5
    >>> print(round(g(1.2345), 4))
    -24.527
    >>> print(round(g(-123.45), 4))
    -317311.8987
    >>> print(round(g(2.222), 4))
    -11.2496
    

    Note

    More tests are providedin the test-funcmat2.txt file.

  3. \(h(x,y) = \frac{y \sin x}{y^2-4}\). Supose that x is in degrees.

    See the following examples:

    >>> print(round(h(0.0, 0.0), 4))
    -0.0
    >>> print(round(h(45.0, 1.99), 4))
    -35.2667
    >>> print(round(h(90.0, 0.0), 4))
    -0.0
    >>> print(round(h(-90.0, 2.4), 4))
    -1.3636
    >>> print(round(h(360.0, 0.0), 4))
    0.0
    

    Note

    Moer tests are provided in the test-funcmat3.txt file.

    Analyze what will happen if we test this function with point (1,2).

  4. \(k(x)= \sqrt{f(x)}-g(x^2)\). This function must call the previous ones

    See the following examples:

    >>> print(round(k(0.0), 4))
    50.6458
    >>> print(round(k(2.0), 4))
    3.7612
    >>> print(round(k(-20.0), 4))
    -8671176.6291
    >>> print(round(k(9.876), 4))
    -106005.465
    >>> print(round(k(0.00836345), 4))
    50.6442
    >>> print(round(k(-1.01111), 4))
    31.108
    

    Note

    More tests are provided in the test-funcmat4.txt file.

Solutions

A solution of these functions is provided in the funcmat.py file.