itensor and ctensor: indexed objects in moving frames in specific coordinate systems and frame basis



Viktor T. Toth <vttoth at vttoth.com> ?????(?) ? ????? ?????? Thu, 10 Feb
2011 03:31:01 +0300:

> OK, I think I understand the problem. At the root is the fact that  
> ic_convert uses noun forms of ifg, ifr, and ifri. Then, we run into  
> something that may or may not be a Maxima buglet:
>
> (%i1) depends(y,x);
> (%o1)                               [y(x)]
> (%i2) diff(y,x);
>                                       dy
> (%o2)                                 --
>                                       dx
> (%i3) diff(y[0],x);
>                                     d
> (%o3)                               -- (y )
>                                     dx   0
> (%i4) diff('y,x);
>                                       dy
> (%o4)                                 --
>                                       dx
> (%i5) diff('y[0],x);
> (%o5)                                  0
>
> Personally I think this is a bug, but fortunately, there is a way to  
> work around it within the confines of the tensor libraries. Your example  
> could be written thus:
>
> load(itensor);
> load(ctensor);
> iframe_flag:true;
> cframe_flag:true;
> ct_coordsys(polar)$
> depends([V,ifg,ifr,ifri],ct_coords)$
> ishow(covdiff(V([],[j]),j))$
> ishow(ev(%,icc2,ifc2,ifc1,ifb))$
> eqn:eq=%$
> ceqn:ic_convert(rename(expand(eqn)))$
> ceqn:subst(ifri,nounify(ifri),ceqn)$
> ifg:matrix([1,0],[0,1]);
> ifr:matrix([1,0],[0,1/r]);
> ifri:matrix([1,0],[0,r]);
> ceqn,'ifr,'ifg;
>                            V
>                             1    d          d
> (%o15)                     -- + ---- (V ) + -- (V )
>                            r    dphi   2    dr   1

But V_1 and V_2 should have equal physical dimension (since
ifg:matrix([1,0],[0,1])). It seems to me that the correct answer should be:


                               d
                              ---- (V )   V
                              dphi   2     1   d
                              --------- + -- + -- (V )
                                  r       r    dr   1
>
> The critical line is the ceqn:subst(...) line, which substitutes the  
> verb form of ifri before diff is evaluated.
>
>
> Viktor
>
>
>
>
>
>
> -----Original Message-----
> From: Yaroslav Alekseev [mailto:yaalekseev at rambler.ru]
> Sent: Wednesday, February 09, 2011 6:52 PM
> To: maxima at math.utexas.edu; Viktor T. Toth
> Subject: Re: [Maxima] itensor and ctensor: indexed objects in moving  
> frames in specific coordinate systems and frame basis
>
> Viktor T. Toth <vttoth at vttoth.com> ?????(?) ? ????? ?????? Tue, 08 Feb
> 2011 22:39:04 +0300:
>
>> I think the only step missing is an evaluation of ifb before converting
>> to a
>> ctensor expression. Try this:
>>
>> load(itensor);
>> load(ctensor);
>> iframe_flag:true;
>> cframe_flag:true;
>> ct_coordsys(polar)$
>> depends([V,ifg,ifr,ifri],ct_coords)$
>> ishow(covdiff(V([],[j]),j))$
>> ishow(ev(%,icc2,ifc2,ifc1,ifb))$
>> eqn:eq=%$
>> ceqn:ic_convert(eqn)$
>> ev(ceqn);
>>
>> A word of warning: Presently, ic_convert has no explicit knowledge about
>> the
>> meaning of the symbols ifg, ifr, and ifri. It just treats them as it
>> would
>> treat any other indexed objects. In the present example, it is not
>> relevant
>> as the symbols cancel; in other cases, however, you may need to take
>> steps
>> to identify the itensor symbols ifr, ifri, and ifg with the  
>> corresponding
>> ctensor matrices fri, ifri, and lfg/ufg as appropriate.
>>
>>
>> Viktor
>
> Ok, thank you for response.
> I have to define symbols ifr, ifri, and ifg. So, I've tried this:
>
> load(itensor);
> load(ctensor);
> iframe_flag:true;
> cframe_flag:true;
> ct_coordsys(polar)$
> depends(V,ct_coords)$
> ishow(covdiff(V([],[j]),j))$
> ishow(ev(%,icc2,ifc2,ifc1,ifb))$
> eqn:eq=%$
> ceqn:ic_convert(eqn)$
> ifg:matrix([1,0],[0,1]);
> fri:matrix([1,0],[0,1/r]);
> ifri:matrix([1,0],[0,r]);
> ev(ceqn);
>
> But I've got very strange answer:
>
>
> (%i14) ev(ceqn);
>                                 d          d
> (%o14)                        ---- (V ) + -- (V )
>                                dphi   2    dr   1
>
> It seems to me that the answer should be something like this (ordinary
> divergence):
>
>
>                                  dV2
>                                  ----
>                                  dphi   dV1   V1
> (%o21)                          ---- + --- + --
>                                   r     dr    r
>
>
>
>>
>>
>>
>> -----Original Message-----
>> From: maxima-bounces at math.utexas.edu
>> [mailto:maxima-bounces at math.utexas.edu]
>> On Behalf Of Yaroslav Alekseev
>> Sent: Tuesday, February 08, 2011 2:38 PM
>> To: maxima at math.utexas.edu
>> Subject: itensor and ctensor: indexed objects in moving frames
>> in
>> specific coordinate systems and frame basis
>>
>>
>> Hi to all! I need to learn how to compute various expressions with
>> indexed
>> objects in moving frames
>> in specific coordinate systems and frame basis. For example: to compute
>> contract(covdiff(V([],[j]),j))
>> in polar coordinate and frame
>> basis:matrix([a(r,phi),b(r,phi)],[c(r,phi),d(r,phi)]). In Maxima:
>>
>> Maxima 5.23.2 http://maxima.sourceforge.net
>> using Lisp SBCL 1.0.43
>> Distributed under the GNU Public License. See the file COPYING.
>> Dedicated to the memory of William Schelter.
>> The function bug_report() provides bug reporting information.
>> (%i1) kill(all);
>> (%o0)                                done
>> (%i1) load(itensor);
>> STYLE-WARNING: redefining MAXIMA::$NAME in DEFUN
>> STYLE-WARNING: redefining MAXIMA::DERIV in DEFUN
>> STYLE-WARNING: redefining MAXIMA::SDIFF in DEFUN
>> STYLE-WARNING: redefining MAXIMA::I-$DEPENDENCIES in DEFUN
>> STYLE-WARNING: redefining MAXIMA::$DECSYM in DEFUN
>> STYLE-WARNING: redefining MAXIMA::$CANFORM in DEFUN
>> (%o1)      /usr/local/share/maxima/5.23.2/share/tensor/itensor.lisp
>> (%i2) load(ctensor);
>> (%o2)       /usr/local/share/maxima/5.23.2/share/tensor/ctensor.mac
>> (%i3) iframe_flag:true;
>> (%o3)                                true
>> (%i4) ishow(covdiff(V([],[j]),j));
>>                                 j        j     %1
>> (%t4)                         V   + icc2     V
>>                                 ,j       %1 j
>> (%o4)           V([], [j], j) + icc2([%1, j], [j]) V([], [%1])
>> (%i5) ishow(ev(%,icc2));
>>                                 %1     j       j
>> (%t5)                         V   ifc2     + V
>>                                        %1 j    ,j
>> (%o5)           V([], [%1]) ifc2([%1, j], [j]) + V([], [j], j)
>> (%i6) ishow(ev(%,ifc2,ifc1));
>>              %1    j %2
>>             V   ifg     (ifb        - ifb        + ifb       )
>>                             j %2 %1      %2 %1 j      %1 j %2     j
>> (%t6)      -------------------------------------------------- + V
>>                                     2                             ,j
>> (%o6) (V([], [%1]) ifg([], [j, %2]) (ifb([j, %2, %1]) - ifb([%2, %1, j])
>>                                           + ifb([%1, j, %2])))/2 + V([],
>> [j], j)
>> (%i7) expr:contract(ratexpand(%));
>>        V([], [%1]) ifg([], [j, %2]) ifb([j, %2, %1], [])
>> (%o7) -------------------------------------------------
>>                                2
>>     V([], [%1]) ifg([], [j, %2]) ifb([%2, %1, j], [])
>>   - -------------------------------------------------
>>                             2
>>     V([], [%1]) ifg([], [j, %2]) ifb([%1, j, %2], [])
>>   + ------------------------------------------------- + V([], [j], j)
>>                             2
>> (%i8) ishow(expr);
>>         %1    j %2               %1    j %2               %1    j %2
>>        V   ifg     ifb          V   ifg     ifb          V   ifg     ifb
>>                       j %2 %1                  %2 %1 j
>> %1
>> j %2
>> (%t8) ---------------------- - ---------------------- +
>> ----------------------
>>                  2                        2                        2
>> j
>>                                                                            +
>>
>> V
>> ,j
>>        V([], [%1]) ifg([], [j, %2]) ifb([j, %2, %1], [])
>> (%o8) -------------------------------------------------
>>                                2
>>     V([], [%1]) ifg([], [j, %2]) ifb([%2, %1, j], [])
>>   - -------------------------------------------------
>>                             2
>>     V([], [%1]) ifg([], [j, %2]) ifb([%1, j, %2], [])
>>   + ------------------------------------------------- + V([], [j], j)
>>                             2
>> (%i9) eqn:ishow(eq=expr);
>>              %1    j %2               %1    j %2
>>             V   ifg     ifb          V   ifg     ifb
>>                            j %2 %1                  %2 %1 j
>> (%t9) eq = ---------------------- - ----------------------
>>                       2                        2
>>                                                      %1    j %2
>>                                                     V   ifg     ifb
>>                                                                    %1 j
>> %2    j
>>                                                   +
>> ----------------------
>> + V
>>                                                               2
>>
>> ,j
>>             V([], [%1]) ifg([], [j, %2]) ifb([j, %2, %1], [])
>> (%o9) eq = -------------------------------------------------
>>                                     2
>>     V([], [%1]) ifg([], [j, %2]) ifb([%2, %1, j], [])
>>   - -------------------------------------------------
>>                             2
>>     V([], [%1]) ifg([], [j, %2]) ifb([%1, j, %2], [])
>>   + ------------------------------------------------- + V([], [j], j)
>>                             2
>> (%i10) ceqn:ic_convert(eqn);
>> STYLE-WARNING: redefining MAXIMA::$IC_CONVERT in DEFUN
>> STYLE-WARNING: redefining MAXIMA::$MAKEBOX in DEFUN
>> STYLE-WARNING: redefining MAXIMA::$CONMETDERIV in DEFUN
>> STYLE-WARNING: redefining MAXIMA::$IGEODESIC_COORDS in DEFUN
>> (%o10) eq :
>> sum(sum(sum(V   ifg      ifb         , %1, 1, dim), %2, 1, dim), j, 1,
>> dim)
>>               %1    j, %2    j, %2, %1
>> ---------------------------------------------------------------------------
>>                                       2
>>     sum(sum(sum(V   ifg      ifb         , %1, 1, dim), %2, 1, dim), j,
>> 1,
>> dim)
>>                  %1    j, %2    %2, %1, j
>>   -
>> ---------------------------------------------------------------------------
>>                                          2
>>     sum(sum(sum(V   ifg      ifb         , %1, 1, dim), %2, 1, dim), j,
>> 1,
>> dim)
>>                  %1    j, %2    %1, j, %2
>>   +
>> ---------------------------------------------------------------------------
>>                                          2
>>   + sum(diff(V , ct_coords ), j, 1, dim)
>>               j           j
>> (%i11) ct_coordsys(polar);
>> (%o11)                               done
>> (%i12) depends(V,ct_coords);
>> (%o12)                            [V(r, phi)]
>> (%i13) ev(ceqn);
>>          d          d
>> (%o13) ---- (V ) + -- (V ) + (V  ifg     ifb        + V  ifg     ifb
>>         dphi   2    dr   1      2    2, 2    2, 2, 2    1    2, 2    2,
>> 2, 1
>>   + V  ifg     ifb        + V  ifg     ifb        + ifg     ifb        V
>>      2    2, 1    2, 1, 2    1    2, 1    2, 1, 1      1, 2    1, 2, 2   
>> 2
>>   + ifg     ifb        V  + V  ifg     ifb        + V  ifg     ifb
>> )/2
>>        1, 1    1, 1, 2  2    1    1, 2    1, 2, 1    1    1, 1    1, 1,  
>> 1
>>   + (V  ifg     ifb        + V  ifg     ifb        + V  ifb        ifg
>>       2    2, 2    2, 2, 2    2    2, 1    2, 2, 1    1    1, 2, 2    2,
>> 2
>>   + ifg     V  ifb        + ifg     V  ifb        + V  ifb        ifg
>>        1, 2  2    2, 1, 2      1, 1  2    2, 1, 1    1    1, 2, 1    2,  
>> 1
>>   + V  ifb        ifg     + V  ifg     ifb       )/2
>>      1    1, 1, 2    1, 2    1    1, 1    1, 1, 1
>>   - (V  ifg     ifb        + ifg     V  ifb        + V  ifb        ifg
>>       2    2, 2    2, 2, 2      1, 2  2    2, 2, 1    1    2, 1, 2    2,
>> 2
>>   + V  ifg     ifb        + ifb        V  ifg     + V  ifb        ifg
>>      1    1, 2    2, 1, 1      1, 2, 2  2    2, 1    1    1, 1, 2    2,  
>> 1
>>   + ifg     ifb        V  + V  ifg     ifb       )/2
>>        1, 1    1, 2, 1  2    1    1, 1    1, 1, 1
>> (%i14)
>>
>> What should I do next ?
>>
>
>


-- 
Yaroslav