Message Boards Message Boards

0
|
4464 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Get the correct output using Dsolve?

Posted 4 years ago

I am having some problems with my output. I used DSolve to solve my differential equations but the values in the output are too big it should be small. How can I improve my results and get the responsible results? Any help will be appreciated. I have also attached my file.

In[676]:= t = 0.1; Da = 10^-3; \[Epsilon] = 0.9; k = 10; Bi = 0.1; Br \
= 10;

In[677]:= A0 = Sqrt[\[Epsilon]]/Sqrt[Da];
A1 = N[Da + t^2/2 - Da Sech[(-1 + t)*A0] - (Sqrt[Da] t Tanh[(-1 + t)*A0])/\[Epsilon]^(3/2)];
A2 = N[(Sqrt[Da]Sech[(-1 + t)*A0] (-t Cosh[A0] + Sqrt[Da] \[Epsilon]^(3/2) Sinh[t A0]))/\[Epsilon]^(3/2)];
A3 = N[-((Sqrt[Da]  Sech[(-1 + t)* A0] (Sqrt[Da] \[Epsilon]^(3/2) Cosh[t A0] - 
t Sinh[A0]))/\[Epsilon]^(3/2))];
A6 = (Bi*(1 + k))/k;
Uc = -(Y^2/2) + A1;
Upm = A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da;
Um = FullSimplify[Integrate[Uc, {Y, 0, t}] + Integrate[Upm, {Y, t, 1}]];
B1 = 1/(12 A0 Um^2 \[Epsilon]) (-6 A0^3 (A2 - A3) (A2 + A3) Br Da (-1 + t) + 2 A0 (3 A2^2 Br (-1 + t) - 3 A3^2 Br (-1 + t) + 2 Br Da (3 Da - 3 Da t + t^3) + 6 Um^2) \[Epsilon] +3 Br (-8 A2 Da \[Epsilon] Cosh[A0 t] - 2 A2 A3 (A0^2 Da + \[Epsilon]) Cosh[2 A0 t] + 2 (A2 Cosh[A0] +  A3 Sinh[A0]) (4 Da \[Epsilon] + (A0^2 Da + \[Epsilon]) (A3 \Cosh[A0] + A2 Sinh[A0])) - 8 A3 Da \[Epsilon] Sinh[A0 t] - (A2^2 + A3^2) (A0^2 Da + \[Epsilon]) Sinh[2 A0 t]));
B2 = -((2 Br Da t^3 + B1 t (-6 A1 + t^2) Um)/(6 Um^2));
B3 = -((A0^2 Br Da (A2 Cosh[A0] + A3 Sinh[A0])^2)/(k Um^2 \[Epsilon]));
B4 = (B1 Um (Da + A3 Cosh[A0 t] + A2 Sinh[A0 t]) -Br (Da + A3 Cosh[A0 t] + A2 Sinh[A0 t])^2 - (
  A0^2 Br Da (A2 Cosh[A0 t] + A3 Sinh[A0 t])^2)/\[Epsilon])/(k Um^2);

In[689]:= DSolveValue[{X''''[Y] - 
    A6*X''[Y] + (B1*Bi)/(k*Um)*(A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da) - 
    B1/(k*Um)*(A0^2 (A3 Cosh[A0 Y] + A2 Sinh[A0 Y])) - (Bi*Br)/(
     k*Um^2)*((A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da)^2 + 
       Da/\[Epsilon]*(A0 (A2 Cosh[A0 Y] + A3 Sinh[A0 Y]))^2) + 
    Br/(Um^2*
      k)*(2 A0^2 ((A2^2 + A3^2) Cosh[2 A0 Y] + A2 Da Sinh[A0 Y] + 
          A3 Cosh[A0 Y] (Da + 4 A2 Sinh[A0 Y])) + 
       Da/\[Epsilon]*(2 A0^4 ((A2^2 + A3^2) Cosh[2 A0 Y] + 
            2 A2 A3 Sinh[2 A0 Y]))) == 0, 
  Z''''[Y] - 
    A6*Z''[Y] + (B1*Bi)/(
     k*Um)*(A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da) - (Bi*Br)/(
     k*Um^2)*((A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da)^2 + 
       Da/\[Epsilon]*(A0 (A2 Cosh[A0 Y] + A3 Sinh[A0 Y]))^2) == 0, 
  X''[1] == B3, Z''[1] == 0, k*X'[1] + Z'[1] == 1, X[1] == Z[1], 
  X[t] == 0, Z[t] == 0, X''[t] == B4, Z''[t] == 0}, {X[Y], Z[Y]}, Y]

