how to Calculate Sin(x)

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Aug 2007
Posts: 33
Reputation: fzafarani is an unknown quantity at this point 
Solved Threads: 1
fzafarani's Avatar
fzafarani fzafarani is offline Offline
Light Poster

how to Calculate Sin(x)

 
0
  #1
Sep 4th, 2007
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
Farzad Zafarani
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: how to Calculate Sin(x)

 
0
  #2
Sep 4th, 2007
http://mathworld.wolfram.com/MaclaurinSeries.html
Can you write either "raise to power" or "factorial" recursively?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 33
Reputation: fzafarani is an unknown quantity at this point 
Solved Threads: 1
fzafarani's Avatar
fzafarani fzafarani is offline Offline
Light Poster

Re: how to Calculate Sin(x)

 
0
  #3
Sep 4th, 2007
Yes, i can, either i know the formula of Maclaurin Series but i cant write the program!!!
Farzad Zafarani
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,055
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: how to Calculate Sin(x)

 
1
  #4
Sep 4th, 2007
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.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC