1
$\begingroup$

I am trying to follow this work, in which Eq. (11), the 2nd-order, nonlinear differential equation depends on a pair of parameters $ (\kappa, h) $. But now I only care about the case with a vanishing $ h $ and several values of $ \kappa $:

$$ \begin{align} 0&=\frac{\mathrm d^2\theta}{\mathrm d\varrho^2}+\frac{1}{\varrho}\frac{\mathrm d\theta}{\mathrm d\varrho}-\left(1+\frac{1}{\varrho^2}\right)\sin\theta\cos\theta+\frac{4\kappa}{\pi}\frac{\sin^2\theta}{\varrho}-h\sin\theta\\ \pi&=\theta(0)\\ 0&=\theta(\infty) \end{align} $$

So I try

Clear[sol]
sol = Block[{eq, θ0, θ1, ϱ0, ϱ1, κlist},
            {θ0, θ1} = {0.99 π, 0.001};
            {ϱ0, ϱ1} = {0.01, 10};
            κlist = {.6, .7, .8, .9, .95};
            eq[κ_, h_] = θ''[ϱ] + 1/ϱ θ'[ϱ] - (1 + 1/ϱ^2) Sin[θ[ϱ]] Cos[θ[ϱ]] + (4 κ)/π Sin[θ[ϱ]]^2/ϱ - h Sin[θ[ϱ]] == 0 // Simplify;
            NDSolveValue[{eq[#, 0.], θ[ϱ0] == θ0, θ[ϱ1] == θ1}, θ[ϱ], ϱ, AccuracyGoal -> 20] & /@ κlist
           ]

Actually, above code works fine to give five InterpolatingFunctions. But the problem arises when I try to add a new value 0.5 to κlist. Can anyone help to get a reasonable solution for $ \kappa = 0.5 $?

$\endgroup$
4
$\begingroup$

Set a proper initial guess and choose a smaller ϱ1 as approximation of $\infty$ helps:

sol = Block[{eq, θ0, θ1, ϱ0, ϱ1, κlist}, 
  {θ0, θ1} = {0.99 π, 0.001};
  {ϱ0, ϱ1} = {0.01, 5};
  κlist = {.5};
  eq[κ_, h_] = θ''[ϱ] + 1/ϱ θ'[ϱ] - (1 + 
        1/ϱ^2) Sin[θ[ϱ]] Cos[θ[ϱ]] + (4 κ)/π Sin[θ[ϱ]]^2/ϱ - h Sin[θ[ϱ]] == 0;
  NDSolveValue[{eq[#, 0.], θ[ϱ0] == θ0, θ[ϱ1] == θ1}, θ, ϱ, 
     Method -> {"Shooting", 
       "StartingInitialConditions" -> {θ[ϱ0] == (99 π)/100, θ'[ϱ0] == -10}}] & /@ κlist]

ListLinePlot[sol, PlotRange -> All]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Please keep the method of finite difference. $\endgroup$ – Αλέξανδρος Ζεγγ Nov 17 '18 at 9:18
  • $\begingroup$ Is there any thumb of rules for selection of approximation to $ \infty $? $\endgroup$ – Αλέξανδρος Ζεγγ Nov 17 '18 at 9:32
  • $\begingroup$ @ΑλέξανδροςΖεγγ I removed the FDM approach because that result is incorrect. To fix the FDM solution, we also need to choose a smaller ϱ1 and set proper initial guess i.e. the FDM approach doesn't show any advantage compared to the traditional shooting method approach in your case, that's the reason I decide not to re-add it to my post. As to approximation of $\infty$, a rule of thumb is, the approximation should be large enough but not too large. $\endgroup$ – xzczd Nov 17 '18 at 9:44
  • $\begingroup$ OK, I see. There is some uncertainty in choosing approximation of $ \infty $. Why $ \kappa=0.5 $ fails my original code? $\endgroup$ – Αλέξανδρος Ζεγγ Nov 17 '18 at 10:12
  • $\begingroup$ @ΑλέξανδροςΖεγγ As mentioned above, "the approximation should be large enough but not too large" is just a rule of thumb, and sadly I'm unable to give a in-depth explanation for why it works. BTW, κlist = {.6, .7, .8, .9, .95}; all fails to converge to a reasonable result by default in v9.0.1 (I guess you're in v11, right? ) So this is somewhat related to the robustness of the solver. $\endgroup$ – xzczd Nov 17 '18 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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