1
$\begingroup$

I am trying to solve a couple of differential equations given by:

$$F(H(t))=R(\phi(t))$$

$$\phi(t)''+H(t) \phi'(t)+ m \,\phi(t)=0$$

where $m=1$ and $F$ and $R$ are just particular functions.

In the image you can see the initial conditions. The red curve is $F(u(t))$ and the black horizontal line shows the initial conditions / set up i.e. $R(\phi(0))$ when integration begins.

The point is that if I change smoothly the values which characterizes the curve i.e. I change the $\phi(0)$ value shifting the black line up or down; then, NDSolve changes the initial condition arbitrarily with the next output:

NDSolve has computed initial values that give a zero residual for the differential-algebraic system, but some components are different from those specified. If you need them to be satisfied, giving initial conditions for all dependent variables and their derivatives is recommended

I know that's an NDSolve problem because unless I choose a value where the black line is bigger than the value of the red line, the solutions should exist so I don't really know why Mathematica produces this.

The code is the following:

V[x_, m_] := 1 / 2 m^2 x^2;

m = 1;
ϕtilde = 1;
μ = 72;
β = 172;
σ = 22;
nEND = {};
solutions =
    NDSolve[{
      Evaluate[
        3 (((1 + E^(μ^2 / (2 σ^2) - (-μ + ℋ[n]^2)^2 / (2 σ^2))) (1 + Tanh[β ℋ[n]^2]) ℋ[n]^2) / (2 (1 + ((μ + 2 β σ^2) ℋ[n]^2) / (2 σ^2)))) ==
            1 / 2 ψ[n]^2 + V[Φ[n], m]
      ],
      Evaluate[ℋ[n] ψ'[n] + 3 ℋ[n] ψ[n] + Derivative[1, 0][V][Φ[n], m] == 0],
      Evaluate[ψ[n] == ℋ[n] Φ'[n]], Φ'[0] == 0, ψ[0] == 0, Φ[0] == ϕtilde,
      WhenEvent[Im[ℋ[n]] != 0, "StopIntegration"],
      WhenEvent[Φ[n] < 0, nEND = Append[nEND, n]; "StopIntegration"]},
      {ℋ, Φ, ψ}, {n, 0, 10^12}]

When I change slightly some of the initial numbers which only means to uplift or downlift the black line over the curve so solution should exist with the particular initial condition fixed, mathematica changes arbitrarly the initial condition or it doesn't perform the integration directly when I already know that the solution should exist. P.S: Sorry about greek letters, I don't know how to put it here...


v2 Additional info / answers: firstly thanks to all of you.

1) My Mathematica version is 11.3.0.0

2) The psi variable is defined by:

psi[n] ==H[n] phi'[n]

It's just the derivative of phi multiplied by H(n) but in the picture psi=0, because at initial "time" n=0, psi(n)=0.

3) Thanks for the greek letters correction!

4) I don't really get it last comment about AccuracyGoal and PrecisionGoal, what do you mean? I can try with that precision and it works the code but the problem remains equally. thanks everyone

$\endgroup$
  • $\begingroup$ We can't tell you nothing without looking your code. $\endgroup$ – Alex Trounev Apr 9 at 10:07
  • $\begingroup$ Hey, I am sorry. I thought the code was there. And I also don't know how to put greek letters here, it's my first post, sorry. $\endgroup$ – ABCDEF Apr 10 at 11:30
  • $\begingroup$ Your code sample produces a result without warning in v9.0.1 and v12.1. Which version are you in? $\endgroup$ – xzczd Apr 10 at 12:18
  • $\begingroup$ There are phi and psi in the algebraic differential system in your Mathematica code, but not in the picture. There is only phi. Please provide psi. $\endgroup$ – Steffen Jaeschke Apr 10 at 13:06
  • $\begingroup$ The easiest way to get Greek letters correct it to use this add-on to the editor $\endgroup$ – Chris K Apr 10 at 13:36

Your Answer

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

Browse other questions tagged or ask your own question.