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

I can't solve it

## All 6 Replies

That is the taylor series for sin(x) i.e. sin(x) is approximately x- (x3/3!)+ (x5/5!)- (x7/7!)+.......

What do you want to solve?

x can be written as (x^1)/1! Now it's in the same form as the other terms, x^exponent/exponent!, except that you need a mechanism to flip the sign from positive to negative, which can be done by using -1^(exponent - 1) with each term. now use a loop to add each term one to the other in sequence and decide what level of sensitivity you want to use to decide when to stop.

Looking for patterns is part of the fun!

You aren't supposed to brute-force it. There is an equation to solve the approximation if I remember correctly.

That's great, if you remember the equation. But brute force is what computers do best, so I don't mind utilizing their strength. To expect someone to come up with the equation on their own would be a ludicrous learning experience as part of a class and a wonderful "AHA!" moment if you were a mathematician.

N.B I see my protocol for flipping the sign every other term needs to be tweaked, but you get the idea of what can be done to accomlish the task.

I cannot recall because I have not used it for a long time, but it should be an equation related to harmonic equation approximation.

By the way, it is depends on how precise you want for your result. Brute force is not the best to go for even with computer because how would you know that it is 'good enough' result? It is the same as 'how many times would you test your program and can say that it is good enough?' If there is an equation which someone has already implemented that can be applied to your problem, why don't you search for it? I just give him an information. If you have the Internet, why wouldn't you utilize it? Or you just use it for gaming?

Thanks to all of you
I understood how to solve this type of problem.
So again i say Thanks for your help