Solving Non Linear System of Equations with MATLAB

300 Views Asked by At

I encountered a non-linear system of equations that has to be solved. The system of equations can be written as: $$Ax + \exp(x) = b$$ with $b$ a known $N\times 1$ matrix, $A$ a known $N\times N$ matrix, and $x$ the unknown $N\times 1$ vector for which has to be solved. The $\exp$ is defined elementwise on the $x$ vector. I tried to search the Matlab-manual but I'm having a hard time finding how to solve this kind of equations with Matlab, so I hope someone can help me out.

1

There are 1 best solutions below

0
On BEST ANSWER

The function can be written in the form:

$$ f \left( x \right) = A x + \exp \left( x \right) - b $$

Which is equivalent to the above once a root of $ f \left( x \right) $ is found.
One could use Newton's Method for root finding.

The Jacobian (Like the Transpose of Gradient) of $ f \left( x \right) $ is given by:

$$ J \left( f \left( x \right) \right) = A + diag \left( \exp \left( x \right) \right) $$

Hence the newton iteration is given by:

$$ {x}^{k + 1} = {x}^{k} - { J \left( f \left( {x}^{k} \right) \right) }^{-1} f \left( {x}^{k} \right) $$

You can see the code in my Mathematics Q1462386 GitHub Repository which includes both analytic and numerical derivation of the Jacobian.

This is the result of one run:

enter image description here

Pay attention that while it finds a root for this problem there are more than 1 root hence the solution is one of many and depends on the initial point.