12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931 |
- Tue Apr 15 00:32:36 2008 run on win32
- % Test of CANTENS.RED
- %
- % Authors: H. Caprasse <hubert.caprasse@ulg.ac.be>
- %
- % Version and Date: Version 1.1, 15 September 1998.
- %----------------------------------------------------------------
- off errcont;
- % Default :
- onespace ?;
- yes
- wholespace_dim ?;
- dim
-
- global_sign ? ;
- 1
-
- signature ?;
- 0
-
- % answers to the 4 previous commands: yes, dim, 1, 0
- wholespace_dim 4;
- 4
-
- signature 1;
- 1
- global_sign(-1);
- -1
- % answers to the three previous commands: 4, 1, (-1)
- % answer to the command below: {}
- show_spaces();
- {}
- % Several spaces:
- off onespace;
- onespace ?;
- no
-
- % answer: no
- show_spaces();
- {}
- define_spaces wholespace={6,signature=1,indexrange=0 .. 5};
- t
- % indexrange command is superfluous since 'wholespace':
- show_spaces();
- {{wholespace,6,signature=1,indexrange=0 .. 5}}
- rem_spaces wholespace;
- t
- define_spaces wholespace={11,signature=1};
- t
-
- define_spaces mink={4,signature=1,indexrange=0 .. 3};
- t
-
- define_spaces eucl={6,euclidian,indexrange=4 .. 9};
- t
-
- show_spaces();
- {{wholespace,11,signature=1},
- {mink,4,signature=1,indexrange=0 .. 3},
- {eucl,6,euclidian,indexrange=4 .. 9}}
- %
- % if input error or modifications necessary:
- %
- define_spaces eucl={7,euclidian,indexrange=4 .. 10};
- *** Warning: eucl cannot be (or is already) defined as space identifier
- t
- %
- % do:
- %
- rem_spaces eucl;
- t
- define_spaces eucl={7,euclidian,indexrange=4 .. 10};
- t
- show_spaces();
- {{wholespace,11,signature=1},
- {mink,4,signature=1,indexrange=0 .. 3},
- {eucl,7,euclidian,indexrange=4 .. 10}}
- % done
- %
- define_spaces eucl1={1,euclidian,indexrange=11 .. 11};
- t
-
- show_spaces();
- {{wholespace,11,signature=1},
- {mink,4,signature=1,indexrange=0 .. 3},
- {eucl,7,euclidian,indexrange=4 .. 10},
- {eucl1,1,euclidian,indexrange=11 .. 11}}
- rem_spaces wholespace,mink,eucl,eucl1;
- t
- show_spaces();
- {}
- %
- % Indices can be made to belong to a subspace or replaced
- % in the whole space:
- define_spaces eucl={3,euclidean};
- t
- show_spaces();
- {{eucl,3,euclidean}}
- mk_ids_belong_space({a1,a2},eucl);
- t
- % a1,a2 belong to the subspace eucl.
- mk_ids_belong_anyspace a1,a2;
- t
- % replaced in the whole space.
- rem_spaces eucl;
- t
- %%
- %% GENERIC TENSORS:
- on onespace;
- wholespace_dim dim;
- dim
- tensor te;
- t
-
- te(3,a,-4,b,-c,7);
- 3 a b 7
- te
- 4 c
-
- te(3,a,{x,y},-4,b,-c,7);
- 3 a b 7
- te (x,y)
- 4 c
- te(3,a,-4,b,{u,v},-c,7);
- 3 a b 7
- te (u,v)
- 4 c
- te({x,y});
- te(x,y)
-
- make_variables x,y;
- t
- te(x,y);
- te(x,y)
- te(x,y,a);
- a
- te (x,y)
-
-
- remove_variables x;
- t
- te(x,y,a);
- x a
- te (y)
-
- remove_variables y;
- t
- %
- % implicit dependence:
- %
- operator op2;
- depend op1,op2(x);
- df(op1,op2(x));
- df(op1,op2(x))
- % the next response is 0:
- df(op1,op2(y));
- 0
- clear op2;
- % case of a tensor:
- operator op1;
- depend te,op1(x);
-
- df(te(a,-b),op1(x));
- a
- df(te ,op1(x))
- b
- % next the outcome is 0:
- df(te(a,-b),op1(y));
- 0
- %
- tensor x;
- t
- depend te,x;
- % outcome is NOT 0:
- df(te(a,-b),x(c));
- a c
- df(te ,x )
- b
- %
- % Substitutions:
- sub(a=-c,te(a,b));
- b
- te
- c
- sub(a=-1,te(a,b));
- b
- te
- 1
-
- % the following operation is wrong:
- sub(a=-0,te(a,b));
- 0 b
- te
-
- % should be made as following to be correct:
- sub(a=-!0,te(a,b));
- b
- te
- 0
-
- % dummy indices recognition
- dummy_indices();
- {}
- te(a,b,-c,-a);
- a b
- te
- c a
- dummy_indices();
- {a}
- te(a,b,-c,-a);
- a b
- te
- c a
- dummy_indices();
- {a}
- % hereunder an error message correctly occurs:
- on errcont;
- te(a,b,-c,a);
- ***** ((c) (a b a)) are inconsistent lists of indices
- off errcont;
- sub(c=b,te(a,b,-c,-a));
- a b
- te
- b a
- dummy_indices();
- {b,a}
- % dummy indices suppression:
- on errcont;
- te(d,-d,d);
- ***** ((d) (d d)) are inconsistent lists of indices
- off errcont;
- dummy_indices();
- {d,b,a}
- rem_dummy_indices d;
- t
- te(d,d);
- d d
- te
- dummy_indices();
- {b,a}
- rem_dummy_indices a,b;
- t
- onespace ?;
- yes
- % case of space of integer dimension:
- wholespace_dim 4;
- 4
- signature 0;
- 0
- % 7 out of range
- on errcont;
- te(3,a,-b,7);
- ***** numeric indices out of range
- off errcont;
- te(3,a,-b,3);
- 3 a 3
- te
- b
- te(4,a,-b,4);
- 4 a 4
- te
- b
- % an 'out-of-range' error is issued:
- on errcont;
- sub(a=5,te(3,a,-b,3));
- ***** numeric indices out of range
- off errcont;
- signature 1;
- 1
- % now indices should run from 0 to 3 => error:
- on errcont;
- te(4,a,-b,4);
- ***** numeric indices out of range
- off errcont;
- % correct:
- te(0,a,-b,3);
- 0 a 3
- te
- b
- %
- off onespace;
- define_spaces wholespace={4,euclidean};
- t
- % We MUST say that te BELONG TO A SPACE, here to wholespace:
- make_tensor_belong_space(te,wholespace);
- wholespace
- on errcont;
- te(a,5,-b);
- ***** numeric indices out of range
- off errcont;
- te(a,4,-b);
- a 4
- te
- b
- rem_spaces wholespace;
- t
- define_spaces wholespace={5,signature=1};
- t
- define_spaces eucl={1,signature=0};
- t
- show_spaces();
- {{wholespace,5,signature=1},
- {eucl,1,signature=0}}
- make_tensor_belong_space(te,eucl);
- eucl
- te(1);
- 1
- te
- % hereunder, an error message is issued:
- on errcont;
- te(2);
- ***** numeric indices out of range
- off errcont;
- % hereunder, an error message should be issued, it is not
- % because no indexrange has been declared:
- te(0);
- 0
- te
- rem_spaces eucl;
- t
- define_spaces eucl={1,signature=0,indexrange=1 .. 1};
- t
- % NOW an error message is issued:
- on errcont;
- te(0);
- ***** numeric indices do not belong to (sub)-space
- off errcont;
- te(1);
- 1
- te
- % again an error message:
- on errcont;
- te(2);
- ***** numeric indices do not belong to (sub)-space
- off errcont;
- %
- rem_dummy_indices a,b,c,d;
- t
- % symmetry properties:
- %
- symmetric te;
- te(a,-b,c,d);
- a c d
- te
- b
- remsym te;
- antisymmetric te;
- te(a,b,-c,d);
- a b d
- - te
- c
- remsym te;
- % mixed symmetries:
- tensor r;
- t
- %
- symtree(r,{!+,{!-,1,2},{!-,3,4}});
- ra:=r(b,a,c,d)$
-
- canonical ra;
- a b c d
- - r
-
- ra:=r(c,d,a,b)$
- canonical ra;
- a b c d
- r
- % here canonical is short-cutted
- ra:=r(b,b,c,a);
- ra := 0
- %
- % symmetrization:
- on onespace;
- symmetrize(r(a,b,c,d),r,permutations,perm_sign);
- a b c d a b d c a c b d a c d b a d b c a d c b b a c d
- r - r - r + r + r - r - r
- b a d c b c a d b c d a b d a c b d c a c a b d c a d b
- + r + r - r - r + r + r - r
- c b a d c b d a c d a b c d b a d a b c d a c b d b a c
- - r + r + r - r - r + r + r
- d b c a d c a b d c b a
- - r - r + r
- canonical ws;
- a b c d a c b d a d b c
- 8*(r - r + r )
- off onespace;
- symmetrize({a,b,c,d},r,cyclicpermlist);
- a b c d b c d a c d a b d a b c
- r + r + r + r
- canonical ws;
- a b c d a d b c
- 2*(r - r )
- rem_tensor r;
- t
- % Declared bloc-diagonal tensor:
- rem_spaces wholespace,eucl;
- t
- define_spaces wholespace={7,signature=1};
- t
- define_spaces mink={4,signature=1,indexrange=0 .. 3};
- t
- define_spaces eucl={3,euclidian,indexrange=4 .. 6};
- t
- show_spaces();
- {{wholespace,7,signature=1},
- {mink,4,signature=1,indexrange=0 .. 3},
- {eucl,3,euclidian,indexrange=4 .. 6}}
- make_tensor_belong_space(te,eucl);
- eucl
- make_bloc_diagonal te;
- t
- mk_ids_belong_space({a,b,c},eucl);
- t
- te(a,b,z);
- a b z
- te
- mk_ids_belong_space({m1,m2},mink);
- t
- te(a,b,m1);
- 0
- te(a,b,m2);
- 0
- mk_ids_belong_anyspace a,b,c,m1,m2;
- t
- te(a,b,m2);
- a b m2
- te
- % how to ASSIGN a particular component ?
- % take the simplest context:
- rem_spaces wholespace,mink,eucl;
- t
- on onespace;
- te({x,y},a,-0)==x*y*te(a,-0);
- a
- te *x*y
- 0
-
- te({x,y},a,-0);
- a
- te *x*y
- 0
-
- te({x,y},a,0);
- a 0
- te (x,y)
-
-
- % hereunder an error message is issued because already assigned:
- on errcont;
- te({x,y},a,-0)==x*y*te(a,-0);
- a
- ***** te *x*y invalid as setvalue kernel
- 0
- off errcont;
- % clear value:
- rem_value_tens te({x,y},a,-0);
- t
- te({x,y},a,-0);
- a
- te (x,y)
- 0
-
- te({x,y},a,-0)==(x+y)*te(a,-0);
- a
- te *(x + y)
- 0
- % A small illustration
- te(1)==sin th * cos phi;
- cos(phi)*sin(th)
-
- te(-1)==sin th * cos phi;
- cos(phi)*sin(th)
- te(2)==sin th * sin phi;
- sin(phi)*sin(th)
- te(-2)==sin th * sin phi;
- sin(phi)*sin(th)
- te(3)==cos th ;
- cos(th)
- te(-3)==cos th ;
- cos(th)
- for i:=1:3 sum te(i)*te(-i);
- 2 2 2 2 2
- cos(phi) *sin(th) + cos(th) + sin(phi) *sin(th)
- rem_value_tens te;
- t
- te(2);
- 2
- te
- let te({x,y},-0)=x*y;
- te({x,y},-0);
- x*y
- te({x,y},0);
- 0
- te (x,y)
-
- te({x,u},-0);
- te (x,u)
- 0
- for all x,a let te({x},a,-b)=x*te(a,-b);
- te({u},1,-b);
- 1
- te *u
- b
- te({u},c,-b);
- c
- te *u
- b
- te({u},b,-b);
- b
- te *u
- b
- te({u},a,-a);
- a
- te (u)
- a
- for all x,a clear te({x},a,-b);
- te({u},c,-b);
- c
- te (u)
- b
- % rule for indices only
- for all a,b let te({x},a,-b)=x*te(a,-b);
- te({x},c,-b);
- c
- te *x
- b
- te({x},a,-a);
- a
- te *x
- a
- % A BUG still exists for -0 i.e. rule does NOT apply:
- te({x},a,-0);
- a
- te (x)
- 0
- % the cure is to use -!0 in this case
- te({x},0,-!0);
- 0
- te *x
- 0
- %
- % local rules:
- %
- rul:={te(~a) => sin a};
- ~a
- rul := {te => sin(a)}
- te(1) where rul;
- sin(1)
- %
- rul1:={te(~a,{~x,~y}) => x*y*sin(a)};
- ~a
- rul1 := {te (~x,~y) => x*y*sin(a)}
-
- %
- te(a,{x,y}) where rul1;
- sin(a)*x*y
- te({x,y},a) where rul1;
- sin(a)*x*y
- %
- rul2:={te(-~a,{~x,~y}) => x*y*sin(-a)};
- rul2 := {te (~x,~y) => x*y*sin( - a)}
- ~a
- %
- te(-a,{x,y}) where rul2;
- - sin(a)*x*y
-
- te({x,y},-a) where rul2;
- - sin(a)*x*y
- %% CANONICAL
- %
- % 1. Coherence of tensorial indices.
- %
- tensor te,tf;
- *** Warning: te redefined as generic tensor
- t
-
- dummy_indices();
- {a,b}
- make_tensor_belong_anyspace te;
- t
- on errcont;
- bb:=te(a,b)*te(-b)*te(b);
- a b b
- bb := te *te *te
- b
- % hereunder an error message is issued:
- canonical bb;
- ***** ((b) (a b b)) are inconsistent lists of indices
- off errcont;
- bb:=te(a,b)*te(-b);
- a b
- bb := te *te
- b
- % notice how it is rewritten by canonical:
- canonical bb;
- a b
- te *te
- b
- %
- dummy_indices();
- {a,b}
- aa:=te(d,-c)*tf(d,-c);
- d d
- aa := te *tf
- c c
- % if a and c are FREE no error message:
- canonical aa;
- d d
- te *tf
- c c
- % do NOT introduce powers for NON-INVARIANT tensors:
- aa:=te(d,-c)*te(d,-c);
- d 2
- aa := (te )
- c
- % Powers are taken away
- canonical aa;
- d
- te
- c
- % A trace CANNOT be squared because powers are removed by 'canonical':
- cc:=te(a,-a)^2$
- canonical cc;
- a
- te
- a
- %
- % Correct writing of the previous squared:
- cc:=te(a,-a)*te(b,-b)$
- canonical cc;
- a b
- te *te
- a b
- % all terms must have the same variance:
- on errcont;
- aa:=te(a,c)+x^2;
- a c 2
- aa := te + x
- canonical aa;
- ***** scalar added with tensor(s)
- aa:=te(a,b)+tf(a,c);
- a b a c
- aa := te + tf
- canonical aa;
- ***** mismatch in free indices : ((a c) (a b))
- off errcont;
- dummy_indices();
- {a,b}
- rem_dummy_indices a,b,c;
- t
- dummy_indices();
- {}
- % a dummy VARIABLE is NOT a dummy INDEX
- dummy_names b;
- t
- dummy_indices();
- {}
- % so, no error message in the following:
- canonical(te(b,c)*tf(b,c));
- b c b c
- te *tf
- % it is an incorrect input for a variable.
- % correct input is:
- canonical(te({b},c)*tf({b},c));
- c c
- te (b)*tf (b)
-
- clear_dummy_names;
- t
- % contravariant indices are placed before covariant ones if possible.
- % i.e. Riemanian spaces by default:
- pp:=te(a,-a)+te(-a,a)+1;
- a a
- pp := te + te + 1
- a a
-
- canonical pp;
- a
- 2*te + 1
- a
- pp:=te(a,-c)+te(-b,b,a,-c);
- b a a
- pp := te + te
- b c c
- canonical pp;
- a b a
- te + te
- c b c
- pp:=te(r,a,-f,d,-a,f)+te(r,-b,-c,d,b,c);
- r d b c r a d f
- pp := te + te
- b c f a
- canonical pp;
- r a b d
- 2*te
- a b
- % here, a case where a normal form cannot be obtained:
- tensor nt;
- t
- a1:=nt(-a,d)*nt(-c,a);
- d a
- a1 := nt *nt
- a c
- a2:=nt(-c,-a)*nt(a,d);
- a d
- a2 := nt *nt
- c a
-
- % obviously, a1-a2 =0, but ....
- canonical(a1-a2);
- d a a d
- - nt *nt + nt *nt
- a c c a
- % does give the same expression with the sign changed.
- % zero is either:
- canonical a1 -a2;
- 0
- % or
- a1 -canonical a2;
- 0
- % below the result is a2:
- canonical a1;
- a d
- nt *nt
- c a
- % below result is a1 again:
- canonical ws;
- d a
- nt *nt
- a c
- % the above manipulations are NOT DONE if space is AFFINE
- off onespace;
- define_spaces aff={dd,affine};
- t
- make_tensor_belong_space(te,aff);
- aff
-
- % dummy indices MUST be declared to belong
- % to a well defined space. here to 'aff':
- mk_ids_belong_space({a,b},aff);
- t
- canonical(te(-a,a));
- a
- te
- a
- canonical(te(-a,a)+te(b,-b));
- a a
- te + te
- a a
- canonical(te(-a,c));
- c
- te
- a
- % put back the system in the previous status:
- make_tensor_belong_anyspace te;
- t
- mk_ids_belong_anyspace a,b;
- t
- rem_spaces aff;
- t
- on onespace;
- %
- % 2. Summations with DELTA tensor.
- %
- make_partic_tens(delta,delta);
- t
- aa:=delta(a,-b)*delta(b,-c)*delta(c,-a) + 1;
- a b c
- aa := delta *delta *delta + 1
- b c a
- % below, answer is dim+1:
- canonical aa;
- dim + 1
- aa:=delta(a,-b)*delta(b,-c)*delta(c,-d)*te(d,e)$
- canonical aa;
- a e
- te
- % 3. Summations with DELTA and ETA tensors.
- make_partic_tens(eta,eta);
- t
- signature 1;
- 1
- aa:=eta(a,b)*eta(-b,-c);
- a b
- aa := eta *eta
- b c
- canonical aa;
- a
- delta
- c
- aa:=eta(a,b)*eta(-b,-c)*eta(c,d);
- a b c d
- aa := eta *eta *eta
- b c
- canonical aa;
- a d
- eta
- aa:=eta(a,b)*eta(-b,-c)*eta(d,c)*te(d,-a) +te(d,d);
- a b c d d d d
- aa := eta *eta *eta *te + te
- b c a
- canonical aa;
- d d
- 2*te
- aa:=delta(a,-b)*eta(b,c);
- a b c
- aa := delta *eta
- b
- canonical aa;
- a c
- eta
- aa:=delta(a,-b)*delta(d,-a)*eta(-c,-d)*eta(b,c);
- a d b c
- aa := delta *delta *eta *eta
- b a c d
- % below the answer is dim:
- canonical aa;
- dim
- aa:=delta(a,-b)*delta(d,-a)*eta(-d,-e)*te(f,g,e);
- a d f g e
- aa := delta *delta *eta *te
- b a d e
- canonical aa;
- f g
- te
- b
- % Summations with the addition of the METRIC tensor:
- make_partic_tens(g,metric);
- t
- g(1,2,{x})==1/4*sin x;
- sin(x)
- --------
- 4
- g({x},1,2);
- sin(x)
- --------
- 4
- aa:=g(a,b)*g(-a,-c);
- a b
- aa := g *g
- a c
-
- canonical aa;
- b
- delta
- c
- aa:=g(a,b)*g(c,d)*eta(-c,-b);
- a b c d
- aa := eta *g *g
- b c
- % answer is g(a,d):
- canonical aa;
- a d
- g
- tensor te;
- *** Warning: te redefined as generic tensor
- t
- aa:=g(a,b)*g(c,d)*eta(-c,-e)*eta(e,f)*te(-f,g);
- e f a b c d g
- aa := eta *eta *g *g *te
- c e f
- canonical aa;
- a b d g
- g *te
- % Summations with the addition of the EPSILON tensor.
- dummy_indices();
- {c,f,b,a}
- rem_dummy_indices a,b,c,f;
- t
- dummy_indices();
- {}
- wholespace_dim ?;
- dim
- signature ?;
- 1
- % define the generalized delta function:
- make_partic_tens(gd,del);
- t
- make_partic_tens(epsilon,epsilon);
- t
- aa:=epsilon(a,b)*epsilon(-c,-d);
- a b
- aa := epsilon *epsilon
- c d
- % Minus sign reflects the chosen signature.
- canonical aa;
- a b
- - gd
- c d
- aa:=epsilon(a,b)*epsilon(-a,-b);
- a b
- aa := epsilon *epsilon
- a b
- canonical aa;
- dim*( - dim + 1)
- aa:=epsilon(a,b,c,d)*epsilon(-a,-b,-c,-e);
- a b c d
- aa := epsilon *epsilon
- a b c e
- canonical aa;
- d 3 2
- delta *( - dim + 6*dim - 11*dim + 6)
- e
- on exdelt;
- % extract delta function down to the bottom:
- aa:=epsilon(a,b,c)*epsilon(-b,-d,-e);
- a b c
- aa := epsilon *epsilon
- b d e
- canonical aa;
- a c a c a c
- delta *delta *dim - 2*delta *delta - delta *delta *dim
- d e d e e d
- a c
- + 2*delta *delta
- e d
- off exdelt;
- % below expressed in terms of 'gd' tensor.
- canonical aa;
- a c
- gd *(dim - 2)
- d e
- rem_dummy_indices a;
- t
- aa:=epsilon(- b,-c)*eta(a,b)*eta(a,c);
- a b a c
- aa := epsilon *eta *eta
- b c
- % answer below is zero:
- canonical aa;
- 0
- aa:=epsilon(a,b,c)*te(-a)*te(-b);
- a b c
- aa := epsilon *te *te
- a b
- % below the result is again zero.
- canonical aa;
- 0
- %
- tensor tf,tg;
- *** Warning: tf redefined as generic tensor
- t
- aa:=epsilon(a,b,c)*te(-a)*tf(-b)*tg(-c)+epsilon(d,e,f)*te(-d)*tf(-e)*tg(-f);
- a b c d e f
- aa := epsilon *te *tf *tg + epsilon *te *tf *tg
- a b c d e f
- % below the result is twice the first term.
- canonical aa;
- a b c
- 2*epsilon *te *tf *tg
- a b c
- aa:=epsilon(a,b,c)*te(-a)*tf(-c)*tg(-b)+epsilon(d,e,f)*te(-d)*tf(-e)*tg(-f);
- a b c d e f
- aa := epsilon *te *tf *tg + epsilon *te *tf *tg
- a c b d e f
- % below the result is zero.
- canonical aa;
- 0
- % An illustration when working inside several spaces.
- rem_dummy_indices a,b,c,d,e,f;
- t
- off onespace;
- define_spaces wholespace={dim,signature=1};
- t
- define_spaces sub4={4,signature=1};
- t
- define_spaces subd={dim-4,signature=0};
- t
- show_spaces();
- {{wholespace,dim,signature=1},
- {sub4,4,signature=1},
- {subd,dim - 4,signature=0}}
- make_partic_tens(epsilon,epsilon);
- *** Warning: epsilon redefined as particular tensor
- t
- make_tensor_belong_space(epsilon,sub4);
- sub4
- make_partic_tens(kappa,epsilon);
- *** Warning: kappa MUST belong to a space
- t
- make_tensor_belong_space(kappa,subd);
- subd
- show_epsilons();
- {{kappa,subd},{epsilon,sub4}}
- mk_ids_belong_space({i,j,k,l,m,n,r,s},sub4);
- t
- mk_ids_belong_space({a,b,c,d,e,f},subd);
- t
- off exdelt;
- aa:=kappa(a,b,c)*kappa(-d,-e,-f)*epsilon(i,j,k,l)*epsilon(-k,-l,-i,-j);
- i j k l a b c
- aa := epsilon *epsilon *kappa *kappa
- i j k l d e f
- canonical aa;
- a b c
- - 24*gd
- d e f
- aa:=kappa(a,b,c)*kappa(-d,-e,-f)*epsilon(i,j,k,l)*epsilon(-m,-n,-r,-s);
- i j k l a b c
- aa := epsilon *epsilon *kappa *kappa
- m n r s d e f
- canonical aa;
- a b c i j k l
- - gd *gd
- d e f m n r s
- end;
- Time for test: 54 ms, plus GC time: 4 ms
|