test file with matrix



Am Mittwoch, den 09.03.2011, 13:22 -0800 schrieb Edwin Woollett:
> How can I use a test file item containing
> the Maxima matrix object?
> 
> my test file dgintro2-test.mac has, for problems
> 151-156 the lines:
> -------------------------------
> 
> up1 : UU(E,E,0,0,1);
> matrix([0],[0],[sqrt(2*E)],[0]);
> vp2b : sbar (VV (E,E,%pi,0,-1));
> matrix([0,-sqrt(2*E),0,0]);
> a12 : vp2b . Gam[mu] . up1;
> matrix([0,-sqrt(2*E),0,0]) . Gam[mu] . matrix([0],[0],[sqrt(2*E)],[0]);
> up3b : sbar (UU (E,E,th,0,1));
> matrix([cos(th/2)*sqrt(2*E),sin(th/2)*sqrt(2*E),0,0]);
> vp4 : VV (E,E,%pi-th,%pi,-1);
> matrix([0],[0],[-cos((%pi-th)/2)*sqrt(2*E)],
>               [sin((%pi-th)/2)*sqrt(2*E)]);
> a34 : up3b . Gam[mu] . vp4;
> matrix([cos(th/2)*sqrt(2*E),sin(th/2)*sqrt(2*E),0,0])
>          . Gam[mu]
>          . matrix([0],[0],[-cos((%pi-th)/2)*sqrt(2*E)],
>                   [sin((%pi-th)/2)*sqrt(2*E)]);
> 
> ---------------------------
> and the batch file run
>   batch ("dgintro2-test.mac",test) gives, for
> these problems the output:
> 
> -----------------------
> ********************** Problem 151 ***************
> Input:
> up1:UU(E,E,0,0,1)
> 
> 
> Result:
> matrix([0],[0],[sqrt(2*E)],[0])
> 
> This differed from the expected result:
> matrix([0],[0],[sqrt(2*E)],[0])
> 
> ********************** Problem 152 ***************
> Input:
> vp2b:sbar(VV(E,E,%pi,0,-1))
> 
> 
> Result:
> matrix([0,-sqrt(2*E),0,0])
> 
> This differed from the expected result:
> matrix([0,-sqrt(2*E),0,0])
> 
> ********************** Problem 153 ***************
> Input:
> a12:vp2b . Gam[mu] . up1
> 
> 
> Result:
> matrix([0,-sqrt(2*E),0,0]) . Gam[mu] . matrix([0],[0],[sqrt(2*E)],[0])
> 
> This differed from the expected result:
> matrix([0,-sqrt(2*E),0,0]) . Gam[mu] . matrix([0],[0],[sqrt(2*E)],[0])
> 
> ********************** Problem 154 ***************
> Input:
> up3b:sbar(UU(E,E,th,0,1))
> 
> 
> Result:
> matrix([cos(th/2)*sqrt(2*E),sin(th/2)*sqrt(2*E),0,0])
> 
> This differed from the expected result:
> matrix([cos(th/2)*sqrt(2*E),sin(th/2)*sqrt(2*E),0,0])
> 
> ********************** Problem 155 ***************
> Input:
> vp4:VV(E,E,%pi-th,%pi,-1)
> 
> 
> Result:
> matrix([0],[0],[-cos((%pi-th)/2)*sqrt(2*E)],[sin((%pi-th)/2)*sqrt(2*E)])
> 
> This differed from the expected result:
> matrix([0],[0],[-cos((%pi-th)/2)*sqrt(2*E)],[sin((%pi-th)/2)*sqrt(2*E)])
> 
> ********************** Problem 156 ***************
> Input:
> a34:up3b . Gam[mu] . vp4
> 
> 
> Result:
> matrix([cos(th/2)*sqrt(2*E),sin(th/2)*sqrt(2*E),0,0])
>   . Gam[mu]
>   . matrix([0],[0],[-cos((%pi-th)/2)*sqrt(2*E)],[sin((%pi-th)/2)*sqrt(2*E)])
> 
> This differed from the expected result:
> matrix([cos(th/2)*sqrt(2*E),sin(th/2)*sqrt(2*E),0,0])
>   . Gam[mu] . matrix([0],[0],[-cos((%pi-th)/2)*sqrt(2*E)],
>                      [sin((%pi-th)/2)*sqrt(2*E)])
> ------------------------------------------
> 
> Is there a way I can get around this behavior??
> 
> ( am using display2d:false,
> ver 5.23.2 with windows xp with
> xmaxima interface)

It is often a problem, that the output looks identically for the result
and the test. But often there are subtle differences, because the test
input is simplified before it is compared with the result. 

I do not know the problem for your examples. Perhaps you can send me
your complete batch file, and I will have a look at it. 

One workaround I often use is to subtract and simplify the expressions
to check for a zero result.

Dieter Kaiser