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

daniweb2013 0 Light Poster

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

Salem 5,138 Posting Sage

Can you write either "raise to power" or "factorial" recursively?

daniweb2013 0 Light Poster

Yes, i can, either i know the formula of Maclaurin Series but i cant write the program!!!

Rashakil Fol 978 Super Senior Demiposter Team Colleague

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.