0
$\begingroup$

I am trying to find a solution to this system of differential equations but the program gives the same output without any messages. I would like help. Please find the Mathematica code posted here. a and d are Constants, $I=\sqrt{-1}$

S1 = I y' == Cos[a t] Exp[- I d t] x;

S2 = I x' == Cos[a t] Exp[ I d t] y;

S = {S1, S2};

DSolve[S, {y, x}, t]
$\endgroup$

1 Answer 1

2
$\begingroup$

I haven't found a way to get DSolve to crack it, so turn to NDSolve

a=1;d=2;
sol={y[t],x[t]}/.NDSolve[{
  I y'[t] == Cos[a t] Exp[-I d t] x[t], I x'[t] == Cos[a t] Exp[I d t] y[t],
  y[0]==1,x[0]==1}, {y[t], x[t]}, {t,0,2}][[1]];
Plot[{Re[sol[[1]]],Im[sol[[1]]],Re[sol[[2]]],Im[sol[[2]]]},{t,0,2}]

which instantly gives you plots of the real and complex components of x and y.

$\endgroup$
1
  • $\begingroup$ Thank you 'so much for this good idea it's really effective @Bill $\endgroup$ Commented Sep 10, 2019 at 8:01

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.