How write these two motions into one system

113 Views Asked by At

f describe the horizontal motion g describe the vertical motion

have error when put m(t) in x()

Maple code

f := sin(m(t));
g := piecewise(t < 0, Diff(x(m(t)),m(t)$2)+2*Diff(x(m(t)),m(t))+10*x(m(t)), t > 0, Diff(x(m(t)),m(t)$2)-2*Diff(x(m(t)),m(t))+10*x(m(t)));

origin from

g := piecewise(t < 0, Diff(x(t),t$2)+2*Diff(x(t),t)+10*x(t), t > 0, Diff(x(t),t$2)-2*Diff(x(t),t)+10*x(t));
plot(subs(_C2=1,subs(_C1=1,rhs(dsolve(g, x(t))))), t=-5..5);
plot(subs(_C2=1,subs(_C1=1,rhs(dsolve(g, x(t))))), t=-1..1);
eq := diff(g,x(t))-diff(diff(g,diff(x(t),t)),t);

updated

h := sin(t);

g := piecewise(t < 0, Diff(x(h),h$2)+2*Diff(x(h),h)+10*x(h), t > 0,Diff(x(h),h$2)-2*Diff(x(h),h)+10*x(h));

dsolve([g,h]);

can not solve

Error, (in unknown) invalid input: diff received sin(t), which is not valid for its 2nd argument

update 2

after change to 1/Diff(h,t$2)*Diff(x(h),t$2)

Diff(x(h),t$2) <- how about x(h) ?

f := sin(t);
g := piecewise(t < 0, 1/(Diff(f,t$2)*Diff(x(f),t$2)+2/(Diff(f,t))*Diff(x(f),t)+10*x(f), t > 0), 1/(Diff(f,t$2))*Diff(x(f),t$2)-2*(1/Diff(f,t))*Diff(x(f),t)+10*x(f));
dsolve({f,g});

no solution !!

1

There are 1 best solutions below

4
On

The second parameter of commands diff and Diff must be the name of a variable (or several variables, if you take a mixed derivative). Neither m(t) nor x(t) is the name of a variable, hence the error message.

The best thing to do is to reconsider what your variables mean and what derivatives you want to take. Since I do not know what you have in mind, I give a workaround solution: you can substitute a variable instead of m(t), differentiate with respect to that variable, and then reverse the substitution. For example:

f:=sin(m(t)); 
eval(diff(eval(f,m(t)=m),m),m=m(t));

returns cos(m(t)).

This is, of course, different from diff(f,t); which would return $\cos(m(t)) \frac{d}{dt}m(t)$, according to the chain rule.


I repeat that you should focus on getting the logic of your formulas right, and worry about the syntax later. I don't see much logic in your present code samples.