I have a question about NDSolve function in Mathematica.
I have an oscillator defined by these two equations:
x' = v
v' = -x - u*v^3
where u is some constant.
How to create an NDSolve that resolves this? I tried following code (it has to depend on time) but it doesnt work:
eq1 = x'[t] == v;
eq2 = v' == -x[t] - u*v^3;
eq3 = x[0] == 2;
(initial displacement is 2m).
s = NDSolve[{eq1, eq2, eq3}, x, {t, 0, 30}]
Thank you very much…
You need to observe that the first equation once differentiated with respect to
tcan be used to substitute forv[t]. But then the second equation becomes a ODE of second order and requires to be supplied with another extra initial condition. We will giveThen after solving this ODE for
xyou can recoverv[t]==x'[t]I give you the solution in term of a
Manipulateso that geometrically the situation becomes clear to you.Hope this helps you but next time before you ask you need to brush up the theory first as you can see the question you asked concerns very basic and elementary Mathematics not Mathematica programming. Good luck!!