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.
2 Answers
Try
FindRoot[Exp[-x] + Sin[x] - 2 == 0, {x, -1}, WorkingPrecision -> 500] - $\begingroup$ I'm using the following code : $\endgroup$Prem– Prem2018-05-20 16:20:02 +00:00Commented May 20, 2018 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}]}}
1e-300, 1e-16as in $10^{-300},\,10^{-16}$? $\endgroup$