1)I am unable to write a C program to find the sum to n terms of a sine series. The concept used to find the sum to n terms of a cosine series is as follows:
First take Sum=1,t=1,i=1
So we have the first term. Now the second term is got by
t=(t*M) (where M= -x*x/(2i-1)*2i)
t= (-t*x*x/(2i-1)*2i
So we get the second term as,
t= (-1)*x*x/1*2 = -x^2/2
The multiplying term M can be got by dividing the (n+1)th term of the series by the nth term of the series. I applied the same method for sine series also and I got M as:
M=t(n+1)/t(n) = -x^2/2n(2n+1) Or, M= -x^2/2i(2i+1)
But using this expression of M, I am unable to generate the sine series.
The nth term of sine series is (-1)^(i+1)*x^(2i-1)/(2i-1)!
But no factorial function is available in C. So what is the way to write this program?
First take Sum=1,t=1,i=1
So we have the first term. Now the second term is got by
t=(t*M) (where M= -x*x/(2i-1)*2i)
t= (-t*x*x/(2i-1)*2i
So we get the second term as,
t= (-1)*x*x/1*2 = -x^2/2
The multiplying term M can be got by dividing the (n+1)th term of the series by the nth term of the series. I applied the same method for sine series also and I got M as:
M=t(n+1)/t(n) = -x^2/2n(2n+1) Or, M= -x^2/2i(2i+1)
But using this expression of M, I am unable to generate the sine series.
The nth term of sine series is (-1)^(i+1)*x^(2i-1)/(2i-1)!
But no factorial function is available in C. So what is the way to write this program?