1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
/* written by Gosei Furuya <go.maxima@gmail.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
*/
add_tan(_m):=block([_u:[]],_u:cross(col(_m,1),col(_m,2)),addcol(_m,_u))$
cross(_a,_b):=block([_u1,_v1],_u1:makelist(_a[j,1],j,1,3),_v1:makelist(_b[j,1],j,1,3),[_u1[2]*_v1[3]-_u1[3]*_v1[2],_u1[3]*_v1[1]-_u1[1]*_v1[3],_u1[1]*_v1[2]-_u1[2]*_v1[1]])$
matrix_element_mult:lambda([x,y],x@y)$
cross2(_u1,_v1):=block([_s],_s:[_u1[2]*_v1[3]-_u1[3]*_v1[2],_u1[3]*_v1[1]-_u1[1]*_v1[3],_u1[1]*_v1[2]-_u1[2]*_v1[1]])$
make_tan():=block([_l:[],_l1,_l2,_l3,_l4,_ll,_p,_p4,_m],
_l:map(lambda([x],diff(x,coords[1])),translist),
_l1:map(lambda([x],x^2),_l),
_p:ratsimp(trigsimp(apply("+",_l1))),
_m:matrix(1/sqrt(_p)*_l),
_ll:map(lambda([x],diff(x,coords[2])),translist),
_l3:cross2(_l,_ll),
_l4:map(lambda([x],x^2),_l3),
_p4:ratsimp(trigsimp(apply("+",_l4))),
_l2:cross2(1/sqrt(_p4)*_l3,1/sqrt(_p)*_l),
addrow(_m,_l2,1/sqrt(_p4)*_l3))$
|