On Thu, 2011-08-04 at 17:33 +0200, syn hedionn wrote:
> Hi,
> Is there a way to follow notation of physics in order that writing
> diff(omega(t),t) doesn't output this but the omega letter with a dot
> at the top of the letter(speed), 2dots for a double
> derivation=acceleration?
I am developing a module for doing Lagrangian mechanics. It uses primes
for doing time derivatives. I am a bit wary of attaching it to an email
because it is in a very messy state and, since I haven't documented any
of it, you wouldn't know what to do with it. Maybe in a couple of weeks
I will have a pre-release. However to give you some idea, of what I am
doing here it is finding equations of motion from a Lagrangian and
solving them:
(%i1) load("tdot.mac");
(%o1) /home/consultant/.maxima/mydefaults/tdot.mac
(%i2) gcoords(x,y,z);
(%o2) done
(%i3) UfrakL = (m/2)*(diff(x,t)^2+diff(y,t)^2+diff(z,t)^2) + m*g*z;
2 2 2
m z? m y? m x?
(%o3) ? = ----- + g m z + ----- + -----
2 2 2
(%i4) LagrangEqns(%);
(%o4) [m x? = 0, m y? = 0, m (z? - g) = 0]
(%i5) msolve(%);
2
g t
(%o5) [x = t v + x , y = t v + y , z = t v + ---- + z ]
x o y o z 2 o
The derivatives are implemented by rules like:
tellsimp ('diff(xx,t,1),get(xx,dif))
Where xx picks out one of the variables declared in gcoords(x,y,z) - see
(%i2) - and get(xx,dif) evaluates to x? - it was obtained using
concat(x,?). msolve calls translates the differential equations into the
usual maxima form, adds an explicit time dependency and calls desolve.
It also knows that some derivatives should be partial and has a
different notation for them, as in:
(%i1) load ("tdot.mac");
(%o1) /home/consultant/.maxima/mydefaults/tdot.mac
(%i2) gcoords (x, y, z);
(%o2) done
(%i3) T = (m/2)*(diff(x,t)^2+diff(y,t)^2+diff(z,t)^2);
2 2 2
m z? m y? m x?
(%o3) T = ----- + ----- + -----
2 2 2
(%i4) diff(%,diff(x,t));
(%o4) ? (T) = m x?
?x?
(%i5) diff(%,t);
d
(%o5) -- (? (T)) = m x?
dt ?x?
Obviously I still have to work on the partial derivative notation, but
its staring to look like hat you see in physics textbooks.
Cheers,
Bernard.