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
    $\begingroup$ Maybe you could ask this question at stackoverflow. $\endgroup$ – thanasissdr Oct 3 '15 at 13:35
  • $\begingroup$ I changed $N\text{x}N$ to $N\times N$. That is standard. ${}\qquad{}$ $\endgroup$ – Michael Hardy Oct 3 '15 at 13:54
  • $\begingroup$ Cross-post: stackoverflow.com/questions/32923520/… $\endgroup$ – WG- Oct 6 '15 at 11:41
  • $\begingroup$ I posted it on stackoverflow, on advise of thanasissdr :) $\endgroup$ – yarnamc Oct 7 '15 at 21:03

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.