1

The problem is the following:

There is system of differential equations

V = -1; G = 0.1; x[t] = a*Exp[-Sqrt[-1]*p*t]; 
y[t] = b*Exp[-Sqrt[-1]*p*t]; p = -2 Cos[k];
s = ParametricNDSolveValue[{Sqrt[-1]*x'[t] == 
     V*x[t] - F*x[t]*Abs[x[t]]^2 - G*y[t], 
    Sqrt[-1]*y'[t] == V*y[t] - F*y[t]*Abs[y[t]]^2 - G*x[t], x[0] == 0, 
    y[0] == 1}, {x, y}, {t, 0, 15}, {F}];

The constraint on $a$ and $b$ is that $a^2+b^2=2$. Mathematica solves this without problem but then I want to get a plot for $F$ on x-axis vs $V-p$ on y-axis, which I am unable to plot. I tried with parametric plot but it gives errors. Any help will be greatly appreciated. Thanks.

AtoZ
  • 471
  • 2
  • 6
  • Hi AtoZ and welcome! To make the most of Mma.SE start by taking the [tour] now. It will help us to help you if you write an excellent question. Edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. – rhermans Jul 07 '18 at 07:33
  • $V-p$ is a constant, what do you mean with plotting vs $V-p$? – rhermans Jul 07 '18 at 08:02
  • essentially this is the energy $V$ is the local energy of an atom, for example. $p$ is coming from the stationary solutions in the form of x[t] = aExp[-Sqrt[-1]p*t], This (stationary) ansatz will lead to a stationary equation and we have a factor $V-p$. I think I made a mistake I should leave $p$ then as a function of $k$? just like in the edited version of my question? – AtoZ Jul 07 '18 at 08:07
  • Is the problem for which you need help about plotting, writing the equation or about the physics? – rhermans Jul 07 '18 at 08:09
  • No just the plotting. – AtoZ Jul 07 '18 at 08:10
  • If the problem is with plotting, then you should provide a minimal working example not your full physics problem. Does my answer solved your problem ? (even if you have changes the equations now.) – rhermans Jul 07 '18 at 08:11
  • Yes great Thanks a lot for this help :-) – AtoZ Jul 07 '18 at 08:17
  • 1
    There are things to do after your question is answered. But wait! It's a good idea to stay vigilant for some time, better approaches may come later improving over previous replies. Experienced users may point alternatives, caveats or limitations. New users should test answers before voting and wait 24 hours before accepting the best one. Participation is essential for the site, please do your part. And don't forget about the [tour]. – rhermans Jul 07 '18 at 08:18

1 Answers1

1

Code

is much more readable if indented, please in the future show as readable code. You save yourself all sort of troubles if you limit the scope of you definitions using Module.

psol = Module[
   {
    V = -1,
    G = 0.1,
    x, y, s, p
    },
   p = -2 Cos[k];
   s = ParametricNDSolveValue[
     {
      x'[t] == V*x[t] - F*x[t]*Abs[x[t]]^2 - G*y[t], 
      y'[t] == V*y[t] - F*y[t]*Abs[y[t]]^2 - G*x[t],
      x[0] == 0,
      y[0] == 1
      }
     , {x, y}
     , {t, 0, 15}
     , {F}
     ]
   ];

Plot

Manipulate[
 Plot[
  Evaluate@Through[psol[F][t]]
  , {t, 0, 15}
  , PlotRange -> All
  ]
 , {{F, 0}, -0.99, 1}
 ]

enter image description here

ParametricPlot

Manipulate[
 ParametricPlot[
  Evaluate@Through[psol[F][t]]
  , {t, 0, 15}
  , AspectRatio -> 1
  , PlotRange -> {{-0.1, 0}, {0, 1}}
  , PlotTheme -> "Scientific"
  ]
 , {{F, 0}, -0.99, 1}
 ]

enter image description here

rhermans
  • 36,518
  • 4
  • 57
  • 149