Out[689]= {E^(-0.331662 Y) (-8.96709*10^34 + 
    3.9724*10^34 E^(0.331662 Y) + 4.93688*10^34 E^(0.663325 Y) - 
    4.415*10^34 E^(0.331662 Y) Y + 0.000166029 E^(0.331662 Y) Y^2 + 
    7.14307*10^6 E^(0.331662 Y) Cosh[30. Y] - 
    2.31478*10^17 E^(0.331662 Y) Cosh[60. Y] - 
    7.14307*10^6 E^(0.331662 Y) Sinh[30. Y] + 
    2.31478*10^17 E^(0.331662 Y) Sinh[60. Y]), 
 E^(-0.331662 Y) (5.41604*10^30 + 5.37164*10^30 E^(0.331662 Y) - 
    2.98183*10^30 E^(0.663325 Y) - 5.96775*10^30 E^(0.331662 Y) Y + 
    0.000166029 E^(0.331662 Y) Y^2 - 
    793.763 E^(0.331662 Y) Cosh[30. Y] + 
    6.43012*10^12 E^(0.331662 Y) Cosh[60. Y] + 
    793.763 E^(0.331662 Y) Sinh[30. Y] - 
    6.43012*10^12 E^(0.331662 Y) Sinh[60. Y])}
In[690]:= f = 
 Table[{E^(-0.33166247903554` Y) (-8.967092949138435`*^34 + 
      3.972400846477538`*^34 E^(0.33166247903554` Y) + 
      4.936882993878618`*^34 E^(0.66332495807108` Y) - 
      4.41499911558673`*^34 E^(0.33166247903554` Y) Y + 
      0.00016602946276696195` E^(0.33166247903554` Y) Y^2 + 
      7.143072506901513`*^6 E^(0.33166247903554` Y)
        Cosh[30.000000000000004` Y] - 
      2.314780304317174`*^17 E^(0.33166247903554` Y)
        Cosh[60.00000000000001` Y] - 
      7.143072506901513`*^6 E^(0.33166247903554` Y)
        Sinh[30.000000000000004` Y] + 
      2.3147803043171507`*^17 E^(0.33166247903554` Y)
        Sinh[60.00000000000001` Y])}, {Y, 0.1, 1, 0.01}]


Out[690]= {{-4.02986*10^32}, {-3.87719*10^32}, {-3.7284*10^32}, \
{-3.58344*10^32}, {-3.44225*10^32}, {-3.3048*10^32}, \
{-3.17102*10^32}, {-3.04086*10^32}, {-2.91429*10^32}, \
{-2.79124*10^32}, {-2.67167*10^32}, {-2.55553*10^32}, \
{-2.44277*10^32}, {-2.33333*10^32}, {-2.22717*10^32}, \
{-2.12425*10^32}, {-2.0245*10^32}, {-1.92787*10^32}, \
{-1.83433*10^32}, {-1.74382*10^32}, {-1.65629*10^32}, \
{-1.57169*10^32}, {-1.48997*10^32}, {-1.41109*10^32}, \
{-1.33498*10^32}, {-1.26161*10^32}, {-1.19093*10^32}, \
{-1.12287*10^32}, {-1.05741*10^32}, {-9.94474*10^31}, \
{-9.34029*10^31}, {-8.76022*10^31}, {-8.20402*10^31}, \
{-7.67121*10^31}, {-7.1613*10^31}, {-6.6738*10^31}, {-6.20821*10^31}, \
{-5.76405*10^31}, {-5.34082*10^31}, {-4.93803*10^31}, \
{-4.5552*10^31}, {-4.19184*10^31}, {-3.84745*10^31}, \
{-3.52154*10^31}, {-3.21363*10^31}, {-2.92322*10^31}, \
{-2.64984*10^31}, {-2.39298*10^31}, {-2.15216*10^31}, \
{-1.9269*10^31}, {-1.7167*10^31}, {-1.52107*10^31}, {-1.33954*10^31}, \
{-1.1716*10^31}, {-1.01678*10^31}, {-8.74586*10^30}, \
{-7.44529*10^30}, {-6.26125*10^30}, {-5.18885*10^30}, \
{-4.22323*10^30}, {-3.35952*10^30}, {-2.59286*10^30}, \
{-1.91837*10^30}, {-1.33121*10^30}, {-8.26502*10^29}, \
{-3.99386*10^29}, {-4.50001*10^28}, {2.41515*10^29}, {4.65018*10^29}, \
{6.3037*10^29}, {7.42427*10^29}, {8.06048*10^29}, {8.2609*10^29}, \
{8.07409*10^29}, {7.5486*10^29}, {6.73297*10^29}, {5.67575*10^29}, \
{4.42541*10^29}, {3.03043*10^29}, {1.53924*10^29}, {-1.24682*10^24}, \
{-1.53933*10^29}, {-3.03087*10^29}, {-4.42841*10^29}, \
{-5.68696*10^29}, {-6.76298*10^29}, {-7.61791*10^29}, \
{-8.22821*10^29}, {-8.58398*10^29}, {-8.67813*10^29}, \
{-8.62963*10^29}}
Attachments:
5 Replies

This is a way:

t = 1/10; Da = 10^-3; \[Epsilon] = 9/10; k = 10; Bi = 1/10; Br = 10;
A0 = Sqrt[\[Epsilon]]/Sqrt[Da];
A1 = Da + t^2/2 - Da Sech[(-1 + t)*A0] - (
   Sqrt[Da] t Tanh[(-1 + t)*A0])/\[Epsilon]^(3/2);
