I have to compute a solution for a System of Nonlinear Equations using Newton's Method.
Does anybody have an idea how the algorithm may look like?
This is a discussion on Newton's Method for Systems of Nonlinear Equations within the C Programming forums, part of the General Programming Boards category; I have to compute a solution for a System of Nonlinear Equations using Newton's Method. Does anybody have an idea ...
I have to compute a solution for a System of Nonlinear Equations using Newton's Method.
Does anybody have an idea how the algorithm may look like?
What code have you written so far? Do you know how the method works? Here is the basic technique in a nutshell (There is more than one method which borrows Newton's name, but I will assume you are talking about this one:
Obviously you would have to define all the terms used. The MathsFunction is just the function you want to approximate and the MathsFunctionGrad just returns the gradient of the MathsFunction. In the above example I've considered the MathsFunctionGrad function to calculate an approximate gradient from the MathsFunction, so if you set dx to zero, you will have problems. It may be a good idea to make dx vary as you get closer to the solution rather than just using a fixed value because this would impose a limitation on the accuracy.Code:do { temp_x = x - ( MathsFunction(x)/MathsFunctionGrad(x, dx) ); accuracy = absf( temp_x - x); x = temp_x; } while( accuracy > threshold_accuracy );
In your original post you used plurals (i.e. systems of equations), which leads me to think that you may have to generalise the code to more variables but using the Taylor series (the basis of Newton's method), this should not be too difficult but would require some more work than what is shown above.