In itensor, ensure that tentex does not reorder indices.
[maxima.git] / share / diff_form / example.txt
blob23e87004f5cc732a7e576c4100488e7307603b40
1 A. Vector analysys I 
3 A1.vector to form
4 in this package, a vector shoud be transformed to a form.
5 for example,[a,b,c]<---->a*Dx+b*Dy+c*Dz (so called work form)
6 [a,b,c]<---->a*Dy@Dz+b*Dz@Dx+c*Dx@Dy (so called fluid form)
7 vtof1,vtof2 need the scale_factor,so not to use f_star(),to use fstar_with_clf()
8 or under global environment ( see lorentz_example.txt)
9  
10 (%i17) fstar_with_clf([x,y,z],[x,y,z],vtof1([a,b,c]));
11 (%o17)                        c Dz + b Dy + a Dx
12 (%i18) fstar_with_clf([x,y,z],[x,y,z],vtof2([a,b,c]));
13 (%o18)                    a Dy Dz - b Dx Dz + c Dx Dy
14 (%i19) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
15 vtof1([a,b,c]));
16 (%o19)                b Dth sin(phi) r + c Dphi r + a Dr
17 (%i20) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
18 vtof2([a,b,c]));
19                                  2                       b Dphi Dr
20 (%o20)      a Dphi Dth sin(phi) r  + c Dr Dth sin(phi) - ---------
21                                                          sin(phi)
22 (%i21) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
23 scale_factor);
24 (%o21)                        [1, sin(phi) r, r]
26 A2. grad,rot or curle,div,laplacian
27 grad(f) is d(f),if A is vector,a:vtof1(A) then rot(A) is h_st(d(a)),or nest2([h_st,d],a)
28 h_st() is hodge star operator,div(f) is h_st(d(h_st(f))),laplacian(f) is d(h_st(d(f)))
29 or-1(d(antid(a))+antid(d(a)))s ok generally
31 1.gradiant
32 (%i22) fstar_with_clf([x,y,z],[x,y,z],(depends(f,[x,y,z]),d(f)));
33                                 df      df      df
34 (%o22)                       Dz -- + Dy -- + Dx --
35                                 dz      dy      dx
36 (%i23) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)]
37 ,(depends(f,[r,th,phi]),d(f)));
38                               df       df         df
39 (%o23)                    Dth --- + Dr -- + Dphi ----
40                               dth      dr        dphi 
42 2.rotate
43 (%i24) fstar_with_clf([x,y,z],[x,y,z],(depends([a,b,c],[x,y,z]),aa:vtof1([a,b,c]),
44 h_st(d(aa))));
45                  db      da      dc      da      dc      db
46 (%o24)           -- Dz - -- Dz - -- Dy + -- Dy + -- Dx - -- Dx
47                  dx      dy      dx      dz      dy      dz
48 (%i25) format(%,%poly(Dx,Dy,Dz),factor);
49                    db   da        dc   da        dc   db
50 (%o25)            (-- - --) Dz - (-- - --) Dy + (-- - --) Dx
51                    dx   dy        dx   dz        dy   dz
52 (%i29) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
53 (depends([a,b,c],[r,th,phi]),aa:vtof1([a,b,c]),h_st(d(aa))))$
55 (%i30) format(%,%poly(Dr,Dth,Dphi),factor);
56              db                           da
57        Dphi (-- sin(phi) r + b sin(phi) - ---)
58              dr                           dth                  dc          da
59 (%o30) --------------------------------------- - Dth sin(phi) (-- r + c - ----)
60                       sin(phi)                                 dr         dphi
61                                                db                          dc
62                                           Dr (---- sin(phi) + b cos(phi) - ---)
63                                               dphi                         dth
64                                         - -------------------------------------
65                                                        sin(phi) r
67 3.divergent
68 (%i31) fstar_with_clf([x,y,z],[x,y,z],(depends([a,b,c],[x,y,z]),aa:vtof1([a,b,c]),
69 nest2([d,h_st],aa)));
70                     dc            db            da
71 (%o31)              -- Dx Dy Dz + -- Dx Dy Dz + -- Dx Dy Dz
72                     dz            dy            dx
73 (%i32) fstar_with_clf([x,y,z],[x,y,z],(depends([a,b,c],[x,y,z]),aa:vtof1([a,b,c]),
74 nest2([h_st,d,h_st],aa)));
75                                  dc   db   da
76 (%o32)                           -- + -- + --
77                                  dz   dy   dx
79 (%i33) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
80 (depends([a,b,c],[r,th,phi]),aa:vtof1([a,b,c]),nest2([h_st,d,h_st],aa)));
81                                    db         dc
82                                    ---       ----
83                    c cos(phi)      dth       dphi   2 a   da
84 (%o33)             ---------- + ---------- + ---- + --- + --
85                    sin(phi) r   sin(phi) r    r      r    dr
87 4.laplacian
88 (%i34) fstar_with_clf([x,y,z],[x,y,z],(depends(f,[x,y,z]),nest2([d,h_st,d],f)));
89                             2              2              2
90                            d f            d f            d f
91 (%o34)            Dx Dy Dz --- + Dx Dy Dz --- + Dx Dy Dz ---
92                              2              2              2
93                            dz             dy             dx
94 (%i36) fstar_with_clf([x,y,z],[x,y,z],(depends(f,[x,y,z]),nest2([h_st,d,h_st,d],f)));
95                                  2     2     2
96                                 d f   d f   d f
97 (%o36)                          --- + --- + ---
98                                   2     2     2
99                                 dz    dy    dx
100 (%i37) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
101 (depends(f,[r,th,phi]),nest2([h_st,d,h_st,d],f)));
102                                            2           2
103                                           d f         d f
104                  df    df                 ----       -----
105                2 --   ---- cos(phi)          2           2    2
106                  dr   dphi                dth        dphi    d f
107 (%o37)         ---- + ------------- + ------------ + ----- + ---
108                 r                2       2       2     2       2
109                        sin(phi) r     sin (phi) r     r      dr
110 (%i38) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)],
111 (depends(f,[r,th,phi]),nest2([d,h_st,d],f)));
112                     2
113                    d f           2                 df
114 (%o38) Dphi Dr Dth --- sin(phi) r  + 2 Dphi Dr Dth -- sin(phi) r
115                      2                             dr
116                    dr
117                                                 2
118                                                d f
119                                    Dphi Dr Dth ----
120                     2                             2
121                    d f                         dth                 df
122     + Dphi Dr Dth ----- sin(phi) + ---------------- + Dphi Dr Dth ---- cos(phi)
123                       2                sin(phi)                   dphi
125 A3. Example for vorticity
126 problem: in R3 we think velocity field v=rot(A),div(A)=0,so A is vector potential.
127 prove voricity w=rot(v) satisfy ¦¤A= -w
128 a solution: as restricted 2 spaces,A can be posed,a1*Dx+a2*Dy.
129 w=rot(rot(A)),then
130 (%i40) fstar_with_clf([x,y,z],[x,y,z],(depends([a1,a2],[x,y]),A:a1*Dx+a2*Dy,
131 nest2([h_st,d,h_st,d],A)));
132                       2         2          2          2
133                      d a2      d a1       d a2       d a1
134 (%o40)             - ---- Dy + ----- Dy + ----- Dx - ---- Dx
135                        2       dx dy      dx dy        2
136                      dx                              dy
138 from condition ,div(A)=0
139 (%i41) fstar_with_clf([x,y,z],[x,y,z],(depends([a1,a2],[x,y]),A:a1*Dx+a2*Dy,d(h_st(A))));
140                           da2            da1
141 (%o78)                    --- Dx Dy Dz + --- Dx Dy Dz
142                            dy             dx
143 d(a2)/dy+d(a1)/dx=0 ,then d^2(a1)/dxdy= -d^2(a2)/dx^2,d^2(a2)/dxdy=-d^2(a1)/dy^2
145 ¦¤A is -(d(antid(A))+antid(d(A))
146 (%i42) fstar_with_clf([x,y,z],[x,y,z],(depends([a1,a2],[x,y]),A:a1*Dx+a2*Dy,-(nest2([d,antid],A)+nest2([antid,d],A))));
147                       2         2         2         2
148                      d a2      d a2      d a1      d a1
149 (%o42)               ---- Dy + ---- Dy + ---- Dx + ---- Dx
150                        2         2         2         2
151                      dy        dx        dy        dx
152 then 
153 ¦¤A= -w 
154 but in this case,old fashion style is good with ¦¤A=grad(div(A)-rot(rot(A))
156 B.Changing integral variable more than two variables
158 B1.this is from ¦£(z)*¦£(1-z)
159 changing integral variable more than two variables,such like
160 (%i55) f_star([u,v],(s:u/(v+1),t:u*v/(v+1),exp(-(s+t))*s^(-z)*t^(z-1)*d(s)@d(t)))$
161 (%i57) format(%o55,%poly(u,v),factor);
162                                           u v      u
163                                        - ----- - -----
164                                z - 1     v + 1   v + 1
165                         Du Dv v      %e
166 (%o57)                  ------------------------------
167                                     v + 1
168 this integral,v,[0,inf],u,[0,inf] is %pi/sin(%pi) (=beta(z,1-z))
170 B2. from entrance exam. of graduate course in japan
171 (1)integrate x+y+z=u,y+z=u*v,z=u*v*w,on 0<u<1,0<v<1,0<w<1 by pullback (x^2+y^2+z^2)dxdydz
173 (%i43) solve([x+y+z=u,y+z=u*v,z=u*v*w],[x,y,z]);
174 (%o43)           [[x = u (1 - v), y = u v (1 - w), z = u v w]]
175 (%i45) f_star([u,v,w],(x:u*(1-v),y:u*v*(1-w),z:u*v*w,(x^2+y^2+z^2)*d(x)@d(y)@d(z)));
176                       2     2  2  2    2  2        2    2        2
177 (%o45)      Du Dv Dw u  v (u  v  w  + u  v  (1 - w)  + u  (1 - v) )
178         
179 (%i46) defint(defint(defint(u^2*v*(u^2*v^2*w^2+u^2*v^2*(1-w)^2+u^2*(1-v)^2),w,0,1)
180 ,v,0,1),u,0,1);
181 (%o46) 1/20
182 (%o47) kill(x,y,z);
184 slightly easy problem
185 (2) (d^2/dx^2+d^2/dy^2)(log(sqrt(x^2+y^2)))
187 (%i38) fstar_with_clf([x,y],[x,y],(d(h_st(d(log(sqrt(x^2+y^2)))))))$
188 (%i39) format(%,%poly(Dx,Dy),factor);
189 (%o39)                                 0
191 (3) Integrate (x*Dx@Dy) on x^2/a^2+y^2/b^2<=1,x>=0,y>=0
193 (%i40) fstar_with_clf([x,y],[x,y],(depends([a1,a2],[x,y]),d(a1*d(x)+a2*d(y))));
194                              da2         da1
195 (%o40)                       --- Dx Dy - --- Dx Dy
196                               dx          dy
197 (%i41) fstar_with_clf([x,y],[x,y],(d(1/2*x^2*Dy)));
198 (%o41)                             Dx Dy x
199 1/2*x^2*Dy x=a*cos(th),y=b*sin(th)  on boundary you may use line integrate.
201 B3. Integral
203 we must pay attention to effects of some singularity and of topology (De Rham cohomology )
204 this points is most difficult to calculate multivariable integral in CAS,I think.
205 see Frankel book "The Geometry of PHYSICS" p162 5.5 Finding Potential.
207 (Pontrjaguin index)
208 (%i74) f_star([phi,theta],(pu1:sin(phi)*cos(theta),pu2:sin(phi)*sin(theta),pu3:cos(phi),
209     pu1*d(pu2)@d(pu3)+pu2*d(pu3)@d(pu1)+pu3*d(pu1)@d(pu2)))$
210 (%i76) trigsimp(%o74);
211 (%o76)                       Dphi Dtheta sin(phi)
212 So this map induce (x,y)-->(pu1,pu2,pu3)  IxI--->S2,boundary 1X1 -->one point.
213 %o76 is volume form  in S2,if we can pull back IxI,we integrate this and say
214 this integral value is n*4pai. n is a integer.
215 (%i79) f_star([x,y],(depends([p1,p2,p3],[x,y]),p1*d(p2)@d(p3)+p2*d(p3)@d(p1)+p3*d(p1)@d(p2)));
217                 dp2 dp3         dp2 dp3              dp1 dp3         dp1 dp3
218 (%o79) p1 (Dx Dy --- --- - Dx Dy --- ---) + p2 (Dx Dy --- --- - Dx Dy --- ---)
219                  dx  dy          dy  dx               dy  dx          dx  dy
220                                                     dp1 dp2         dp1 dp2
221                                            + (Dx Dy --- --- - Dx Dy --- ---) p3
222                                                     dx  dy          dx  dy
224 (%o79) is written by using vector,(p1,p2,p3).{(d/dx(p1,p2,p3)Xd/dy(p1,p2,p3))*Dx@Dy}
225 integrate with IxI,this is homotopy invariant.
226 generally speaking,in exchaing coordinates, vector equations are not always invariant but differntial forms are invariant. so we can calculate forms with
227 some suitable or fit coordinate,then by pulling back it  with general ones. 
229 C.Integral factor (always possible locally,but not global)
231 locally necessary and  sufficient condition is d(w)@w=0. so if f^-1 is integral factor
232 ,d(w)=d(log|f|)@w . usually we use frobenius method(or theorem) but I propose a new method
233 with quantization.
235 (%i72) fstar_with_clf([x,y,z],[x,y,z],trans_toexact(y*z*d(x)+x*z*d(y)+d(z)));
236                          2            2
237                   Dz u1 y  z + Dz u2 x  z - Dx u3 y - Dy u3 x
238 (%o72)            -------------------------------------------
239                                2  2       2  2
240                            u1 y  z  + u2 x  z  + u3
241 u1,u2,u3 is scale factor.
242 integral factor do'nt depends on metric,so u1->0,u2->0. or u2->0,u3->0 so on.
243 this is a quantization from clifford algebra to grassmann algebra.
245 (%i74) limit(limit(%o72,u1,0),u2,0);
246 (%o74)                           - Dx y - Dy x
247 (%i75) limit(limit(%o72,u3,0),u2,0);
248                                       Dz
249 (%o75)                                --
250                                       z
251 now w is  y*z*d(x)+x*z*d(y)+d(z),by %o74 d(w)=(- Dx y - Dy x)@w,
252 d(log|f|)=-( Dx y + Dy x)=-d(x*y),f^(-1)=%e^(x*y) is integral factor.
253 by %o75 d(w)=Dz/z @w,d(log|f|)=Dz/z,f^(-1)=1/z is also integral factor.
254 but %e^(x*y)is better than 1/z. see Flanders P92,93.
256 D. Poission bracket (symplectic form,symplectic manifold)
258 for example symplectic manifold dim 6,it has 2form named to symplectic forms.
259  1. w is closed form 2. w^3==w@w@w is not 0 everywhere .
260 (if dim 2*m,w^mis not0)
261 (%i39) f_star([p1,q1,p2,q2,p3,q3],(omega:Dp1@Dq1+Dp2@Dq2+Dp3@Dq3,omega@omega@omega));
262 (%o39)                    - 6 Dp1 Dp2 Dp3 Dq1 Dq2 Dq3
263 (%i40) f_star([p1,q1,p2,q2,p3,q3],(omega:Dp1@Dq1+Dp2@Dq2+Dp3@Dq3,d(omega)));
264 (%o40)                                 0
265 so this omega is simplectic form.
266 Poission bracket is definded as coordinates free
267         inner(Xf,(inner(Xg,omega))),and inner(Xg,omega) is d(g).
268 (%i42) f_star([p1,p2,p3,q1,q2,q3],(depends([g],[p1,p2,p3,q1,q2,q3]),omega:Dp1@Dq1+Dp2@Dq2
269         +Dp3@Dq3,inner(diff(g,q1)*Dp1-diff(g,p1)*Dq1+diff(g,q2)*Dp2-diff(g,p2)*Dq2+diff(g,q3)*Dp3
270         -diff(g,p3)*Dq3,omega)));
271                dg        dg        dg        dg        dg        dg
272 (%o42)     Dq3 --- + Dq2 --- + Dq1 --- + Dp3 --- + Dp2 --- + Dp1 ---
273                dq3       dq2       dq1       dp3       dp2       dp1
274 because poission bracket is defined
275 by inner(Xf,d(g)) in this package p_braket().
277 (%i55) f_star([p1,q1,p2,q2,p3,q3],(depends([f,g],[p1,q1,p2,q2,p3,q3]),p_braket(f,g)));
278            df  dg    df  dg    df  dg    df  dg    df  dg    df  dg
279 (%o55)     --- --- + --- --- + --- --- - --- --- - --- --- - --- ---
280            dp3 dq3   dp2 dq2   dp1 dq1   dq3 dp3   dq2 dp2   dq1 dp1
282 Jacobi identity
284 (%i63) f_star([p1,q1,p2,q2,p3,q3],(depends([f,g,h],[p1,q1,p2,q2,p3,q3]),
285 p_braket(p_braket(f,g),h)+p_braket(p_braket(g,h),f)+p_braket(p_braket(h,f),g)))$
286 (%i64) ratsimp(%);
287 (%o64)                                 0
288 (%i67) f_star([p1,q1,p2,q2,p3,q3],(depends([f,g,h],[p1,q1,p2,q2,p3,q3]),
289         p_braket(f,g*h)-g*p_braket(f,h)-h*p_braket(f,g)))$
290 (%i68) ratsimp(%);
291 (%o68)                                 0
293 Is canonical? [p,q]--->[P,Q]
294 (%i69) f_star([p,q],(P:q*cot(p),Q:log(sin(p)/q),d(P)@d(Q)))$
295 (%i70) trigsimp(%);
296 (%o70)                               Dp Dq
297 DP@DQ=Dp@Dq show canonical coordinates each other.
298 if H is hamiltonian, d(q)/dt=p_braket(q,H),d(p)/dt=p_braket(p,H)
299 (%i71) f_star([p1,q1,p2,q2,p3,q3],(depends([f,g,h],[p1,q1,p2,q2,p3,q3]),
300 p_braket(f*g,h)-f*p_braket(g,h)-g*p_braket(f,h)))$ is 0
301 if p_braket(g,H)=0 and p_braket(f,H)=0 (f,g is first integral),then
302 p_braket(f*g,h)=0 so f*g is a first integral too.
303 from jacobi identity p_braket(f,g) is also first integral.