File: rtest_vector_rebuild.mac

package info (click to toggle)
maxima 5.49.0-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 128,980 kB
  • sloc: lisp: 437,854; fortran: 14,665; tcl: 10,143; sh: 4,598; makefile: 2,204; ansic: 447; java: 374; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (97 lines) | stat: -rw-r--r-- 2,179 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
(kill(all), 'done);
'done$

(load("vector_rebuild"), 'done);
'done;

[1,2]+t*[3,4], vector_simp;
[3*t+1,4*t+2]$

vector_rebuild([3*t+1,4*t+2], [t]);
t*[3,4]+[1,2]$

vector_rebuild([1,2]+t*[3,4]+[5,6]+(t/2-1)*[7,8], [t]);
t*[13/2,8]+[-1,0]$

covect([1/2,1/3,1/4]), vector_factor;
(1/12)*matrix([6],[4],[3])$

/*
`vector_factor' returns
((MTIMES SIMP) -1 ((MTIMESQ SIMP) 2 ((MLIST SIMP) 1 2))) */
block([vector_factor_minus:true],
  args(vector_factor([-2,-4])));
[2*[1, 2]]$

extract_equations([1,2]+t*[3,4] = [4,3]+s*[2,1]);
[3*t+1 = 2*s+4,4*t+2 = s+3]$

[1,0,0]~[0,1,0];
[0,0,1]$

block([v: covect([1,2])], 1/|v|*v);
(1/sqrt(5))*matrix([1],[2])$

(v([args]):= covect(args), 'done);
done$

block([plane1, plane2, veq, sys, so, params],
  plane1: v(1,2,3)+p*v(4,5,6)+q*v(7,8,9),
  plane2: v(3,2,1)+r*v(6,5,4)+s*v(9,8,7),
  veq: plane1 = plane2,
  sys: extract_equations(veq),
  so: algsys(sys,[p,q,r,s]),
  params: subst([%rnum_list[1]=u, %rnum_list[2]=v], so),
  vector_rebuild(subst(params, plane2), [u, v]));
v*matrix([7],[8],[9])+u*matrix([4],[5],[6])+matrix([1],[2],[3])$

block([n, a, plane],
  n: [1,2,3], a: [2,0,1],
  plane: x.n = a.n,
  plane: vector_simp(plane),
  plane: subst(x=[x1,x2,x3], plane),
  vector_simp(plane));
3*x3+2*x2+x1 = 5$

block([n],
  n: v(1,2,3),
  1/|n|*n);
(1/sqrt(14))*matrix([1],[2],[3])$

block([n, a, plane],
  n: v(1,2,3),
  a: v(2,0,1),
  plane: x.n = a.n,
  vector_simp(plane));
x . matrix([1],[2],[3]) = 5$

block([point, a, n, en],
  point: v(0,1,2),
    a: v(2,0,1),
    n: v(1,2,3),
    en: 1/|n|*n,
    |(point-a)*en|);
  sqrt(17)/sqrt(14)$

block([a, n, en],
  a: v(2,0,1),
  n: v(1,2,3),
  en: 1/|n|*n,
  [vector_simp(a+t*en), vector_factor(vector_rebuild(a+t*en, [t]))]);
[matrix([t/sqrt(14)+2],[(2*t)/sqrt(14)],[(3*t)/sqrt(14)+1]),
(t/sqrt(14))*matrix([1],[2],[3])+matrix([2],[0],[1])]$

args(vector_factor(v(-2,-4)));
[2,matrix([-1],[-2])]$

block([vector_factor_minus:true], args(vector_factor(v(-2,-4))));
[2*matrix([1],[2])]$

block([vector_factor: true, M, M_1],
  M: matrix([1,2],[3,-1]),
  M_1: M^^-1,
  vector_simp(M.M_1));
matrix([1,0],[0,1])$

(kill(v), reset(listarith,doallmxops,domxmxops,dotexptsimp), 'done);
'done$