Question: Algorithm and Complexity, Python # Task 1a) Test the function with various angles and a's. The parameter should be positive but small. b). Find an

Algorithm and Complexity, Python

# Task 1a) Test the function with various angles and a's. The parameter should be positive but small.

b). Find an idea of how can we estimate the complexity of the above recursive routine. Can you improve its accuracy?

c). Build a similar algorithm for cosine and test its accuracy and complexity.Algorithm and Complexity, Python # Task 1a) Test the function with various

def cube(x):

return x*x*x

def p(x):

return 3*x - 4*cube(x)

def sine(angle, a):

if abs(angle)

return angle

else:

return p(sine(angle/3.0, a))

# Thel algorithm uses the identity sin(x) = 3*sin(x/3) - 4*sin(x/3)**3 # and the fact that for small arguments sin(x) is approximately equal to x. def cube (x): return x*x*x def p(x): return 3*x - 4* cube (x) def sine (angle, a): if abs (angle)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!