Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A mathematical series called the Taylor series can be applied to approximate the sine of an angle: so that by calculating a finite number of
A mathematical series called the Taylor series can be applied to approximate the sine of an angle: so that by calculating a finite number of values we can get reasonably close to an irrational value. Your assignment is to write a recursive function that computes a given number of terms of the above series to approximate the sine of a given angle. Actually, since you will not be allowed to import modules for this problem, you will need to write two recursive functions, as you will need to call a function to calculate factorials in your Taylor series function. Reminder: the factorial of an integer is found by multiplying that number by each integer between it and zero. For example: 6!-6*5*4*3*2*1 720 You will need to write a main function to prompt for input and print the final value. An example run of the program is given below: Enter the angle to approximate (in radians): .54 Enter the number of terms to compute: 20 sin (0.54) is approximately 0.514135991653113 Constraints: The angle given will be a float that represents the angle in radians You may assume that the given number of terms is a non-negative int Your Taylor function and factorial function must be recursive (loops are not allowed) Your recursive functions must be pure; i.e., they may not use print statements or get input from the user You may not import any modules . * *
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started