0 (Mandatory) A Taylor series expansion can approximate various functions with its terms...the more terms, the closer to
Posted: Sun May 15, 2022 11:53 am
solve code in c++ (#include <iostream>)
I keep posting the same question but the expert keeps sending the wrong answer. hopefully this time around the code works plz
0 (Mandatory) A Taylor series expansion can approximate various functions with its terms...the more terms, the closer to the real function value it is. The Taylor series (-1)" expansion of sin(x) = 72-1. for all x. and the Taylor series of (2n +1)! -1" = . x* that calculate sin(x) and cos(x), until some term is less than 10-'. Write a program that prompts for x and uses your two functions to calculate these values. Print out the result. Test cases: sin(0.5) = 0.479425, cos(0.5) = 0.87758: sin(2)=0.90929. cos(2)=-0.41614 Important! Use the factorial function given in class (from lecture) to do the denominators of the above equations.) cos(x) = 3 20**, for all. x. Write two functions (using a new * h and « cpp file) -- 2n
Run through the test cases given in the project. You should match through the 3rd decimal place, at least.
= long long myFact(int n) { long long result = 1; while (n > 1) { result *= n--; } return result; }
I keep posting the same question but the expert keeps sending the wrong answer. hopefully this time around the code works plz
0 (Mandatory) A Taylor series expansion can approximate various functions with its terms...the more terms, the closer to the real function value it is. The Taylor series (-1)" expansion of sin(x) = 72-1. for all x. and the Taylor series of (2n +1)! -1" = . x* that calculate sin(x) and cos(x), until some term is less than 10-'. Write a program that prompts for x and uses your two functions to calculate these values. Print out the result. Test cases: sin(0.5) = 0.479425, cos(0.5) = 0.87758: sin(2)=0.90929. cos(2)=-0.41614 Important! Use the factorial function given in class (from lecture) to do the denominators of the above equations.) cos(x) = 3 20**, for all. x. Write two functions (using a new * h and « cpp file) -- 2n
Run through the test cases given in the project. You should match through the 3rd decimal place, at least.
= long long myFact(int n) { long long result = 1; while (n > 1) { result *= n--; } return result; }