Relativistic addition of velocities in wxMaxima



>   From: Robert Dodier <robert.dodier at gmail.com>
>   Date: Mon, 23 Sep 2013 19:12:54 +0000

>   On 2013-09-19, Jon Fleming <jonf at fleming-group.com> wrote:
>
>   >   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);
>
>   I gather that ctrl-R tells wxMaxima to reevaluate all cells. One of them
>   is load(vect), but 'vect' defines some simplification rules and if you
>   load it twice, the second time through you get the error about the
>   circular rule. There's certainly no harm in reevaluating the other
>   cells -- maybe you can put everything but load(vect) into a script,
>   then execute load(vect) once, then batch(yourscript) multiple times.
>   Just guessing, I don't know what you need to accomplish.


Rather than

load(vect);

use

if get(vect,version)=true then 'loaded else load(vect);

The vect package puts the version property of vect to true, so this
prevents repeated loads:

(%i1) if get(vect,version)=true then 'loaded else load(vect);

(%o1) "/home/work/maxima/sandbox/maxima-current-release/share/vector/vect.mac"
(%i2) if get(vect,version)=true then 'loaded else load(vect);

(%o2) loaded

Leo