Hi I am trying to write a code that finds approximations of sine and cosine using the equations below with a given value of theta in degrees basically as a novice programmer i am having trouble setting upa a while loop for the expansions. Also can you guys please quote sources(books,web pages, etc.) for a beginner programmer in python for syntax and basic concepts.

cos(x)= 1- x2/2! + x4/4! - x6/6! + ..

sin(x)= x - x3/3! + x5/5! - x7/7! + ..

Thanks in advance.

Recommended Answers

I suggest the official python tutorial to start with.

Jump to Post

All 3 Replies

Hint, use math.pow() and math.factorial()
will be
math.pow(x, 4)/math.factorial(4)

Module math also has:
math.degrees(x) converts angle x from radians to degrees.
math.radians(x) converts angle x from degrees to radians.

You can get a good free online book here: