Mon Mar 9 16:44:56 MST 1998 aquarius% reduce REDUCE 3.6, 15-Jul-95, patched to 15 Apr 96 ... 1: % ----------[ R e d u c e ]---------- % ---------- Initialization ---------- on time; Time: 0 ms % ---------- Vector Analysis ---------- load_package(avector)$ *** ^ redefined Time: 0 ms %load_package(orthovec)$ % Vector norm => sqrt(15) vmod avec(1 + i, -2, 3*i); sqrt(2*i - 5) Time: 10 ms %vmod svec(1 + i, -2, 3*i); % Cross product: (2, 2, -3) x (1, 3, 1) => (11, -5, 4) avec(2, 2, -3) cross avec(1, 3, 1); vec(x) := 11 vec(y) := -5 vec(z) := 4 Time: 0 ms %svec(2, 2, -3) >< svec(1, 3, 1); % (a x b) . (c x d) => (a . c) (b . d) - (a . d) (b . c) vec a, b, c, d, f, g; Time: 0 ms (a cross b) dot (c cross d); 0 Time: 0 ms %(a >< b) * (c >< d); % => (2 y z^3 - 2 x^2 y^2 z, x y, 2 x y^2 z^2 - x z) %curl avec(x*y*z, x^2*y^2*z^2, y^2*z^3); curl avec(x*y*z, x**2*y**2*z**2, y**2*z**3); 2 2 vec(x) := 2*y*z*( - x *y + z ) vec(y) := x*y 2 vec(z) := x*z*(2*y *z - 1) Time: 0 ms %curl svec(x*y*z, x**2*y**2*z**2, y**2*z**3); % DEL . (f x g) => g . (DEL x f) - f . (DEL x g) div (f cross g); 0 Time: 10 ms %div (f >< g); clear a, b, c, d, f, g; Time: 0 ms % Express DEL . a in spherical coordinates (r, theta, phi) for % a = (a_r(r, theta, phi), a_theta(r, theta, phi), a_phi(r, theta, phi)). % Here, phi is in the x-y plane and theta is the angle with the z-axis. % => 1/r^2 d/dr[r^2 a_r] + 1/[r sin(theta)] d/dtheta[sin(theta) a_theta] % + 1/[r sin(theta)] da_phi/dphi % => da_r/dr + (2 a_r)/r + 1/r da_theta/dtheta + a_theta/[r tan(theta)] % + 1/[r sin(theta)] da_phi/dphi % See Keith R. Symon, _Mechanics_, Third Edition, Addison-Wesley Publishing % Company, 1971, p. 103. getcsystem 'spherical; (r theta phi) Time: 0 ms operator a_r, a_theta, a_phi; Time: 0 ms div avec(a_r(r, theta, phi), a_theta(r, theta, phi), a_phi(r, theta, phi)); (2*a_r(r,theta,phi)*sin(theta) + a_theta(r,theta,phi)*cos(theta) + df(a_phi(r,theta,phi),phi) + df(a_r(r,theta,phi),r)*sin(theta)*r + df(a_theta(r,theta,phi),theta)*sin(theta))/(sin(theta)*r) Time: 10 ms on div; Time: 0 ms ws; -1 -1 -1 2*a_r(r,theta,phi)*r + a_theta(r,theta,phi)*cos(theta)*sin(theta) *r -1 -1 + df(a_phi(r,theta,phi),phi)*sin(theta) *r + df(a_r(r,theta,phi),r) -1 + df(a_theta(r,theta,phi),theta)*r Time: 0 ms off div; Time: 0 ms % Express dR/dt in spherical coordinates (r, theta, phi) where R is the % position vector r*Rhat(theta, phi) with Rhat being the unit vector in the % direction of R => (dr/dt, r dtheta/dt, r sin(theta) dphi/dt) % [Symon, p. 98] operator r, theta, phi, rhat; Time: 0 ms df(avec(r(t)*rhat(theta(t), phi(t)), 0, 0), t); vec(r) := df(r(t),t)*rhat(theta(t),phi(t)) + df(rhat(theta(t),phi(t)),t)*r(t) vec(theta) := 0 vec(phi) := 0 Time: 0 ms % Scalar potential => x^2 y + y + 2 z^3 %potential(avec(2*x*y, x^2 + 1, 6*z^2)); % Vector potential => (x y z, x^2 y^2 z^2, y^2 z^3) is one possible solution. % See Harry F. Davis and Arthur David Snider, _Introduction to Vector % Analysis_, Third Edition, Allyn and Bacon, Inc., 1975, p. 97. %vectorpotential(avec(2*y*z^3 - 2*x^2*y^2*z, x*y, 2*x*y^2*z^2 - x*z)); %curl(ws); % Orthogonalize the following vectors (Gram-Schmidt). See Lee W. Johnson and % R. Dean Riess, _Introduction to Linear Algebra_, Addison-Wesley Publishing % Company, 1981, p. 104 => [[0 1 2 1], [0 -1 1 -1], [2 1 0 -1]]^T load_package(linalg)$ Time: 120 ms {{0, 1, 2, 1}, {0, 1, 3, 1}, {1, 1, 1, 0}, {1, 3, 6, 2}}; {{0,1,2,1},{0,1,3,1},{1,1,1,0},{1,3,6,2}} Time: 0 ms gram_schmidt(ws); 1 2 1 {{0,---------,---------,---------}, sqrt(6) sqrt(6) sqrt(6) - sqrt(3) sqrt(3) - sqrt(3) {0,------------,---------,------------}, 3 3 3 sqrt(2) sqrt(2) - sqrt(2) {---------,-----------,0,------------}} sqrt(3) 2*sqrt(3) 2*sqrt(3) Time: 10 ms % ---------- Quit ---------- quit; Quitting real 7.70 user 0.23 sys 1.03