Fix some issues with make dist-gzip
[maxima.git] / share / vector / rtest_vector_rebuild.mac
blob040a92f7737dac6266aba3c9ca7ccc6b741b6b3f
1 (kill(all), 'done);
2 'done$
4 (load("vector_rebuild"), 'done);
5 'done;
7 [1,2]+t*[3,4], vector_simp;
8 [3*t+1,4*t+2]$
10 vector_rebuild([3*t+1,4*t+2], [t]);
11 t*[3,4]+[1,2]$
13 vector_rebuild([1,2]+t*[3,4]+[5,6]+(t/2-1)*[7,8], [t]);
14 t*[13/2,8]+[-1,0]$
16 covect([1/2,1/3,1/4]), vector_factor;
17 (1/12)*matrix([6],[4],[3])$
20 `vector_factor' returns
21 ((MTIMES SIMP) -1 ((MTIMESQ SIMP) 2 ((MLIST SIMP) 1 2))) */
22 block([vector_factor_minus:true],
23   args(vector_factor([-2,-4])));
24 [2*[1, 2]]$
26 extract_equations([1,2]+t*[3,4] = [4,3]+s*[2,1]);
27 [3*t+1 = 2*s+4,4*t+2 = s+3]$
29 [1,0,0]~[0,1,0];
30 [0,0,1]$
32 block([v: covect([1,2])], 1/|v|*v);
33 (1/sqrt(5))*matrix([1],[2])$
35 (v([args]):= covect(args), 'done);
36 done$
38 block([plane1, plane2, veq, sys, so, params],
39   plane1: v(1,2,3)+p*v(4,5,6)+q*v(7,8,9),
40   plane2: v(3,2,1)+r*v(6,5,4)+s*v(9,8,7),
41   veq: plane1 = plane2,
42   sys: extract_equations(veq),
43   so: algsys(sys,[p,q,r,s]),
44   params: subst([%rnum_list[1]=u, %rnum_list[2]=v], so),
45   vector_rebuild(subst(params, plane2), [u, v]));
46 v*matrix([7],[8],[9])+u*matrix([4],[5],[6])+matrix([1],[2],[3])$
48 block([n, a, plane],
49   n: [1,2,3], a: [2,0,1],
50   plane: x.n = a.n,
51   plane: vector_simp(plane),
52   plane: subst(x=[x1,x2,x3], plane),
53   vector_simp(plane));
54 3*x3+2*x2+x1 = 5$
56 block([n],
57   n: v(1,2,3),
58   1/|n|*n);
59 (1/sqrt(14))*matrix([1],[2],[3])$
61 block([n, a, plane],
62   n: v(1,2,3),
63   a: v(2,0,1),
64   plane: x.n = a.n,
65   vector_simp(plane));
66 x . matrix([1],[2],[3]) = 5$
68 block([point, a, n, en],
69   point: v(0,1,2),
70     a: v(2,0,1),
71     n: v(1,2,3),
72     en: 1/|n|*n,
73     |(point-a)*en|);
74   sqrt(17)/sqrt(14)$
76 block([a, n, en],
77   a: v(2,0,1),
78   n: v(1,2,3),
79   en: 1/|n|*n,
80   [vector_simp(a+t*en), vector_factor(vector_rebuild(a+t*en, [t]))]);
81 [matrix([t/sqrt(14)+2],[(2*t)/sqrt(14)],[(3*t)/sqrt(14)+1]),
82 (t/sqrt(14))*matrix([1],[2],[3])+matrix([2],[0],[1])]$
84 args(vector_factor(v(-2,-4)));
85 [2,matrix([-1],[-2])]$
87 block([vector_factor_minus:true], args(vector_factor(v(-2,-4))));
88 [2*matrix([1],[2])]$
90 block([vector_factor: true, M, M_1],
91   M: matrix([1,2],[3,-1]),
92   M_1: M^^-1,
93   vector_simp(M.M_1));
94 matrix([1,0],[0,1])$
96 (kill(v), reset(listarith,doallmxops,domxmxops,dotexptsimp), 'done);
97 'done$