1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237 |
- Tue Feb 10 12:26:42 2004 run on Linux
- *** ^ redefined
- % Vector test routine
- % Author: David Harper (algebra@liverpool.ac.uk)
- % Computer Algebra Support Officer
- % University of Liverpool Computer Laboratory.
- % Please compare carefully the output from running this test file with the
- % log file provided to make sure your implementation is correct.
- linelength 72;
- 80
- off allfac;
- on div;
- vec a,b,c;
- matrix q;
- a := avec(ax,ay,az);
- vec(x) := ax
- vec(y) := ay
- vec(z) := az
- b := avec(bx,by,bz);
- vec(x) := bx
- vec(y) := by
- vec(z) := bz
- q := mat((q11,q12,q13),(q21,q22,q23),(q31,q32,q33));
- [q11 q12 q13]
- [ ]
- q := [q21 q22 q23]
- [ ]
- [q31 q32 q33]
- c := a+b;
- vec(x) := ax + bx
- vec(y) := ay + by
- vec(z) := az + bz
- c := a-b;
- vec(x) := ax - bx
- vec(y) := ay - by
- vec(z) := az - bz
- c := a cross b;
- vec(x) := ay*bz - az*by
- vec(y) := - ax*bz + az*bx
- vec(z) := ax*by - ay*bx
- d := a dot b;
- d := ax*bx + ay*by + az*bz
- a dot c;
- 0
- b dot c;
- 0
- q*a;
- vec(x) := ax*q11 + ay*q12 + az*q13
- vec(y) := ax*q21 + ay*q22 + az*q23
- vec(z) := ax*q31 + ay*q32 + az*q33
- c:=2*f*a - b/7;
- 1
- vec(x) := 2*ax*f - ---*bx
- 7
- 1
- vec(y) := 2*ay*f - ---*by
- 7
- 1
- vec(z) := 2*az*f - ---*bz
- 7
- c(0);
- 1
- 2*ax*f - ---*bx
- 7
- c(1);
- 1
- 2*ay*f - ---*by
- 7
- c(2);
- 1
- 2*az*f - ---*bz
- 7
- 1/vmod(a);
- 2 2 2 - 1/2
- (ax + ay + az )
- b/vmod(a);
- 2 2 2 - 1/2
- vec(x) := (ax + ay + az ) *bx
- 2 2 2 - 1/2
- vec(y) := (ax + ay + az ) *by
- 2 2 2 - 1/2
- vec(z) := (ax + ay + az ) *bz
- (a cross b)/(a dot b);
- ay*bz - az*by
- vec(x) := -----------------------
- ax*bx + ay*by + az*bz
- - ax*bz + az*bx
- vec(y) := -----------------------
- ax*bx + ay*by + az*bz
- ax*by - ay*bx
- vec(z) := -----------------------
- ax*bx + ay*by + az*bz
- 2/3*vmod(a)*a*(a dot c)/(vmod(a cross c));
- 28 2 2 2 2
- vec(x) := ----*(ax *by + ax *bz - 2*ax*ay*bx*by - 2*ax*az*bx*bz
- 3
- 2 2 2 2 2 2 2 2
- + ay *bx + ay *bz - 2*ay*az*by*bz + az *bx + az *by
- - 1 2 2 2 3 2 2 2
- )**------*sqrt(ax + ay + az )*ax *f - ---*(ax *by
- 2 3
- 2 2 2 2
- + ax *bz - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx
- 2 2 2 2 2 2 - 1
- + ay *bz - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2 28 2 2 2 2
- *sqrt(ax + ay + az )*ax *bx + ----*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2 2 2 2 2 2
- *sqrt(ax + ay + az )*ax*ay *f - ---*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 28 2 2 2 2
- *sqrt(ax + ay + az )*ax*ay*by + ----*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2 2 2 2 2 2
- *sqrt(ax + ay + az )*ax*az *f - ---*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2
- *sqrt(ax + ay + az )*ax*az*bz
- 28 2 2 2 2
- vec(y) := ----*(ax *by + ax *bz - 2*ax*ay*bx*by - 2*ax*az*bx*bz
- 3
- 2 2 2 2 2 2 2 2
- + ay *bx + ay *bz - 2*ay*az*by*bz + az *bx + az *by
- - 1 2 2 2 2 2 2 2
- )**------*sqrt(ax + ay + az )*ax *ay*f - ---*(ax *by
- 2 3
- 2 2 2 2
- + ax *bz - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx
- 2 2 2 2 2 2 - 1
- + ay *bz - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 28 2 2 2 2
- *sqrt(ax + ay + az )*ax*ay*bx + ----*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 3 2 2 2 2 2
- *sqrt(ax + ay + az )*ay *f - ---*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2 28 2 2 2 2
- *sqrt(ax + ay + az )*ay *by + ----*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2 2 2 2 2 2
- *sqrt(ax + ay + az )*ay*az *f - ---*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2
- *sqrt(ax + ay + az )*ay*az*bz
- 28 2 2 2 2
- vec(z) := ----*(ax *by + ax *bz - 2*ax*ay*bx*by - 2*ax*az*bx*bz
- 3
- 2 2 2 2 2 2 2 2
- + ay *bx + ay *bz - 2*ay*az*by*bz + az *bx + az *by
- - 1 2 2 2 2 2 2 2
- )**------*sqrt(ax + ay + az )*ax *az*f - ---*(ax *by
- 2 3
- 2 2 2 2
- + ax *bz - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx
- 2 2 2 2 2 2 - 1
- + ay *bz - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 28 2 2 2 2
- *sqrt(ax + ay + az )*ax*az*bx + ----*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2 2 2 2 2 2
- *sqrt(ax + ay + az )*ay *az*f - ---*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 28 2 2 2 2
- *sqrt(ax + ay + az )*ay*az*by + ----*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 3 2 2 2 2 2
- *sqrt(ax + ay + az )*az *f - ---*(ax *by + ax *bz
- 3
- 2 2 2 2
- - 2*ax*ay*bx*by - 2*ax*az*bx*bz + ay *bx + ay *bz
- 2 2 2 2 - 1
- - 2*ay*az*by*bz + az *bx + az *by )**------
- 2
- 2 2 2 2
- *sqrt(ax + ay + az )*az *bz
- a := avec(x**2*y**3,log(z+x),13*z-y);
- 2 3
- vec(x) := x *y
- vec(y) := log(x + z)
- vec(z) := - y + 13*z
- df(a,x);
- 3
- vec(x) := 2*x*y
- 1
- vec(y) := -------
- x + z
- vec(z) := 0
- df(a,x,y);
- 2
- vec(x) := 6*x*y
- vec(y) := 0
- vec(z) := 0
- int(a,x);
- 1 3 3
- vec(x) := ---*x *y
- 3
- vec(y) := log(x + z)*x + log(x + z)*z - x
- vec(z) := - x*y + 13*x*z
- exp(a);
- 2 3
- x *y
- vec(x) := e
- vec(y) := x + z
- - y + 13*z
- vec(z) := e
- log sin b;
- vec(x) := log(sin(bx))
- vec(y) := log(sin(by))
- vec(z) := log(sin(bz))
- a := avec(ax,ay,az);
- vec(x) := ax
- vec(y) := ay
- vec(z) := az
- depend ax,x,y,z;
- depend ay,x,y,z;
- depend az,x,y,z;
- depend p,x,y,z;
- c := grad p;
- vec(x) := df(p,x)
- vec(y) := df(p,y)
- vec(z) := df(p,z)
- div c;
- df(p,x,2) + df(p,y,2) + df(p,z,2)
- delsq p;
- df(p,x,2) + df(p,y,2) + df(p,z,2)
- div a;
- df(ax,x) + df(ay,y) + df(az,z)
- curl a;
- vec(x) := - df(ay,z) + df(az,y)
- vec(y) := df(ax,z) - df(az,x)
- vec(z) := - df(ax,y) + df(ay,x)
- delsq a;
- vec(x) := df(ax,x,2) + df(ax,y,2) + df(ax,z,2)
- vec(y) := df(ay,x,2) + df(ay,y,2) + df(ay,z,2)
- vec(z) := df(az,x,2) + df(az,y,2) + df(az,z,2)
- depend h1,x,y,z;
- depend h2,x,y,z;
- depend h3,x,y,z;
- scalefactors(h1,h2,h3);
- grad p;
- -1
- vec(x) := df(p,x)*h1
- -1
- vec(y) := df(p,y)*h2
- -1
- vec(z) := df(p,z)*h3
- div a;
- -1 -1 -1 -1 -1
- df(ax,x)*h1 + df(ay,y)*h2 + df(az,z)*h3 + df(h1,y)*ay*h1 *h2
- -1 -1 -1 -1 -1 -1
- + df(h1,z)*az*h1 *h3 + df(h2,x)*ax*h1 *h2 + df(h2,z)*az*h2 *h3
- -1 -1 -1 -1
- + df(h3,x)*ax*h1 *h3 + df(h3,y)*ay*h2 *h3
- curl a;
- -1 -1 -1 -1
- vec(x) := - df(ay,z)*h3 + df(az,y)*h2 - df(h2,z)*ay*h2 *h3
- -1 -1
- + df(h3,y)*az*h2 *h3
- -1 -1 -1 -1
- vec(y) := df(ax,z)*h3 - df(az,x)*h1 + df(h1,z)*ax*h1 *h3
- -1 -1
- - df(h3,x)*az*h1 *h3
- -1 -1 -1 -1
- vec(z) := - df(ax,y)*h2 + df(ay,x)*h1 - df(h1,y)*ax*h1 *h2
- -1 -1
- + df(h2,x)*ay*h1 *h2
- dp1 := delsq p;
- -3 -1 -2
- dp1 := - df(h1,x)*df(p,x)*h1 + df(h1,y)*df(p,y)*h1 *h2
- -1 -2 -2 -1
- + df(h1,z)*df(p,z)*h1 *h3 + df(h2,x)*df(p,x)*h1 *h2
- -3 -1 -2
- - df(h2,y)*df(p,y)*h2 + df(h2,z)*df(p,z)*h2 *h3
- -2 -1 -2 -1
- + df(h3,x)*df(p,x)*h1 *h3 + df(h3,y)*df(p,y)*h2 *h3
- -3 -2 -2
- - df(h3,z)*df(p,z)*h3 + df(p,x,2)*h1 + df(p,y,2)*h2
- -2
- + df(p,z,2)*h3
- dp2 := div grad p;
- -3 -1 -2
- dp2 := - df(h1,x)*df(p,x)*h1 + df(h1,y)*df(p,y)*h1 *h2
- -1 -2 -2 -1
- + df(h1,z)*df(p,z)*h1 *h3 + df(h2,x)*df(p,x)*h1 *h2
- -3 -1 -2
- - df(h2,y)*df(p,y)*h2 + df(h2,z)*df(p,z)*h2 *h3
- -2 -1 -2 -1
- + df(h3,x)*df(p,x)*h1 *h3 + df(h3,y)*df(p,y)*h2 *h3
- -3 -2 -2
- - df(h3,z)*df(p,z)*h3 + df(p,x,2)*h1 + df(p,y,2)*h2
- -2
- + df(p,z,2)*h3
- dp1-dp2;
- 0
- delsq a;
- -2 -3
- vec(x) := df(ax,x,2)*h1 - df(ax,x)*df(h1,x)*h1
- -2 -1 -2 -1
- + df(ax,x)*df(h2,x)*h1 *h2 + df(ax,x)*df(h3,x)*h1 *h3
- -2 -1 -2
- + df(ax,y,2)*h2 + df(ax,y)*df(h1,y)*h1 *h2
- -3 -2 -1
- - df(ax,y)*df(h2,y)*h2 + df(ax,y)*df(h3,y)*h2 *h3
- -2 -1 -2
- + df(ax,z,2)*h3 + df(ax,z)*df(h1,z)*h1 *h3
- -1 -2 -3
- + df(ax,z)*df(h2,z)*h2 *h3 - df(ax,z)*df(h3,z)*h3
- -2 -1
- + 2*df(ay,x)*df(h1,y)*h1 *h2
- -1 -2
- - 2*df(ay,y)*df(h2,x)*h1 *h2
- -2 -1
- + 2*df(az,x)*df(h1,z)*h1 *h3
- -1 -2 -2 -1
- - 2*df(az,z)*df(h3,x)*h1 *h3 + df(h1,x,y)*ay*h1 *h2
- -2 -1 -3 -1
- + df(h1,x,z)*az*h1 *h3 - df(h1,x)*df(h1,y)*ay*h1 *h2
- -3 -1
- - df(h1,x)*df(h1,z)*az*h1 *h3
- -3 -1
- - df(h1,x)*df(h2,x)*ax*h1 *h2
- -3 -1 -1 -2
- - df(h1,x)*df(h3,x)*ax*h1 *h3 + df(h1,y,2)*ax*h1 *h2
- 2 -2 -2 -1 -3
- - df(h1,y) *ax*h1 *h2 - df(h1,y)*df(h2,y)*ax*h1 *h2
- -1 -2 -1
- + df(h1,y)*df(h3,y)*ax*h1 *h2 *h3
- -1 -2 2 -2 -2
- + df(h1,z,2)*ax*h1 *h3 - df(h1,z) *ax*h1 *h3
- -1 -1 -2
- + df(h1,z)*df(h2,z)*ax*h1 *h2 *h3
- -1 -3 -1 -2
- - df(h1,z)*df(h3,z)*ax*h1 *h3 - df(h2,x,y)*ay*h1 *h2
- -1 -1 -1 -2 -1
- + df(h2,x,z)*az*h1 *h2 *h3 + df(h2,x,2)*ax*h1 *h2
- 2 -2 -2 -1 -3
- - df(h2,x) *ax*h1 *h2 + df(h2,x)*df(h2,y)*ay*h1 *h2
- -1 -2 -1
- - df(h2,x)*df(h2,z)*az*h1 *h2 *h3
- -1 -2 -1
- - 2*df(h2,x)*df(h3,y)*ay*h1 *h2 *h3
- -1 -1 -2
- - 2*df(h2,z)*df(h3,x)*az*h1 *h2 *h3
- -1 -1 -1 -1 -2
- + df(h3,x,y)*ay*h1 *h2 *h3 - df(h3,x,z)*az*h1 *h3
- -2 -1 2 -2 -2
- + df(h3,x,2)*ax*h1 *h3 - df(h3,x) *ax*h1 *h3
- -1 -1 -2
- - df(h3,x)*df(h3,y)*ay*h1 *h2 *h3
- -1 -3
- + df(h3,x)*df(h3,z)*az*h1 *h3
- -2 -1
- vec(y) := - 2*df(ax,x)*df(h1,y)*h1 *h2
- -1 -2 -2
- + 2*df(ax,y)*df(h2,x)*h1 *h2 + df(ay,x,2)*h1
- -3 -2 -1
- - df(ay,x)*df(h1,x)*h1 + df(ay,x)*df(h2,x)*h1 *h2
- -2 -1 -2
- + df(ay,x)*df(h3,x)*h1 *h3 + df(ay,y,2)*h2
- -1 -2 -3
- + df(ay,y)*df(h1,y)*h1 *h2 - df(ay,y)*df(h2,y)*h2
- -2 -1 -2
- + df(ay,y)*df(h3,y)*h2 *h3 + df(ay,z,2)*h3
- -1 -2 -1 -2
- + df(ay,z)*df(h1,z)*h1 *h3 + df(ay,z)*df(h2,z)*h2 *h3
- -3 -2 -1
- - df(ay,z)*df(h3,z)*h3 + 2*df(az,y)*df(h2,z)*h2 *h3
- -1 -2 -2 -1
- - 2*df(az,z)*df(h3,y)*h2 *h3 - df(h1,x,y)*ax*h1 *h2
- -3 -1
- + df(h1,x)*df(h1,y)*ax*h1 *h2
- -3 -1
- - df(h1,x)*df(h2,x)*ay*h1 *h2
- -1 -1 -1 -1 -2
- + df(h1,y,z)*az*h1 *h2 *h3 + df(h1,y,2)*ay*h1 *h2
- 2 -2 -2
- - df(h1,y) *ay*h1 *h2
- -2 -1 -1
- - df(h1,y)*df(h1,z)*az*h1 *h2 *h3
- -1 -3
- - df(h1,y)*df(h2,y)*ay*h1 *h2
- -2 -1 -1
- - 2*df(h1,y)*df(h3,x)*ax*h1 *h2 *h3
- -1 -1 -2
- + df(h1,z)*df(h2,z)*ay*h1 *h2 *h3
- -1 -1 -2
- - 2*df(h1,z)*df(h3,y)*az*h1 *h2 *h3
- -1 -2 -2 -1
- + df(h2,x,y)*ax*h1 *h2 + df(h2,x,2)*ay*h1 *h2
- 2 -2 -2 -1 -3
- - df(h2,x) *ay*h1 *h2 - df(h2,x)*df(h2,y)*ax*h1 *h2
- -2 -1 -1
- + df(h2,x)*df(h3,x)*ay*h1 *h2 *h3
- -2 -1 -3 -1
- + df(h2,y,z)*az*h2 *h3 - df(h2,y)*df(h2,z)*az*h2 *h3
- -3 -1 -1 -2
- - df(h2,y)*df(h3,y)*ay*h2 *h3 + df(h2,z,2)*ay*h2 *h3
- 2 -2 -2 -1 -3
- - df(h2,z) *ay*h2 *h3 - df(h2,z)*df(h3,z)*ay*h2 *h3
- -1 -1 -1
- + df(h3,x,y)*ax*h1 *h2 *h3
- -1 -1 -2
- - df(h3,x)*df(h3,y)*ax*h1 *h2 *h3
- -1 -2 -2 -1
- - df(h3,y,z)*az*h2 *h3 + df(h3,y,2)*ay*h2 *h3
- 2 -2 -2 -1 -3
- - df(h3,y) *ay*h2 *h3 + df(h3,y)*df(h3,z)*az*h2 *h3
- -2 -1
- vec(z) := - 2*df(ax,x)*df(h1,z)*h1 *h3
- -1 -2
- + 2*df(ax,z)*df(h3,x)*h1 *h3
- -2 -1
- - 2*df(ay,y)*df(h2,z)*h2 *h3
- -1 -2 -2
- + 2*df(ay,z)*df(h3,y)*h2 *h3 + df(az,x,2)*h1
- -3 -2 -1
- - df(az,x)*df(h1,x)*h1 + df(az,x)*df(h2,x)*h1 *h2
- -2 -1 -2
- + df(az,x)*df(h3,x)*h1 *h3 + df(az,y,2)*h2
- -1 -2 -3
- + df(az,y)*df(h1,y)*h1 *h2 - df(az,y)*df(h2,y)*h2
- -2 -1 -2
- + df(az,y)*df(h3,y)*h2 *h3 + df(az,z,2)*h3
- -1 -2 -1 -2
- + df(az,z)*df(h1,z)*h1 *h3 + df(az,z)*df(h2,z)*h2 *h3
- -3 -2 -1
- - df(az,z)*df(h3,z)*h3 - df(h1,x,z)*ax*h1 *h3
- -3 -1
- + df(h1,x)*df(h1,z)*ax*h1 *h3
- -3 -1
- - df(h1,x)*df(h3,x)*az*h1 *h3
- -1 -1 -1
- + df(h1,y,z)*ay*h1 *h2 *h3
- -2 -1 -1
- - df(h1,y)*df(h1,z)*ay*h1 *h2 *h3
- -1 -2 -1
- - 2*df(h1,y)*df(h2,z)*ay*h1 *h2 *h3
- -1 -2 -1
- + df(h1,y)*df(h3,y)*az*h1 *h2 *h3
- -1 -2 2 -2 -2
- + df(h1,z,2)*az*h1 *h3 - df(h1,z) *az*h1 *h3
- -2 -1 -1
- - 2*df(h1,z)*df(h2,x)*ax*h1 *h2 *h3
- -1 -3
- - df(h1,z)*df(h3,z)*az*h1 *h3
- -1 -1 -1
- + df(h2,x,z)*ax*h1 *h2 *h3
- -1 -2 -1
- - df(h2,x)*df(h2,z)*ax*h1 *h2 *h3
- -2 -1 -1
- + df(h2,x)*df(h3,x)*az*h1 *h2 *h3
- -2 -1 -3 -1
- - df(h2,y,z)*ay*h2 *h3 + df(h2,y)*df(h2,z)*ay*h2 *h3
- -3 -1 -1 -2
- - df(h2,y)*df(h3,y)*az*h2 *h3 + df(h2,z,2)*az*h2 *h3
- 2 -2 -2 -1 -3
- - df(h2,z) *az*h2 *h3 - df(h2,z)*df(h3,z)*az*h2 *h3
- -1 -2 -2 -1
- + df(h3,x,z)*ax*h1 *h3 + df(h3,x,2)*az*h1 *h3
- 2 -2 -2 -1 -3
- - df(h3,x) *az*h1 *h3 - df(h3,x)*df(h3,z)*ax*h1 *h3
- -1 -2 -2 -1
- + df(h3,y,z)*ay*h2 *h3 + df(h3,y,2)*az*h2 *h3
- 2 -2 -2 -1 -3
- - df(h3,y) *az*h2 *h3 - df(h3,y)*df(h3,z)*ay*h2 *h3
- curl grad p;
- vec(x) := 0
- vec(y) := 0
- vec(z) := 0
- grad div a;
- -2 -3
- vec(x) := df(ax,x,2)*h1 - df(ax,x)*df(h1,x)*h1
- -2 -1 -2 -1
- + df(ax,x)*df(h2,x)*h1 *h2 + df(ax,x)*df(h3,x)*h1 *h3
- -1 -1 -2 -1
- + df(ay,x,y)*h1 *h2 + df(ay,x)*df(h1,y)*h1 *h2
- -1 -1 -1
- + df(ay,x)*df(h3,y)*h1 *h2 *h3
- -1 -2 -1 -1
- - df(ay,y)*df(h2,x)*h1 *h2 + df(az,x,z)*h1 *h3
- -2 -1
- + df(az,x)*df(h1,z)*h1 *h3
- -1 -1 -1
- + df(az,x)*df(h2,z)*h1 *h2 *h3
- -1 -2 -2 -1
- - df(az,z)*df(h3,x)*h1 *h3 + df(h1,x,y)*ay*h1 *h2
- -2 -1 -3 -1
- + df(h1,x,z)*az*h1 *h3 - df(h1,x)*df(h1,y)*ay*h1 *h2
- -3 -1
- - df(h1,x)*df(h1,z)*az*h1 *h3
- -3 -1
- - df(h1,x)*df(h2,x)*ax*h1 *h2
- -3 -1
- - df(h1,x)*df(h3,x)*ax*h1 *h3
- -2 -2
- - df(h1,y)*df(h2,x)*ay*h1 *h2
- -2 -2
- - df(h1,z)*df(h3,x)*az*h1 *h3
- -1 -1 -1 -2 -1
- + df(h2,x,z)*az*h1 *h2 *h3 + df(h2,x,2)*ax*h1 *h2
- 2 -2 -2
- - df(h2,x) *ax*h1 *h2
- -1 -2 -1
- - df(h2,x)*df(h2,z)*az*h1 *h2 *h3
- -1 -2 -1
- - df(h2,x)*df(h3,y)*ay*h1 *h2 *h3
- -1 -1 -2
- - df(h2,z)*df(h3,x)*az*h1 *h2 *h3
- -1 -1 -1 -2 -1
- + df(h3,x,y)*ay*h1 *h2 *h3 + df(h3,x,2)*ax*h1 *h3
- 2 -2 -2
- - df(h3,x) *ax*h1 *h3
- -1 -1 -2
- - df(h3,x)*df(h3,y)*ay*h1 *h2 *h3
- -1 -1 -2 -1
- vec(y) := df(ax,x,y)*h1 *h2 - df(ax,x)*df(h1,y)*h1 *h2
- -1 -2
- + df(ax,y)*df(h2,x)*h1 *h2
- -1 -1 -1 -2
- + df(ax,y)*df(h3,x)*h1 *h2 *h3 + df(ay,y,2)*h2
- -1 -2 -3
- + df(ay,y)*df(h1,y)*h1 *h2 - df(ay,y)*df(h2,y)*h2
- -2 -1 -1 -1
- + df(ay,y)*df(h3,y)*h2 *h3 + df(az,y,z)*h2 *h3
- -1 -1 -1
- + df(az,y)*df(h1,z)*h1 *h2 *h3
- -2 -1 -1 -2
- + df(az,y)*df(h2,z)*h2 *h3 - df(az,z)*df(h3,y)*h2 *h3
- -1 -1 -1 -1 -2
- + df(h1,y,z)*az*h1 *h2 *h3 + df(h1,y,2)*ay*h1 *h2
- 2 -2 -2
- - df(h1,y) *ay*h1 *h2
- -2 -1 -1
- - df(h1,y)*df(h1,z)*az*h1 *h2 *h3
- -2 -2
- - df(h1,y)*df(h2,x)*ax*h1 *h2
- -1 -3
- - df(h1,y)*df(h2,y)*ay*h1 *h2
- -2 -1 -1
- - df(h1,y)*df(h3,x)*ax*h1 *h2 *h3
- -1 -1 -2
- - df(h1,z)*df(h3,y)*az*h1 *h2 *h3
- -1 -2 -1 -3
- + df(h2,x,y)*ax*h1 *h2 - df(h2,x)*df(h2,y)*ax*h1 *h2
- -2 -1 -3 -1
- + df(h2,y,z)*az*h2 *h3 - df(h2,y)*df(h2,z)*az*h2 *h3
- -3 -1
- - df(h2,y)*df(h3,y)*ay*h2 *h3
- -2 -2
- - df(h2,z)*df(h3,y)*az*h2 *h3
- -1 -1 -1
- + df(h3,x,y)*ax*h1 *h2 *h3
- -1 -1 -2
- - df(h3,x)*df(h3,y)*ax*h1 *h2 *h3
- -2 -1 2 -2 -2
- + df(h3,y,2)*ay*h2 *h3 - df(h3,y) *ay*h2 *h3
- -1 -1 -2 -1
- vec(z) := df(ax,x,z)*h1 *h3 - df(ax,x)*df(h1,z)*h1 *h3
- -1 -1 -1
- + df(ax,z)*df(h2,x)*h1 *h2 *h3
- -1 -2 -1 -1
- + df(ax,z)*df(h3,x)*h1 *h3 + df(ay,y,z)*h2 *h3
- -2 -1
- - df(ay,y)*df(h2,z)*h2 *h3
- -1 -1 -1
- + df(ay,z)*df(h1,y)*h1 *h2 *h3
- -1 -2 -2
- + df(ay,z)*df(h3,y)*h2 *h3 + df(az,z,2)*h3
- -1 -2 -1 -2
- + df(az,z)*df(h1,z)*h1 *h3 + df(az,z)*df(h2,z)*h2 *h3
- -3 -1 -1 -1
- - df(az,z)*df(h3,z)*h3 + df(h1,y,z)*ay*h1 *h2 *h3
- -2 -1 -1
- - df(h1,y)*df(h1,z)*ay*h1 *h2 *h3
- -1 -2 -1
- - df(h1,y)*df(h2,z)*ay*h1 *h2 *h3
- -1 -2 2 -2 -2
- + df(h1,z,2)*az*h1 *h3 - df(h1,z) *az*h1 *h3
- -2 -1 -1
- - df(h1,z)*df(h2,x)*ax*h1 *h2 *h3
- -2 -2
- - df(h1,z)*df(h3,x)*ax*h1 *h3
- -1 -3
- - df(h1,z)*df(h3,z)*az*h1 *h3
- -1 -1 -1
- + df(h2,x,z)*ax*h1 *h2 *h3
- -1 -2 -1
- - df(h2,x)*df(h2,z)*ax*h1 *h2 *h3
- -1 -2 2 -2 -2
- + df(h2,z,2)*az*h2 *h3 - df(h2,z) *az*h2 *h3
- -2 -2
- - df(h2,z)*df(h3,y)*ay*h2 *h3
- -1 -3 -1 -2
- - df(h2,z)*df(h3,z)*az*h2 *h3 + df(h3,x,z)*ax*h1 *h3
- -1 -3 -1 -2
- - df(h3,x)*df(h3,z)*ax*h1 *h3 + df(h3,y,z)*ay*h2 *h3
- -1 -3
- - df(h3,y)*df(h3,z)*ay*h2 *h3
- div curl a;
- 0
- % Examples of integration : (1) Volume integrals
- getcsystem 'spherical;
- (r theta phi)
- % Example 1 : integration of r**n over a sphere
- origin := avec(0,0,0);
- vec(r) := 0
- vec(theta) := 0
- vec(phi) := 0
- upperbound := avec(rr,pi,2*pi);
- vec(r) := rr
- vec(theta) := pi
- vec(phi) := 2*pi
- volintegral(r**n,origin,upperbound);
- n 3
- 4*rr *pi*rr
- --------------
- n + 3
- % Substitute n=0 to get the volume of a sphere
- sub(n=0,ws);
- 4 3
- ---*pi*rr
- 3
- % Example 2 : volume of a right-circular cone
- getcsystem 'cylindrical;
- (r z phi)
- upperbound := avec(pp*z,h,2*pi);
- vec(r) := pp*z
- vec(z) := h
- vec(phi) := 2*pi
- volintorder := avec(2,0,1);
- vec(r) := 2
- vec(z) := 0
- vec(phi) := 1
- % Integrate in the order : phi, r, z
- cone := volintegral(1,origin,upperbound);
- 1 3 2
- cone := ---*h *pi*pp
- 3
- % Now we replace P*Z by RR to get the result in the familiar form
- let pp*h=rr;
- cone := cone;
- 1 2
- cone := ---*h*pi*rr
- 3
- % This is the familiar form
- clear pp*h;
- % Example 3 : line integral to obtain the length of a line of latitude
- % on a sphere
- getcsystem 'spherical;
- (r theta phi)
- a := avec(0,0,1);
- vec(r) := 0
- vec(theta) := 0
- vec(phi) := 1
- % Function vector is the tangent to the
- % line of latitude
- curve := avec(rr,latitude,phi);
- vec(r) := rr
- vec(theta) := latitude
- vec(phi) := phi
- % Path is round a line of latitude
- deflineint(a,curve,phi,0,2*pi);
- 2*sin(latitude)*pi*rr
- end;
- Time for test: 60 ms, plus GC time: 10 ms
|