2
$\begingroup$

This question already has an answer here:

s = 
  NDSolve[
    {x''[t] == ω^2 x[t] + 2 ω y'[t], y''[t] == ω^2 y[t] - 2 ω x'[t], 
     x[0] == -.5, x'[0] == v0/Sqrt[2], y[0] == 0, y'[0] == v0/Sqrt[2]},
    {x, y}, t]

I am trying to solve the above coupled, second-order differential equation, but I'm getting this error:

NDSolve::deqn: Equation or list of equations expected instead of True in the first argument {True, y [t]-2 (x′)[t] == ω^2 y[t] - 2]ω x′[t], x[0] == -0.5, True, y[0] == 0, True}.

Any suggestions?

$\endgroup$

marked as duplicate by Chris K, LCarvalho, xzczd, Michael E2 differential-equations Dec 10 '17 at 16:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
$\begingroup$

Try:

v0 = 1;
ω = 1;
s = 
  NDSolve[
    {x''[t] == ω^2 x[t] + 2 ω y'[t], y''[t] == ω^2 y[t] - 2 ω x'[t], 
     x[0] == -0.5, x'[0] == v0/Sqrt[2], y[0] == 0, y'[0] == v0/Sqrt[2]}, 
    {x, y}, {t, 0, 1}];

Plot[{x[t] /. s, y[t] /. s}, {t, 0, 1},
  PlotLegends -> {"x[t]", "y[t]"},
  AxesLabel -> {t, {x[t], y[t]}}]

NDSolve needs numeric values assigned to constants.

If you need a symbolic solution try DSolve.

ClearAll["Global`*"];

s1 = 
  DSolve[
    {x''[t] == ω^2 x[t] + 2 ω y'[t], y''[t] == ω^2 y[t] - 2 ω x'[t], 
     x[0] == -1/2, x'[0] == v0/Sqrt[2], y[0] == 0, y'[0] == v0/Sqrt[2]}, 
    {x[t], y[t]}, t] // ExpToTrig // FullSimplify

s1 // Flatten // TeXForm

$$\{x(t)\to \frac{1}{2} \left(t \left(\sqrt{2} \text{v0}-\omega \right) \sin (t \omega )+\left(\sqrt{2} t \text{v0}-1\right) \cos (t \omega )\right),$$ $$y(t)\to \frac{1}{2} \left(\left(1-\sqrt{2} t \text{v0}\right) \sin (t \omega )+t \left(\sqrt{2} \text{v0}-\omega \right) \cos (t \omega )\right)\}$$

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.