Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
can someone tell me where to find the algorithm to solve equation with Newton Solution. It is a iterative solution,
where we change from
f(x) = 0 [1]

to
x = g(x) [2]

and then guest a value, calculate the value , and then use it in the equation again. I can code to change from form(1) to form(2)with normal equation like
x2 - 2x + 1 = 0

but I cannot solve complex equation just like
log(sin(X)) = 0

Can someone tell me the algorithm to change from form (1) to form (2) in code C# or pseudo-code which deal with all kind of equation? Thanks in advance.
Posted

Here is one solution in c++
http://acumensoftwareinc.com/TechNotes/NewtonRaphson/html/[^]

You'll find a full description here:
http://en.wikipedia.org/wiki/Newton%27s_method[^]

Regards
Espen Harlinn
 
Share this answer
 
Thanks Espen. I have already found the wikipedia link but the method is a little different. My question is not about Newton method but about how to implement my Newton-like method in C# or even pseudo code? I am stuck at how to change the function from the form
f(x) = 0 [1]

to
x = g(x) [2]

How can we code them? Specially when my function is not just simple like
x2 - 2x - 1 = 0

but can be VERY VERY COMPLEX like
log(sin(x^2)) = 0


If my method( I mean the way I change from form [1] to form [2] then guess a value and use it in the form [2] to have a new value, then use it in the function [2] again and again until the value stop changing) is not correct, can someone tell me how to present such a complex function in code C#? And how to code the calculating the differential with that fucntion? Please tell me cause I have no idea now.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900