# How to change Machine Precision digits to meet the tolerances

I am trying to solve for Tcm and Mag by solving nonlinear equations using FindRoot command using following code:

Tc0 = 1;
rg = [email protected];
ratio = [email protected];
\[CapitalGamma]0 = rg 2 \[Pi] Tc0;
\[CapitalGamma]p = ratio \[CapitalGamma]0;
\[CapitalGamma]t  =  \[CapitalGamma]0 + \[CapitalGamma]p;
nMax  = 10000;
Ts = [email protected];
Tc = [email protected];

(*Fourth order algebraic equation for gwn*)
{sol1[n_, Mag_, Tcm_] , sol2[n_, Mag_, Tcm_]  , sol3[n_, Mag_, Tcm_]  ,
sol4[n_, Mag_, Tcm_]  } =
gwn /. Solve[
1/gwn^2 == 1 + Mag^2/((2 n + 1) Pi Tcm + 2 \[CapitalGamma]t  gwn )^2,
gwn];

(*Equation for Tcm*)
sumArg4Tcm[n_, Mag_, Tcm_]  =
2 Pi Tcm (2 n +
1) Pi Tcm (sol4[n, Mag, Tcm ] - 1)/((2 n + 1) Pi Tcm +
2 \[CapitalGamma]p )/((2 n + 1) Pi Tcm +
2 \[CapitalGamma]p  sol4[n, Mag, Tcm ] );
target1Tcm[Tcm_] =
Log[Tcm/Tc] + PolyGamma[1/2 + \[CapitalGamma]p/(\[Pi] Tcm)] -
PolyGamma[1/2 + \[CapitalGamma]p/(\[Pi] Tc)];

myTrial4Tcm[Mag_?NumericQ, Tcm_?NumericQ] :=
Parallelize[Sum[sumArg4Tcm[n, Mag, Tcm ] , {n, 0, nMax}] ] // Chop;

(*Equation for Mag*)
sumArg4Mag[n_, Mag_, Tcm_]  =
2 Pi Tcm (2 n +
1) Pi Tcm (sol4[n, Mag, Tcm ] - 1)/((2 n + 1) Pi Tcm +
2 \[CapitalGamma]t )/((2 n + 1) Pi Tcm +
2 \[CapitalGamma]t  sol4[n, Mag, Tcm ] );
target1Mag[Tcm_] =
Log[Tcm/Ts] + PolyGamma[1/2 + \[CapitalGamma]t/(\[Pi] Tcm)] -
PolyGamma[1/2 + \[CapitalGamma]t/(\[Pi] Ts)];
myTrial4Mag[Mag_?NumericQ, Tcm_?NumericQ] :=
Parallelize[Sum[sumArg4Mag[n, Mag, Tcm ] , {n, 0, nMax}]  ] // Chop;

AbsoluteTiming[FindRoot[{Re[myTrial4Tcm[Mag, Tcm] - target1Tcm[Tcm]], Re[myTrial4Mag[Mag, Tcm] - target1Mag[Tcm]]}, {Mag, 2.28}, {Tcm, 0.235},
WorkingPrecision -> 10]]


Running above code gave me an error

The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

Then I used options WorkingPrecision -> 10 but also gave me same error.

Can someone help me to get the right value?

• MachinePrecision corresponds to roughly 15 or 16 digits. 10 is less than that. May 31, 2021 at 13:38
• Thanks but when I use WorkingPrecision -> 16 it gives another error FindRoot::precw: The precision of the argument function ({-1.90467+Re[-Log[1.06061 Tcm]+myTrial4Tcm[Mag,Tcm]-PolyGamma[0,1/2+Times[<<2>>]]],PolyGamma[0,128003/205516]+Re[-Log[(50000 Tcm)/51379]+myTrial4Mag[Mag,Tcm]-PolyGamma[0,1/2+Times[<<2>>]]]}) is less than WorkingPrecision (16.). I don't know how to fix this issue or how to change the code so as not to encounter such issue?
– Tiku
May 31, 2021 at 15:54
• Tc = [email protected] is a machine precision number so the calculations are done with machine precision. To rationalize use Tc = Rationalize[0.942857, 0] See documentation for Rationalize May 31, 2021 at 16:38
• @Szabolcs - When calculations are done with MachinePrecision numbers, there is no attempt to track or control precision. The result is whatever comes out of the machine calculations and the precision is MachinePrecision, i.e., unknown. Specifying a WorkingPrecision of 10 will result in arbitrary-precision calculations and Mathematica will track and control precision and attempt to maintain 10 digits of precision. It will not always succeed in achieving that precision, but in any event Precision (or InputForm or FullForm`) will show the precision that was achieved. May 31, 2021 at 17:30
• @Bob Hanlon I rationalize all the parameters defined above like you said but also getting the same error so what should I add in the above code to be free from an error and get the right answer?
– Tiku
Jun 1, 2021 at 19:47