Message Boards Message Boards

0
|
5420 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Get same results from same equations but simplified?

Posted 5 years ago

I have an expression depending on different parameters as a function of Y. I am getting strange results. When I simplified the equation and solved getting different results and when I solved directly, I am getting different results. Can anyone suggest me which one is the right result?

Equa = Br*1/\[Epsilon]*(A0^2 (A3 Cosh[A0 (t - Y)] - A1 Cosh[A0 Y] + 
       A2 Sinh[A0 (t - Y)])^2);

In[1]:= t = 0.9; Da = 0.001; \[Epsilon] = 0.9; Br = 0.1;

In[8]:= A0 = Sqrt[\[Epsilon]]/Sqrt[Da];
A1 = FullSimplify[(Sqrt[Da] (2 Da - (-1 + t)^2))/(
   2 (-1 + t) \[Epsilon]^(3/2) Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]] - 
    2 Sqrt[Da] Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]])];
A2 = FullSimplify[
   1/(-(Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]]/Da) + 
    Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]]/(
    Sqrt[Da] (-1 + t) \[Epsilon]^(3/2)))];
A3 = FullSimplify[
   1/(((-1 + t) \[Epsilon]^(3/2) Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]])/
    Da^(3/2) - Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]]/Da)];
A4 = FullSimplify[((-1 + 2 Da + t^2) \[Epsilon]^(3/2)
      Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]] - 
    2 (Da \[Epsilon]^(3/2) + 
       Sqrt[Da] t Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]]))/(
   2 (-1 + t) \[Epsilon]^(3/2) Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]] - 
    2 Sqrt[Da] Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]])];
A5 = FullSimplify[(
   2 Da \[Epsilon]^(3/2) + (-2 Da + t - t^2) \[Epsilon]^(3/2)
      Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]] + 
    Sqrt[Da] (-1 + 2 t) Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]])/(
   2 (-1 + t) \[Epsilon]^(3/2) Cosh[(t Sqrt[\[Epsilon]])/Sqrt[Da]] - 
    2 Sqrt[Da] Sinh[(t Sqrt[\[Epsilon]])/Sqrt[Da]])];


In[14]:= FullSimplify[
 Br*1/\[Epsilon]*(A0^2 (A3 Cosh[A0 (t - Y)] - A1 Cosh[A0 Y] + 
      A2 Sinh[A0 (t - Y)])^2)]

Out[14]= 4.06386*10^-16 + 0.0001 Cosh[60. Y] - 0.0001 Sinh[60. Y]

