1
$\begingroup$

I'm trying to solve nonlinear equations using Newton-type methods with very high accuracy using Mathematica. I found many research papers in which the numerical results are calculated with very high accuracy. e.g. To solve the equation $$e^{-x}+\sin(x)-2=0\text{ with initial guess }x_0=-1.$$ Many authors evaluated its functional value after some iterations up to $10^{-300}$ and less than this. But with the same function and same initial guess, I could not get the functional value better than $10^{-16}$. Why? Is there any special coding to increase the accuracy of the result.

$\endgroup$
4
  • $\begingroup$ Welcome to MSE. Please use MathJax. $\endgroup$
    – José Carlos Santos
    Commented May 19, 2018 at 6:55
  • $\begingroup$ With the errors, did you mean 1e-300, 1e-16 as in $10^{-300},\,10^{-16}$? $\endgroup$
    – LutzL
    Commented May 19, 2018 at 9:59
  • $\begingroup$ yes, it means 10^(-300) and so on. $\endgroup$
    – Prem
    Commented May 20, 2018 at 7:00
  • $\begingroup$ It's hard to answer your question "Why?" without seeing how you coded your Newton-type methods. $\endgroup$
    – Michael E2
    Commented May 22, 2018 at 1:51

2 Answers 2

6
$\begingroup$

Try

FindRoot[Exp[-x] + Sin[x] - 2 == 0, {x, -1}, WorkingPrecision -> 500]
$\endgroup$
1
  • $\begingroup$ I'm using the following code : $\endgroup$
    – Prem
    Commented May 20, 2018 at 16:20
3
$\begingroup$

You could also use Solve as long as you provide a domain restriction:

root = x /. First @ Solve[Exp[-x]+Sin[x]-2==0 && -2<x<0]

Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}]

The nice thing about the Root representation above is that it behaves like an exact expression. Anywhere you can use an exact expression (like Pi), you can instead use the above Root object. For example:

N[root]
N[root, 100]
Integrate[x^root, {x, 1, 2}]
Minimize[x^2 - 2 root x + 1, x]

-1.05413

-1.054127124091212899766844310942376610765302238222244358374175157259667078894540095490830534013697076

(-1 + 2^(1 + Root[{1 + E^#1 (-2 + Sin[#1]) &, -1.05412712409121289977}]))/(1 + Root[{1 + E^#1 (-2 + Sin[#1]) &, -1.05412712409121289977}])

{1 - Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}]^2, {x -> Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}]}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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