|
From: Rupert S. <rsw...@gm...> - 2014-05-16 19:08:43
|
David Brant <bra...@ho...> writes:
> Hello. How might i best implement the following basic operations in
> maxima to get the two solutions ?
>
> m(t)^2= e(t)^2^ - k (m and e are functions of t, k is a constant)
>
> 1) differentiate wrt t
>
> 2*m(t)*dm/dt = 2*e(t)*de/dt
>
>
> 2) tidy up
>
> dm/dt = e(t)/r(t)*de/dt (solution 1)
>
>
> 3) differentiate again wrt t
>
> m*d2m/dt2 + (dm/dt)^2 = e*d2e/dt2 + (de/dt)^2
>
>
> 4) tidy up again to finally get
>
> d2m/dt2 = e/m*d2e/dt2 + ((de/dt)^2 - (dm/dt)^2)/m (solution 2)
>
>
> Any help would be very much appreciated.
Something like this?
(%i34) eq1: m(t)^2 = e(t)^2 - k;
2 2
(%o34) m (t) = e (t) - k
(%i35) diff(eq1, t);
d d
(%o35) 2 m(t) (-- (m(t))) = 2 e(t) (-- (e(t)))
dt dt
(%i36) solve(%, 'diff(m(t), t));
d
e(t) (-- (e(t)))
d dt
(%o36) [-- (m(t)) = ----------------]
dt m(t)
(%i37) diff (first (%), t);
2
d
d d e(t) (--- (e(t)))
2 e(t) (-- (e(t))) (-- (m(t))) 2
d dt dt dt
(%o37) --- (m(t)) = - ---------------------------- + -----------------
2 2 m(t)
dt m (t)
d 2
(-- (e(t)))
dt
+ ------------
m(t)
(%i38) subst (first (%o36), %);
2
d
e(t) (--- (e(t))) d 2 2 d 2
2 2 (-- (e(t))) e (t) (-- (e(t)))
d dt dt dt
(%o38) --- (m(t)) = ----------------- + ------------ - ------------------
2 m(t) m(t) 3
dt m (t)
In case the last line is a bit cryptic, I'm basically doing something
like
subst (y=a, expr(y));
to get
expr(a)
But the equation is coming from the solution that solve found in %o36,
so "y" is m'(t) and "a" is e'(t)*e(t)/m(t).
It occurred to me that all of those "...(t)" bits are a bit
annoying. Another approach is to tell Maxima that e and m depend on t
and then to work from there. For example:
(%i40) depends([e,m], t);
(%o40) [e(t), m(t)]
(%i41) eq2: m^2 = e^2 - k;
2 2
(%o41) m = e - k
(%i42) diff(eq2, t);
dm de
(%o42) 2 m -- = 2 e --
dt dt
(%i43) solve(%, 'diff(m,t));
de
e --
dm dt
(%o43) [-- = ----]
dt m
(%i44) diff (first (%), t);
2
d e
de dm e --- de 2
2 e -- -- 2 (--)
d m dt dt dt dt
(%o44) --- = - ------- + ----- + -----
2 2 m m
dt m
(%i45) subst (first (%o43), %);
2
d e
e --- de 2 2 de 2
2 2 (--) e (--)
d m dt dt dt
(%o45) --- = ----- + ----- - --------
2 m m 3
dt m
It's exactly the same calculation, but the results look a little less
cumbersome.
Hope this is some use,
Rupert
|