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³ - X. (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 returns a list of the first n of the Padovan sequence pn. (This is a variant of the Fibonacci numbers, defined by P₁ = P2 = P3 = 1, and pn = Pn-2 + Pn-3 for n ≥ 4.) (5) Take a pair r≥ 0 and representing a point's polar coordinates and return a pair x, y representing its Cartesian coordinates. 0 (6) Take a pair x, y representing a point's Cartesian coordinates and return a pair r, representing its polar coordinates, where 0 = [0, 2π). Check that your function works for (x, y) in all quadrants.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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³
- X.
(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 returns a list of the first n of the Padovan sequence Pn. (This is a variant of
the Fibonacci numbers, defined by P₁ = P2 = P3 = = 1, and pn = Pn−2+ Pn-3 for n ≥ 4.)
(5) Take a pair r≥ 0 and representing a point's polar coordinates and return a pair x, y representing
its Cartesian coordinates.
0
(6) Take a pair x, y representing a point's Cartesian coordinates and return a pair r, representing its
polar coordinates, where = [0, 2π). Check that your function works for (x, y) in all quadrants.
Transcribed Image Text: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³ - X. (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 returns a list of the first n of the Padovan sequence Pn. (This is a variant of the Fibonacci numbers, defined by P₁ = P2 = P3 = = 1, and pn = Pn−2+ Pn-3 for n ≥ 4.) (5) Take a pair r≥ 0 and representing a point's polar coordinates and return a pair x, y representing its Cartesian coordinates. 0 (6) Take a pair x, y representing a point's Cartesian coordinates and return a pair r, representing its polar coordinates, where = [0, 2π). Check that your function works for (x, y) in all quadrants.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY