1
$\begingroup$

enter image description here

I'm trying to solve the above differential equation using the shooting method. When i set Method -> {"Shooting", "StartingInitialConditions" -> {z[0] == 0, z'[0] == 1} i get a solution, but it is equal to zero. I need a solution that is different of zero. When i increase the value of z'[0], say to z'[0]=1000 Mathematica stay running for a long time and i get no solution. How can i solve this?

Here is the code:

n = 3.;
xf = 10000.;
s = NDSolve[
   {
    -z''[t] == (1 + (n - 2) t)^(1/(2 - n) (2 (n - 1) + 0.001)) z[
        t]^2 (Sin[z[t]+2])
    , z[0] == 0, z'[xf] == 0}, z, {t, 0, xf},
   Method -> {"Shooting", 
     "StartingInitialConditions" -> {z[0] == 0, z'[0] == 1}
     }
   ] // Chop
Plot[Evaluate[z[t] /. s], {t, 0., 10}, PlotRange -> All]
$\endgroup$

1 Answer 1

2
$\begingroup$

This problem appears to satisfy the boundary condition z'[t] == 0 at large t only for z[t] == 0, as can be seen from.

s = ParametricNDSolve[{-z''[t] == (1 + (n - 2) t)^(1/(2 - n) (2 (n - 1) + 10^-3))
    z[t]^2 (Sin[z[t] + 2]), z[0] == 0, z'[0] == sl}, {z, z'}, {t, 0, xf}, {sl}]
Plot[Table[Evaluate[z'[n][t] /. s],{n, -1, 1, 1/4}], {t, 0, 100}, PlotRange -> All]

enter image description here

or

Plot[z'[sl][100] /. s, {sl, -10, 10}, PlotRange -> All, AxesLabel -> {"z'[0]", "z'[100}"}]

enter image description here

$\endgroup$
4
  • $\begingroup$ how did you got the first graphic? $\endgroup$
    – Stratus
    Apr 20, 2017 at 3:02
  • $\begingroup$ ParametricNDSolve provides solutions to differential equations for various parameters, in this case z'[0]. The first graphic displays solutions for z'[0] with values given by Range[-1, 1, 1/4], $\endgroup$
    – bbgodfrey
    Apr 20, 2017 at 3:51
  • $\begingroup$ n = 3.; p = 2.; xf = 1000000.; s = ParametricNDSolveValue[{-z''[ t] == (1 + (n - 2) t)^(1/(2 - n) (2 (n - 1) + 10^-5)) z[ t]^2 Sin[z[t] + 2] , z[0] == 0, z'[xf] == bc2}, z'[xf], {t, 0, xf}, bc2] do you know why after solving this equation the following plot take so long? Plot[s[bc2], {bc2, 0, 2.1}] $\endgroup$
    – Stratus
    Apr 23, 2017 at 18:22
  • $\begingroup$ ParametricNDSolve does not actually solve the ODE until the parameter bc2 is specified. Plot probably requires several tens of solutions, and each is slow, because xf is very large. $\endgroup$
    – bbgodfrey
    Apr 23, 2017 at 22:34

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.