hi guys, i have a homework assigment that i have to complete but im a bit lost on how to do one part of it.
the part of the question im having trouble with is this "
Calculate sin^2(x) approximately by using n terms (n>0)
the Taylor series
sin(x)=Sum[(-1)^k x^(2k+1)/(2k+1)!] (k goes from 0 to n-1)
"
im not exactly sure how to evaluate the factorial in the equation. I know we should use a for loop but lets say i used
for(k=0;k<n;k++ )
j=(2k+1)*j
that wont work because lets say n=3 it would say (1)*(3)*(5) ect. and not actually do (1)(2)(3)(4)(5) .
the part of the question im having trouble with is this "
Calculate sin^2(x) approximately by using n terms (n>0)
the Taylor series
sin(x)=Sum[(-1)^k x^(2k+1)/(2k+1)!] (k goes from 0 to n-1)
"
im not exactly sure how to evaluate the factorial in the equation. I know we should use a for loop but lets say i used
for(k=0;k<n;k++ )
j=(2k+1)*j
that wont work because lets say n=3 it would say (1)*(3)*(5) ect. and not actually do (1)(2)(3)(4)(5) .
Comment