1
$\begingroup$

I'm tryin to make a 3D plot of a differential-equation. I already found:

$$\begin{align*} &x_1' = f(t) x_4 - x_2\\ &x_2' = -f(t) x_3 + x_1\\ &x_3' = f(t) x_2 + x_4\\ &x_4' = -f(t) x_1 - x_3 \end{align*}$$

And the equation $x_1^2 + x_2^2 + x_3^2 + x_4^2 = 1$.

$f(t) = \lambda \sin(o\cdot t)$

Now I have to make a 3D plot of this in maple, but I keep getting errors. I have been told I'm able to plot this 3D cause of the given equation, $t \to \big(x_1(t), x_2(t), x_3(t)\big)$. Here's the code I've been using so far:

1 := 1;  o := 1;  

diffe := diff(x(t), t) =l sin(o*t). q(t) - y(t), diff(y(t), t)  
       =-l sin(o*t) * z(t) + x(t), diff(z(t), t) = l sin(o*t)y(t)+q(t);  

bvw := x(0) = 1, y(0) = 0, z(0) = 0,;

solution := dsolve([dvgl, bvw], [x(t), y(t), z(t)], numeric)
$\endgroup$

1 Answer 1

1
$\begingroup$

There are a few errors in the code: typo of numeral 1 instead of letter l on the lhs of an assignment, and name dvg1 instead of diffe, and nothing about q(t) or q(0).

Try this,

restart:

f := t -> lambda*sin(o*t):
lambda := 1:
o := 1:

diffe := diff(x(t), t) = f(t)*q(t) - y(t),
     diff(y(t), t) = -f(t)*z(t) + x(t),
     diff(z(t), t) = f(t)*y(t) + q(t):

bvw := x(0) = 1, y(0) = 0, z(0) = 0:

eq := x(t)^2+y(t)^2+z(t)^2+q(t)^2 = 1:

subs(t=0,eq);
eval(subs(t=0,eq),[bvw]);
{solve(eval(subs(t=0,eq),[bvw]),{q(0)})};
qIC:={solve(eval(subs(t=0,eq),[bvw]),{q(0)})}[][];

solution := dsolve([diffe, bvw, eq, qIC], [x(t), y(t), z(t), q(t)], numeric):

plots:-odeplot(solution,[x(t),y(t),z(t)],t=0..10,axes=box);

enter image description here

I repeated three commands while determining the initial condition q(0)=1, which follows from eq and the other ICs bvw.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .