3
$\begingroup$

I have a problem with solving the following system of differential equations :

$$\frac {d^2 f (x)} {dx^2} + \frac {1} {x}\frac {df (x)} {dx} = \frac {f (x)} {x^2} + f^3 (x) + f (x) g^2 (x) - f (x)$$ and $$\frac {d^2 g (x)} {dx^2} + \frac {1} {x}\frac {dg (x)} {dx} = g^3 (x) + g (x) f^2 (x) - g (x)$$ where the boundary conditions/initial conditions are $$f (0) = 0,f (\infty ) = 1,g^{\prime} (0) = 0,g (\infty ) = 1$$

Since the initial conditions are difficult to implement, I replaced the initial conditions at 0 by a small number to avoid to divide by zero. For the boundaries at infinity, I would like to take a large number instead.

x2 = 3;
NDSolve[{f'[x]/x + f''[x] == f[x]/(x*x) - f[x] + f[x]*f[x]*f[x] + f[x]*g[x]*g[x],
        g'[x]/x + g''[x] == -g[x] + g[x]*g[x]*g[x] + f[x]*g[x]*f[x],
     f[0.001] == 0, f[x2] == 0.99, g'[0.001] == 0, g[x2] == 0.99}, 
     {f, g}, {x, 0.001, x2}] 

If I take x2 = 2, the code works. But if I take x2 = 3, I get an error message (I would like to go up to 10 at least):

NDSolve::ndsz At x == 0.6048954636068331`, step size is effectively zero; singularity or stiff system suspected.

$\endgroup$
0

1 Answer 1

6
$\begingroup$

This problem can be solved by mapping interval (0,L) to unit interval (0,1), as a result we have system of equations

x1 = 10^-4; x2 = 1;
eqs = {(f'[x]/x + f''[x] - f[x]/(x*x))/L^2 == -f[x] + f[x]^3 + 
    f[x]*g[x]^2, (g'[x]/x + g''[x])/L^2 == -g[x] + g[x]^3 + 
    g[x]*f[x]^2}; bc = {f[x1] == 0, f[x2] == 0.99, g'[x1] == 0, 
  g[x2] == 0.99};

First we solve this system at L=5 and define initial conditions as follows

sol5 = NDSolve[{eqs /. L -> 5, bc}, {f, g}, {x, x1, x2}][[1]];

ini = {f'[x1], g[x1]} /. sol5

Using ini we can solve the system at L=10 as well

sol10 = NDSolve[{eqs /. L -> 10, bc}, {f, g}, {x, x1, x2}, 
   Method -> {"Shooting", 
     "StartingInitialConditions" -> {f'[x1] == ini[[1]], 
       g[x1] == ini[[2]]}}][[1]]

Visualization

L0 = 10; Plot[Evaluate[{f[x/L0], g[x/L0]} /. sol10], {x, x1  L0, L0}, 
 PlotLegends -> {"f", "g"}]

Figure 1

$\endgroup$
4
  • $\begingroup$ Thanks a lot, I didnt expect such a detailled answer. Thats awesome :) $\endgroup$
    – ZaraReinm.
    Apr 11 at 19:33
  • $\begingroup$ @ZaraReinm. Does this model have anything to do with Young Mills theory? $\endgroup$ Apr 11 at 20:40
  • $\begingroup$ Actually not, it has something to do with Superfluids and Vortices. $\endgroup$
    – ZaraReinm.
    Apr 15 at 7:59
  • $\begingroup$ @ZaraReinm. Ah, yes, you are right, this is superfluid model. :) $\endgroup$ Apr 15 at 13:12

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.