4
$\begingroup$

I was solving an ordinary non-linear differential equation of the fourth order in the picture attached enter image description here

to the following code:

S=1,4,7,10; M = 1; a= .4;
solution = 
 NDSolve[{D[F[t],t,t,t,t] == (a/(1+a))*S*(t*F[t]+3*D[F[t],t,t]+D[F[t],t]*D[F[t],t,t]+F[t]*D[F[t],t,t,t])+(a/(1+a))*(M^2)*D[F[t],t,t], 
   F[0] == 0, (D[F[t],t,t] /. t -> 0) == 0, 
   F[1] == 1, (D[F[t],t,t] /. t -> 1) == 0}, F, {t,0,1}]
Plot[Evaluate[First[F[t] /. solution]], {t,0,1}]

I want to plot the solution with different values of S, How is it?

$\endgroup$
2
  • $\begingroup$ Why do you include M=1 and then in the equation include M^2? $\endgroup$ Commented Aug 8, 2023 at 19:43
  • $\begingroup$ Which of the formulas, TeXForm or Mathematica code, are the correct one? $\endgroup$ Commented Aug 8, 2023 at 21:08

3 Answers 3

4
$\begingroup$

It seems that we need to check the original equation. Here we check the values {S, {1, 4, 7, 10, 0, -1, -4, -7, -9, -12}}

Clear[M, γ, sol];
M = 1; γ = .4;
sol[S_] := 
  NDSolve[{(1 + 1/γ) F''''[η] - 
      S (η*F[η] + 3*F''[η] + F'[η]*F''[η] - 
         F[η]*F'''[η]) - M^2*F''[η] == 0, F[0] == 0, 
    F''[0] == 0, F[1] == 1, F''[1] == 0}, F, {η, 0, 1}];
Plot[Table[
   F[η] /. 
    First@sol[S], {S, {1, 4, 7, 10, 0, -1, -4, -7, -9, -12}}] // 
  Evaluate, {η, 0, 1}, AspectRatio -> 1/GoldenRatio]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you very mutch $\endgroup$
    – ahmed
    Commented Aug 9, 2023 at 11:31
8
$\begingroup$

Similar to Nasser's fast answer try

M = 1; a = .4;
solution = 
 ParametricNDSolveValue[{ 
   F''''[t] == (a/(1 + a))*
      S*(t*F[t] + 3* F''[t] + F'[t] * F''[t] + 
        F[t]* F'''[t] ) + (a/(1 + a))*(M^2)* F''[t] , F[0] == 0, 
   F''[0] == 0, F[1] == 1, F''[1] == 0}, F, {t, 0, 2}, S]

Plot[Evaluate@ Map[solution[#][t] &, {1, 4, 7, 10}] , {t, 0, 2},PlotLegends -> {1, 4, 7, 10}]

enter image description here

Solutions differ only for t>>1

$\endgroup$
5
$\begingroup$

I want to plot the solution with different values of S

One way is to use ParametricNDSolveValue

ClearAll["Global`*"];
m=1;a=4/10;
ode=D[F[t],t,t,t,t]==(a/(1+a))*s*(t*F[t]+3*D[F[t],t,t]+D[F[t],t]*D[F[t],t,t]+F[t]*D[F[t],t,t,t])+(a/(1+a))*(m^2)*D[F[t],t,t]
ic={F[0]==0,(D[F[t],t,t]/. t->0)==0,F[1]==1,(D[F[t],t,t]/. t->1)==0};
pfun=ParametricNDSolveValue[{ode,ic},F,{t,0,1},{s}];
Plot[(pfun[1])[t],{t,0,1},PlotLabel->"solutioin for s=1"]

Mathematica graphics

Another option is to use Manipulate and make slider for s.

$\endgroup$
4
  • $\begingroup$ I am wondering if the solution method is correct. Because the solution is supposed to be in the attached form $\endgroup$
    – ahmed
    Commented Aug 8, 2023 at 12:09
  • $\begingroup$ @ahmed I am just using your ode. I have no control of what solution it gives. May be you made mistake in the input somewhere. $\endgroup$
    – Nasser
    Commented Aug 8, 2023 at 12:15
  • $\begingroup$ How can I communicate with you $\endgroup$
    – ahmed
    Commented Aug 8, 2023 at 12:45
  • $\begingroup$ @ahmed I think there is a way to set up a chat room here at this site. But to tell you the truth I never did it so I do not know how it works. Once you setup a chat room then you can use it to chat with others by inviting them to your room to talk. $\endgroup$
    – Nasser
    Commented Aug 8, 2023 at 12:49

Your Answer

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

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