# Newton's Method for Systems of Nonlinear Equations

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 ...

1. ## Newton's Method for Systems of Nonlinear Equations

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?

2. 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:
Code:
```do
{
temp_x = x - ( MathsFunction(x)/MathsFunctionGrad(x, dx) );
accuracy = absf( temp_x - x);
x = temp_x;
} while( accuracy > threshold_accuracy );```
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.

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.