I'm trying to calculate sin(x) without using
#include <math.h>
i need to use Maclaurin Series to calculate sin(x) with recursive process.
thanks
I'm trying to calculate sin(x) without using
#include <math.h>
i need to use Maclaurin Series to calculate sin(x) with recursive process.
thanks
http://mathworld.wolfram.com/MaclaurinSeries.html
Can you write either "raise to power" or "factorial" recursively?
Yes, i can, either i know the formula of Maclaurin Series but i cant write the program!!!
It's hard to understand your problem then. If you know how to compute a Maclaurin series by hand, out to the point where the error is less than some tolerance level, why can't you write it in a program?
Of course, that's the whole point of this programming exercise, to convert the ability to do algorithms by hand to the ability to write computer programs that can perform the same algorithms.
You've got sin(x) = x - x^3/3! + x^5/5! - ... + (-1)^n*x^(2n+1)/(2n+1)! + ..., and there's some formula that tells you the error as well, when you've calculated to N terms.
Use a while loop, or a for loop, and calculate as many terms as you need.