File: curvture2.mac

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (23 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (15)
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))$