In[15]:= Table[
 4.063860793018792`*^-16 + 0.00010000000000040569` Cosh[60.` Y] - 
  0.00010000000000040567` Sinh[60.` Y], {Y, 0, 0.9, 0.01}]

Out[15]= {0.0001, 0.0000548812, 0.0000301194, 0.0000165299, 
 9.0718*10^-6, 4.97871*10^-6, 2.73237*10^-6, 1.49956*10^-6, 
 8.22975*10^-7, 4.51658*10^-7, 2.47875*10^-7, 1.36037*10^-7, 
 7.46586*10^-8, 4.09735*10^-8, 2.24867*10^-8, 1.2341*10^-8, 
 6.77287*10^-9, 3.71703*10^-9, 2.03995*10^-9, 1.11955*10^-9, 
 6.14422*10^-10, 3.37202*10^-10, 1.85072*10^-10, 1.01579*10^-10, 
 5.57634*10^-11, 3.06386*10^-11, 1.68257*10^-11, 9.20863*10^-12, 
 5.11591*10^-12, 3.41061*10^-12, 1.81899*10^-12, 
 1.81899*10^-12, 0., 0., 0., 1.45519*10^-11, 2.91038*10^-11, 0., 
 5.82077*10^-11, 1.16415*10^-10, 2.32831*10^-10, 4.65661*10^-10, 
 9.31323*10^-10, 1.86265*10^-9, 1.86265*10^-9, 3.72529*10^-9, 
 7.45058*10^-9, 1.49012*10^-8, 0., 5.96046*10^-8, 5.96046*10^-8, 
 1.19209*10^-7, 2.38419*10^-7, 4.76837*10^-7, 9.53674*10^-7, 
 1.90735*10^-6, 3.8147*10^-6, 
 7.62939*10^-6, 0., 0., 0.0000305176, 0., 0.00012207, 0.000244141, \
0.000488281, 0.000488281, 0.000976563, 0.00195313, 0.00390625, \
0.0078125, 0.015625, 0.03125, 0., 0.0625, 0.125, 0.25, 0.5, 1., 2., \
4., 4., 8., 16., 32., 64., 128., 256., 512., 512., 1024., 2048.}

In[16]:= Table[
 Br*1/\[Epsilon]*(A0^2 (A3 Cosh[A0 (t - Y)] - A1 Cosh[A0 Y] + 
      A2 Sinh[A0 (t - Y)])^2), {Y, 0, 0.9, 0.01}]

Out[16]= {0.0001, 0.0000548812, 0.0000301194, 0.0000165299, 
 9.0718*10^-6, 4.97871*10^-6, 2.73237*10^-6, 1.49956*10^-6, 
 8.22975*10^-7, 4.51658*10^-7, 2.47875*10^-7, 1.36037*10^-7, 
 7.46586*10^-8, 4.09735*10^-8, 2.24867*10^-8, 1.2341*10^-8, 
 6.77287*10^-9, 3.71703*10^-9, 2.03995*10^-9, 1.11955*10^-9, 
 6.14422*10^-10, 3.37202*10^-10, 1.85061*10^-10, 1.01564*10^-10, 
 5.57394*10^-11, 3.05906*10^-11, 1.67887*10^-11, 9.21401*10^-12, 
 5.05694*10^-12, 2.77549*10^-12, 1.5234*10^-12, 8.36245*10^-13, 
 4.59125*10^-13, 2.52156*10^-13, 1.3857*10^-13, 7.62325*10^-14, 
 4.20214*10^-14, 2.32464*10^-14, 1.29436*10^-14, 7.29113*10^-15, 
 4.19246*10^-15, 2.49815*10^-15, 1.57974*10^-15, 1.09657*10^-15, 
 8.69413*10^-16, 8.14005*10^-16, 9.09795*10^-16, 1.19232*10^-15, 
 1.76636*10^-15, 2.84487*10^-15, 4.82788*10^-15, 8.45096*10^-15, 
 1.5058*10^-14, 2.70998*10^-14, 4.9043*10^-14, 8.9027*10^-14, 
 1.61883*10^-13, 2.94636*10^-13, 5.36527*10^-13, 9.77282*10^-13, 
 1.78039*10^-12, 3.24375*10^-12, 5.91016*10^-12, 1.07687*10^-11, 
 1.96215*10^-11, 3.57523*10^-11, 6.51446*10^-11, 1.18701*10^-10, 
 2.16287*10^-10, 3.941*10^-10, 7.18097*10^-10, 1.30846*10^-9, 
 2.38416*10^-9, 4.34423*10^-9, 7.9157*10^-9, 1.44234*10^-8, 
 2.62811*10^-8, 4.78872*10^-8, 8.72562*10^-8, 1.58991*10^-7, 
 2.89701*10^-7, 5.27869*10^-7, 9.6184*10^-7, 1.75259*10^-6, 
 3.19342*10^-6, 
 5.8188*10^-6, 0.0000106025, 0.0000193191, 0.0000352017, \
0.0000641416, 0.000116874}
2 Replies

When you use FullSimplify on an expression that contains approximate floating-point numbers, it seems that you are not guaranteed a totally equivalant expression. In your case the difference becomes apparent for values of Y close to 1, which involves Cosh of 60, which is a very large number.

You should work as long as possible with symbolic, exact formulas, and replace numbers only at the end.

POSTED BY: Gianluca Gorni

Thanks for your response. It means I will take the second result.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract