1
$\begingroup$

I want to solve these differential equations and want to get the value of 'a1'. I used this code given below but it is not showing any result. If anyone can resolve this will be appreciated.

wm = 1;
G1 = 0.005;
delc = 1;
ka = 0.1;
E0 = 0.4;
gma1 = 0.5;
g0 = 1;
kd = 0.2;
del0 = 1;
N1 = 1;
NDSolve[{q1'[t] - wm*p1[t] == 0, 
 p1'[t] + wm*q1[t] - G1*Abs[a1[t]]^2 + gma1*p1[t] == 0, 
 a1'[t] + (I*delc + ka)*a1[t] - I*G1*a1[t]*q1[t] - E0 + I*g0*s1[t] == 
 0, s1'[t] + (kd - I*del0/2*N1)*s1[t] - I*g0*a1[t]*N1 == 0, 
q1[0] == 0, p1[0] == 0, a1[0] == 1, s1[0] == 0}, {q1, p1, a1, 
s1}, {t, 0, 100}]
Show[a1[t]]

here 'Abs' is used for, dagger of a[t] multiply with a[t].

$\endgroup$
5
  • 2
    $\begingroup$ Have you looked at the error messages? NDSolve::underdet "There are more dependent variables, {a1[t],p1[t],q[t],q1[t],s1[t]}, \ than equations, so the system is underdetermined" $\endgroup$
    – Nasser
    Apr 6, 2020 at 4:21
  • $\begingroup$ @Nasser Many have solved these types of equations numerically. Should I separate these equations in the imaginary and real terms and then after solve? $\endgroup$
    – vini
    Apr 6, 2020 at 4:30
  • 2
    $\begingroup$ Possibly, yes, but first, I would worry about having more dependent variables than equations than worry about the complex part. Is having more dependent variables than equations intentional? $\endgroup$
    – Nasser
    Apr 6, 2020 at 4:32
  • 2
    $\begingroup$ One of your DE's has the varible q[t]. Maybe it should be q1[t] ? $\endgroup$
    – LouisB
    Apr 6, 2020 at 4:36
  • $\begingroup$ @LouisB yes you are right. Now I need the value of 'a1'. how can i get it? $\endgroup$
    – vini
    Apr 6, 2020 at 7:44

1 Answer 1

1
$\begingroup$

An easy way to plot the real and imaginary parts of the solution for a1[t is like this

soln = NDSolve[{q1'[t] - wm*p1[t] == 0,
    p1'[t] + wm*q1[t] - G1*Abs[a1[t]]^2 + gma1*p1[t] == 0, 
    a1'[t] + (I*delc + ka)*a1[t] - I*G1*a1[t]*q1[t] - E0 + 
      I*g0*s1[t] == 0, 
    s1'[t] + (kd - I*del0/2*N1)*s1[t] - I*g0*a1[t]*N1 == 0,
    q1[0] == 0, p1[0] == 0, a1[0] == 1, s1[0] == 0}, {q1, p1, a1, 
    s1}, {t, 0, 100}];

ReImPlot[a1[t] /. soln, {t, 0, 15}]

enter image description here

To create a similar plot with Mathematica 9 we can code

Plot[Evaluate[{Re@a1[t], Im@a1[t]} /. soln], {t, 0, 15},
 PlotStyle -> {Automatic, Dashed}]

The latest Mathematica features, however, are available with a basic Wolfram Cloud account (free).

$\endgroup$
2
  • $\begingroup$ Thankyou. It is helpful. $\endgroup$
    – vini
    Apr 6, 2020 at 12:38
  • $\begingroup$ But I am using Mathematica version 9.0 . The plot is not shown. $\endgroup$
    – vini
    Apr 6, 2020 at 12:53

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.