Dennis J. Darland Practice in Programming ASUS Development Computer - Ubuntu 14.04 Starting Mon May 21 20:51:15 CDT 2018 Finished Mon May 21 20:51:15 CDT 2018 Maxima 5.32.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) batch("pb02.max") read and interpret file: #p/home/dennis/physics/halliday.resnick/maxima/pb02.max (%i2) add(c,a,b):=(put(c,get(b,'x)+get(a,'x),'x), put(c,get(b,'y)+get(a,'y),'y),put(c,get(b,'z)+get(a,'z),'z)) (%o2) add(c, a, b) := (put(c, get(b, 'x) + get(a, 'x), 'x), put(c, get(b, 'y) + get(a, 'y), 'y), put(c, get(b, 'z) + get(a, 'z), 'z)) (%i3) subtract(c,a,b):=(put(c,get(a,'x)-get(b,'x),'x), put(c,get(a,'y)-get(b,'y),'y),put(c,get(a,'z)-get(b,'z),'z)) (%o3) subtract(c, a, b) := (put(c, get(a, 'x) - get(b, 'x), 'x), put(c, get(a, 'y) - get(b, 'y), 'y), put(c, get(a, 'z) - get(b, 'z), 'z)) (%i4) dot(a,b):=get(a,'z)*get(b,'z)+get(a,'y)*get(b,'y)+get(a,'x)*get(b,'x) (%o4) dot(a, b) := get(a, 'z) get(b, 'z) + get(a, 'y) get(b, 'y) + get(a, 'x) get(b, 'x) (%i5) magnitude(a):=sqrt(dot(a,a)) (%o5) magnitude(a) := sqrt(dot(a, a)) (%i6) direction_r(a):=atan2(get(a,'y),get(a,'x)) (%o6) direction_r(a) := atan2(get(a, 'y), get(a, 'x)) (%i7) direction_d(a):=atan2(get(a,'y),get(a,'x))*90.0/asin(1.0) atan2(get(a, 'y), get(a, 'x)) 90.0 (%o7) direction_d(a) := ---------------------------------- asin(1.0) (%i8) cross(c,a,b):=(put(c,get(a,'y)*get(b,'z)-get(b,'y)*get(a,'z),'x), put(c,-(get(a,'x)*get(b,'z)-get(b,'x)*get(a,'z)),'y), put(c,get(a,'x)*get(b,'y)-get(b,'x)*get(a,'y),'z)) (%o8) cross(c, a, b) := (put(c, get(a, 'y) get(b, 'z) - get(b, 'y) get(a, 'z), 'x), put(c, - (get(a, 'x) get(b, 'z) - get(b, 'x) get(a, 'z)), 'y), put(c, get(a, 'x) get(b, 'y) - get(b, 'x) get(a, 'y), 'z)) (%i9) print_vector(a):=print(a," = ",get(a,'x),"i + ",get(a,'y),"j + ", get(a,'z),"k") (%o9) print_vector(a) := print(a, " = ", get(a, 'x), "i + ", get(a, 'y), "j + ", get(a, 'z), "k") (%i10) main():=(put(a,4.0,'x),put(a,-3.0,'y),put(a,0.0,'z),put(b,6.0,'x), put(b,8.0,'y),put(b,0.0,'z),get(a,'x),get(a,'y),get(a,'z), get(b,'x),get(b,'y),get(b,'z),add(c,a,b),subtract(d,b,a), subtract(e,a,b),put(f,2.0,'x),put(f,-3.0,'y),put(f,7.0,'z), put(g,12.0,'x),put(g,45.0,'y),put(g,-8.0,'z),put(h,-5.0,'x), put(h,-3.0,'y),put(h,42.0,'z),print_vector(a),print_vector(b), print_vector(c),print_vector(d),print_vector(e),print_vector(f), print_vector(g),print_vector(h), print("magnitude of a = ",magnitude(a)), print("magnitude of b = ",magnitude(b)), print("magnitude of c = ",magnitude(c)), print("magnitude of d = ",magnitude(d)), print("magnitude of e = ",magnitude(e)), print("direction of a in radians = ",direction_r(a)), print("direction of b in radians = ",direction_r(b)), print("direction of c in radians = ",direction_r(c)), print("direction of d in radians = ",direction_r(d)), print("direction of e in radians = ",direction_r(e)), print("direction of a in degrees = ",direction_d(a)), print("direction of b in degrees = ",direction_d(b)), print("direction of c in degrees = ",direction_d(c)), print("direction of d in degrees = ",direction_d(d)), print("direction of e in degrees = ",direction_d(e)), print("a dot a = ",dot(a,a)),print("a dot b = ",dot(a,b)), print("b dot a = ",dot(b,a)),print("a dot c = ",dot(a,c)), print("d dot a = ",dot(d,a)),print("a dot e = ",dot(a,e)), print("e dot a = ",dot(e,a)),cross(aca,a,a),cross(acb,a,b), cross(bca,b,a),cross(acc,a,c),cross(dca,d,a),cross(ace,a,e), cross(eca,e,a),cross(fcg,f,g),cross(fch,f,h),cross(gch,g,h), cross(gcf,g,f),cross(hcf,h,f),cross(hcg,h,g),print_vector(aca), print_vector(acb),print_vector(bca),print_vector(acc), print_vector(dca),print_vector(ace),print_vector(eca), print_vector(fcg),print_vector(fch),print_vector(gch), print_vector(gcf),print_vector(hcf),print_vector(hcg)) (%o10) main() := (put(a, 4.0, 'x), put(a, - 3.0, 'y), put(a, 0.0, 'z), put(b, 6.0, 'x), put(b, 8.0, 'y), put(b, 0.0, 'z), get(a, 'x), get(a, 'y), get(a, 'z), get(b, 'x), get(b, 'y), get(b, 'z), add(c, a, b), subtract(d, b, a), subtract(e, a, b), put(f, 2.0, 'x), put(f, - 3.0, 'y), put(f, 7.0, 'z), put(g, 12.0, 'x), put(g, 45.0, 'y), put(g, - 8.0, 'z), put(h, - 5.0, 'x), put(h, - 3.0, 'y), put(h, 42.0, 'z), print_vector(a), print_vector(b), print_vector(c), print_vector(d), print_vector(e), print_vector(f), print_vector(g), print_vector(h), print("magnitude of a = ", magnitude(a)), print("magnitude of b = ", magnitude(b)), print("magnitude of c = ", magnitude(c)), print("magnitude of d = ", magnitude(d)), print("magnitude of e = ", magnitude(e)), print("direction of a in radians = ", direction_r(a)), print("direction of b in radians = ", direction_r(b)), print("direction of c in radians = ", direction_r(c)), print("direction of d in radians = ", direction_r(d)), print("direction of e in radians = ", direction_r(e)), print("direction of a in degrees = ", direction_d(a)), print("direction of b in degrees = ", direction_d(b)), print("direction of c in degrees = ", direction_d(c)), print("direction of d in degrees = ", direction_d(d)), print("direction of e in degrees = ", direction_d(e)), print("a dot a = ", dot(a, a)), print("a dot b = ", dot(a, b)), print("b dot a = ", dot(b, a)), print("a dot c = ", dot(a, c)), print("d dot a = ", dot(d, a)), print("a dot e = ", dot(a, e)), print("e dot a = ", dot(e, a)), cross(aca, a, a), cross(acb, a, b), cross(bca, b, a), cross(acc, a, c), cross(dca, d, a), cross(ace, a, e), cross(eca, e, a), cross(fcg, f, g), cross(fch, f, h), cross(gch, g, h), cross(gcf, g, f), cross(hcf, h, f), cross(hcg, h, g), print_vector(aca), print_vector(acb), print_vector(bca), print_vector(acc), print_vector(dca), print_vector(ace), print_vector(eca), print_vector(fcg), print_vector(fch), print_vector(gch), print_vector(gcf), print_vector(hcf), print_vector(hcg)) (%i11) main() a = 4.0 i + - 3.0 j + 0.0 k b = 6.0 i + 8.0 j + 0.0 k c = 10.0 i + 5.0 j + 0.0 k d = 2.0 i + 11.0 j + 0.0 k e = - 2.0 i + - 11.0 j + 0.0 k f = 2.0 i + - 3.0 j + 7.0 k g = 12.0 i + 45.0 j + - 8.0 k h = - 5.0 i + - 3.0 j + 42.0 k magnitude of a = 5.0 magnitude of b = 10.0 magnitude of c = 11.18033988749894 magnitude of d = 11.18033988749894 magnitude of e = 11.18033988749894 direction of a in radians = - 0.64350110879328 direction of b in radians = 0.92729521800161 direction of c in radians = 0.4636476090008 direction of d in radians = 1.390942827002418 direction of e in radians = - 1.750649826587374 direction of a in degrees = - 36.86989764584402 direction of b in degrees = 53.13010235415598 direction of c in degrees = 26.56505117707799 direction of d in degrees = 79.69515353123397 direction of e in degrees = - 100.304846468766 a dot a = 25.0 a dot b = 0.0 b dot a = 0.0 a dot c = 25.0 d dot a = - 25.0 a dot e = 25.0 e dot a = 25.0 aca = 0.0 i + -0.0 j + 0.0 k acb = 0.0 i + -0.0 j + 50.0 k bca = 0.0 i + -0.0 j + - 50.0 k acc = 0.0 i + -0.0 j + 50.0 k dca = 0.0 i + -0.0 j + - 50.0 k ace = 0.0 i + -0.0 j + - 50.0 k eca = 0.0 i + -0.0 j + 50.0 k fcg = - 291.0 i + 100.0 j + 126.0 k fch = - 105.0 i + - 119.0 j + - 21.0 k gch = 1866.0 i + - 464.0 j + 189.0 k gcf = 291.0 i + - 100.0 j + - 126.0 k hcf = 105.0 i + 119.0 j + 21.0 k hcg = - 1866.0 i + 464.0 j + - 189.0 k (%o11) k (%o11) pb02.max