An approximation of sin(x) around the point x = 0 can be represent as a Taylor s
ID: 2325077 • Letter: A
Question
An approximation of sin(x) around the point x = 0 can be represent as a Taylor series as follow,
Write a C code does the following
b. Since the expansion is made around x=0, it will start to miss-predict the value once x is far from 0. Make a table in the following form to find out where the Taylor series (of seventh order) fail to predict the sin(x) within an error of 1%
x
true value
3rd order value
3rd order error
5rd order value
5rd order error
7rd order value
7rd order error
0.01
0.02
0.03
Note: use function “sin()” within “math.h” as the accurate result.
x
true value
3rd order value
3rd order error
5rd order value
5rd order error
7rd order value
7rd order error
0.01
0.02
0.03
Explanation / Answer
C Code: #include #include long int factorial(int m) { if (m==0 || m==1) return (1); else return (m*factorial(m-1)); } double power(double x,int n) { double val=1; int i; for (i=1;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.