Subject: Relativistic addition of velocities in wxMaxima
From: Jon Fleming
Date: Thu, 19 Sep 2013 12:00:23 -0400
Hope the formatting is OK.
Major newbie here; I've used Macsyma a little, decades ago, and I'm very familiar with Lisp.
I'm trying to add some velocities relativistically and get the resultant vector's magnitude
in Maxima 5.30.0 (to learn a little more about Maxima and demonstrate that in a particular case it's not necessary).
I'm using the formula from John Baez at http://math.ucr.edu/home/baez/physics/Relativity/SR/velocity.html
(near the bottom under Relative Speeds):
(u-v).(u-v) - (u ? v)^2/c^2
w^2 = -------------------------
(1 - (u.v)/c^2)^2
and the formula (u ? v)^2 = (u.u)(v.v) - (u.v)^2 found just underneath.
In wxMaxima I have, after pressing <Ctrl-R>:
| load(vect);
| u: [-3.84,0,0];
| v: [0,0,3.84];
| c: 299792.458;
| CPsquared(v1, v2) := (v1 . v1)*(v2 . v2) - (v1 . v2)^2;
| addrelativistic(v1, v2) := sqrt(((v2 - v1) . (v2 - v1) - CPsquared(v1, v2)/c^2)/(1 - (v2 . v1)^2/c^2)^2);
| tellsimpafter: circular rule attempted.
| -- an error. To debug this try: debugmode(true);
| addrelativistic(u,v);
If I do it on the command line by pasting from wxMaxima I get:
(%i1) load(vect);u: [-3.84,0,0];v: [0,0,3.84];c: 299792.458;CPsquared(v1, v2) :
(v1 . v1)*(v2 . v2) - (v1 . v2)^2;addrelativistic(v1, v2) := sqrt(((v2 - v1) .
(v2 - v1) - CPsquared(v1, v2)/c^2)/(1 - (v2 . v1)^2/c^2)^2);
(%o1) C:/PROGRA~2/MAXIMA~1.0/share/maxima/5.30.0/share/vector/vect.mac
(%i2) (%o2) [- 3.84, 0, 0]
(%i3) (%o3) [0, 0, 3.84]
(%i4) (%o4) 299792.458
(%i5) 2
(%o5) CPsquared(v1, v2) := (v1 . v1) (v2 . v2) - (v1 . v2)
(%i6) (%o6) addrelativistic(v1, v2) :=
CPsquared(v1, v2)
(v2 - v1) . (v2 - v1) - -----------------
2
c
sqrt(-----------------------------------------)
2
(v2 . v1) 2
(1 - ----------)
2
c
(%i7) addrelativistic(u,v);
(%o7) 5.43058007928994
which is the correct answer. So why can't I do it in wxMaxima?
Bonus extra credit question: in wxMaxima how does one add an expression to a
cell or a new input cell with the focus? Most of the time when I start typing
in a cell it appears in the results portion and disappears when I press <Ctrl-R>,
or if I manage to insert a new cell I can't type in it, only in the top cell.
I wind up closing and re-opening wxMaxima several times because after I've
tried something nothing else works until I close and re-open.