Exercise 4A Write functions to perform the following tasks efficiently Do not change the function

Exercise 4A Write functions to perform the following tasks efficiently. Do not change the function names in the template file, and do not import any packages besides those already indicated in the template. (1) Take x and return 2x^3. (2) Take two inputs x and y and return their product and the absolute value of their difference, in that order. E.g. inputs 3,4 should return 12,1. (3) The geometric mean of n numbers is the nth root of their product. The mid-range is the ordinary (arithmetic) mean of the maximum and minimum elements. Write a function which takes a list of numbers as input and returns True if the geometric mean is less than or equal to the midrange, and False if the geometric mean is greater than the midrange. For example, the input [3,8,9] should return True and [3,6,7,5] should return False. (4) Take an integer n and return a list of the first n terms of the Padovan sequence pn. (This is a variant of the Fibonacci numbers, defined by p[1] = p[2] = p[3] = 1, and p[n] = p[n-2] + p[n-3] for n>=4.) (5) Take a pair r0 and theta representing a point's polar coordinates and return a pair (x,y) representing its Cartesian coordinates. (6) Take a pair (x,y) representing a point's Cartesian coordinates and return a pair (r, theta) representing its polar coordinates, where theta is in the range [0,2π). Check that your function works for (x,y) in all quadrants.

Exercise 4A Write functions to perform the following tasks efficiently. Do not change the function names in the template file, and do not import any packages besides those already indicated in the template. (1) Take x and return 2x^3. (2) Take two inputs x and y and return their product and the absolute value of their difference, in that order. E.g. inputs 3,4 should return 12,1. (3) The geometric mean of n numbers is the nth root of their product. The mid-range is the ordinary (arithmetic) mean

Read More