A2 = (Sqrt[Da]
    Sech[(-1 + t)*A0] (-t Cosh[A0] + 
     Sqrt[Da] \[Epsilon]^(3/2) Sinh[t A0]))/\[Epsilon]^(3/2);
A3 = -((Sqrt[Da]
      Sech[(-1 + t)*A0] (Sqrt[Da] \[Epsilon]^(3/2) Cosh[t A0] - 
      t Sinh[A0]))/\[Epsilon]^(3/2));
A6 = (Bi*(1 + k))/k;
Uc = -(Y^2/2) + A1;
Upm = A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da;
Um = FullSimplify[
   Integrate[Uc, {Y, 0, t}] + Integrate[Upm, {Y, t, 1}]];
B1 = 1/(12 A0 Um^2 \[Epsilon]) (-6 A0^3 (A2 - A3) (A2 + 
        A3) Br Da (-1 + t) + 
     2 A0 (3 A2^2 Br (-1 + t) - 3 A3^2 Br (-1 + t) + 
        2 Br Da (3 Da - 3 Da t + t^3) + 6 Um^2) \[Epsilon] + 
     3 Br (-8 A2 Da \[Epsilon] Cosh[A0 t] - 
        2 A2 A3 (A0^2 Da + \[Epsilon]) Cosh[2 A0 t] + 
        2 (A2 Cosh[A0] + 
           A3 Sinh[
             A0]) (4 Da \[Epsilon] + (A0^2 Da + \[Epsilon]) (A3 Cosh[
                A0] + A2 Sinh[A0])) - 
        8 A3 Da \[Epsilon] Sinh[
          A0 t] - (A2^2 + A3^2) (A0^2 Da + \[Epsilon]) Sinh[
          2 A0 t]));
B2 = -((2 Br Da t^3 + B1 t (-6 A1 + t^2) Um)/(6 Um^2));
B3 = -((A0^2 Br Da (A2 Cosh[A0] + A3 Sinh[A0])^2)/(k Um^2 \[Epsilon]));
B4 = (B1 Um (Da + A3 Cosh[A0 t] + A2 Sinh[A0 t]) - 
   Br (Da + A3 Cosh[A0 t] + A2 Sinh[A0 t])^2 - (
   A0^2 Br Da (A2 Cosh[A0 t] + A3 Sinh[A0 t])^2)/\[Epsilon])/(k Um^2);

{solX, solY} = 
  DSolveValue[{X''''[Y] - 
       A6*X''[Y] + (B1*Bi)/(
        k*Um)*(A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da) - 
       B1/(k*Um)*(A0^2 (A3 Cosh[A0 Y] + A2 Sinh[A0 Y])) - (Bi*Br)/(
        k*Um^2)*((A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da)^2 + 
          Da/\[Epsilon]*(A0 (A2 Cosh[A0 Y] + A3 Sinh[A0 Y]))^2) + 
       Br/(Um^2*
         k)*(2 A0^2 ((A2^2 + A3^2) Cosh[2 A0 Y] + A2 Da Sinh[A0 Y] + 
             A3 Cosh[A0 Y] (Da + 4 A2 Sinh[A0 Y])) + 
          Da/\[Epsilon]*(2 A0^4 ((A2^2 + A3^2) Cosh[2 A0 Y] + 
               2 A2 A3 Sinh[2 A0 Y]))) == 0, 
     Z''''[Y] - 
       A6*Z''[Y] + (B1*Bi)/(
        k*Um)*(A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da) - (Bi*Br)/(
        k*
         Um^2)*((A2*Sinh[Y*A0] + A3*Cosh[Y*A0] + Da)^2 + 
          Da/\[Epsilon]*(A0 (A2 Cosh[A0 Y] + A3 Sinh[A0 Y]))^2) == 0, 
     X''[1] == B3, Z''[1] == 0, k*X'[1] + Z'[1] == 1, X[1] == Z[1], 
     X[t] == 0, Z[t] == 0, X''[t] == B4, Z''[t] == 0}, {X, Z}, Y] // 
   Simplify;
f = Table[N[solX[Y], 16], {Y, 1/10, 1, 1/100}]
POSTED BY: Gianluca Gorni

Thanks for your kind help. I am getting my results.

I am having some problems again. When I changed my parameters values the output is not generating. it's giving me an error related to precision.

N::meprec: Internal precision limit $MaxExtraPrecision = 50.` reached

The parameters that I have used

t = 1/10; Da = 10^-4; \[Epsilon] = 9/10; k = 10; Bi = 1/10; Br = 10;

The computation involves cancellations of very large numbers and has serious problems of numerical accuracy. Do the computation with exact data t = 1/10; Da = 10^-3; \[Epsilon] = 9/10; k = 10; Bi = 1/10; Br = 10; and then use N[X[Y],16] to get the floating point result. Unfortunately simply N[X[Y]] will do the calculation with machine precision and get a very wrong result.

POSTED BY: Gianluca Gorni

Thanks for your response. How can I improve my results?

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