# How can I improve the numerical results while working Mathematica

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.

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

Try

FindRoot[Exp[-x] + Sin[x] - 2 == 0, {x, -1}, WorkingPrecision -> 500]

• I'm using the following code :
– Prem
May 20 '18 at 16:20

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}]}}