2
$\begingroup$

I am trying to solve a non linear system of equation, and when I solve it, I have the following message

FindRoot::lstol: 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.

Because of the lack of precision, I'm not sure of my result and changing the iterations and accuracy changes nothing.

Here is my code:

E1 = 0.53*10^9;
k1 = 0.269*10^(-6);
K1 = 0.5;
α1 = 30*10^(-6);
ν1 = 0.25;
μ1 = E1/(2 (1 + ν1));

E2 = 125*10^9;
k2 = 12.98*10^(-6);
K2 = 54;
α2 = 12*10^(-6);
ν2 = 0.5;
μ2 = E2/(2 (1 + ν2));
k = k1/k2;
K = K1/K2;
α = α1 (1 + ν1)/(α2 (1 + ν2));
f = 0.4;

ξ1[c1_] := Sqrt[0.5 (1 + Sqrt[1 + (c1/k)^2])];
ξ2[c2_] := Sqrt[0.5 (1 + Sqrt[1 + (c2)^2])];
η1[c1_] := -Sqrt[0.5 (-1 + Sqrt[1 + (c1/k)^2])];
η2[c2_] := Sqrt[0.5 (-1 + Sqrt[1 + c2^2])];
H1asym[A_] := 
  2 *μ1* μ2* 
   k2* α2* (1 + ν2)/ (K2 (μ2 (1 - ν1) (-A Csch[
              A]^2 + Coth[A]) + μ1 (1 - ν2) Coth[A]^2));
H2asym[A_] := 
  4*μ1 *μ2 *
   k2 *α2 *(1 + ν2)/(K2 (μ2 (1 - 
           2 ν1) (-A Csch[A]^2 + Coth[A]) - μ1 (1 - 
           2 ν2) Coth[A] - μ1 A Csch[A]^2));
Hasym[A_] := H1asym[A] / H2asym[A]; 

M1 [ c2_, 
   A_] := (ξ2 [c2] Sinh[2 A ξ2[c2]] + η2[c2] Sin[
       2 A η2[c2]])/(Cosh[2 A ξ2[c2]] - Cos[2 A η2[c2]]);
M2[c2_, A_] := (η2[c2] Sinh[2 A ξ2[c2]] - ξ2[c2] Sin[
       2 A η2[c2]])/(Cosh[2 A ξ2[c2]] - Cos[2 A η2[c2]]);
M3[c1_, A_] := α (- A Csch[A]^2 + Coth[A])/ ξ1[c1];
M4[c2_, A_] := (Coth[
      A]/(ξ2[c2] η2[c2])) (η2[c2] Sinh[
        2 A ξ2[c2]] - ξ2[c2] Sin[2 A η2[c2]])/(Cosh[
       2 A ξ2[c2]] - Cos[2 A η2[c2]]);
N1[c2_, A_] := ( -ξ2[c2] Sin[2 A η2[c2]] + η2[c2] Sinh[
       2 A ξ2[c2]])/ (Cosh[2 A ξ2[c2]] - Cos[2 A η2[c2]]);
N2[c2_, A_] := (ξ2[c2] Sinh[2 A ξ2[c2]] + η2[c2] Sin[
       2 A η2[c2]])/(Cosh[2 A ξ2[c2]] - Cos[2 A η2[c2]]);
N3[c1_, A_] := ( α η1[
       c1] / (ξ1[c1] (ξ1[c1] + 1))) (-A Csch[A]^2 + Coth[A]);
N4[c2_, A_] := (Coth[
     A]/ (ξ2[c2] η2[
       c2])) ((ξ2[c2] Sinh[2 A ξ2[c2]] + η2[c2] Sin[
        2 A η2[c2]] - 
      Coth[A] (Cosh[2 A ξ2[c2]] - Cos[2 A η2[c2]]))/(Cosh[
       2 A ξ2[c2]] - Cos[2 A η2[c2]]))

V[c1_, c2_] := c1 - c2;
equation76 [c1_, c2_, A_] := 
  K ξ1[c1] + M1[c2, A] + 
    f Hasym[A] (K η1[c2] + M2[c2, A] ) -  
    f H1asym[A]/2 (M3[c1, A] + M4[c2, A])*(V[c1, c2]) == 0;

equation77[c1_, c2_, A_] := 
  K η1[c2] + N1[c2, A] - f Hasym[A] (K ξ1[c1] + N2[c2, A]) + 
    f H1asym[A]/2 (N3[c1, A] + N4[c2, A]) * (V[c1, c2]) == 0;

solasym[A_] := 
 FindRoot[{equation76[c1, c2, A], 
   equation77[c1, c2, A]}, {{c1, 10000}, {c2, 2}}, 
  MaxIterations -> 10000] 
Table[FindRoot[{equation76[c1, c2, A], 
   equation77[c1, c2, A]}, {{c1, 10000}, {c2, 2}}, 
  MaxIterations -> 10000] , {A, 0.1, 6 , .1}]
 

ListLinePlot[Table[{A, A*V[c1, c2] /. solasym[A]}, {A, 0.1, 6, .01}], 
  ScalingFunctions -> "Log"] // Quiet

Have you an idea how I can get better precision?

Thank you a lot

$\endgroup$
1
  • 1
    $\begingroup$ Rationalize both equations and apply higher WorkingPrecision to FindRoot. $\endgroup$
    – Akku14
    Sep 10, 2020 at 14:04

1 Answer 1

1
$\begingroup$

I am using MMA 12.1. If I run your code, I do not get any error messages. As a result I get the following plot: enter image description here

$\endgroup$
7
  • $\begingroup$ (1) There are error messages printed by the Table that precedes the ListLinePlot. (2) Isn't the reason you don't get errors using the OP's plotting code because the code suppresses the messages with Quiet? (I'm using V12.1.1.) $\endgroup$
    – Michael E2
    Sep 10, 2020 at 18:52
  • $\begingroup$ I did it without the Quiet[] and did get a long table and the above plot, but no error messages. $\endgroup$ Sep 10, 2020 at 19:07
  • $\begingroup$ Odd, I got many error messages from the plot, two from the table. $\endgroup$
    – Michael E2
    Sep 10, 2020 at 19:12
  • $\begingroup$ I checked again. I have MMA 12.1.0.0 and the Windows version. By the way, did you restart the kernel. In case you have variables with values? $\endgroup$ Sep 10, 2020 at 20:42
  • $\begingroup$ Yes, I tried it with a fresh kernel. It's an odd difference, because the errors indicate a mathematical problem with the function. I would have thought bugs or differences related to evaluating functions would be extremely rare. $\endgroup$
    – Michael E2
    Sep 10, 2020 at 20:52

Your Answer

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

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