# [Maxima] Bug in the itensor package?

Valery Pipin pip at iszf.irk.ru
Wed Jun 6 23:23:54 CDT 2012

Viktor,

Thanks! You done the great job to improve itensor!
Receipt is that I have to introduce the metrics before calculations.

Then, the Dmitry's problem can be solved by dividing it in parts
because the function argument is the scalar.
Say by the rules
'diff(F(S),a([i],[])) -> 'diff(F(S),S)*'diff(S,a([i],[])) where
'diff(S,a([i],[])) is calculated by itensor
> Valery,
>
> That is no more a restriction than, say, the restriction on writing
> a([i],[])*a([i],[])*a([],[i]). This expression is illegal because it
> violates the rule on repeat indices (namely that the same index should
> appear at most in one covariant and one contravariant position). When you
> try to differentiate a([i],[])*a([],[i]) with respect to a([i],[]), the same
> index 'i' appears three times, and that is an invalid expression.
>
> Another way of putting it is that you should never use the same symbol for a
> dummy index and a free index. Outside of Maxima, the expression $\partial_i > A_iA^i$ is ambiguous for the same reason, because it does not tell you what
> you need to do first: do you first form the inner product $A_iA^i$ and then
> take its gradient, or do you first compute the divergence $\partial_i A^i$
> and then multiply it by $A_i$? Maxima cannot magically make sense of
> something that does not make sense on paper.
>
> If you wish carry out this particular differentiation, you need to use a
> different index, e.g., a([k],[]). You also need to establish some way how
> the contravariant form of the tensor is differentiated with respect to the
> covariant form (i.e., you need a metric, its symmetry properties, and index
> raising and lowering rules for the tensor). E.g., something like this:
>
> (%o1)
> /usr/share/maxima/branch_5_27_base_15_g43155e0_dirty/share/tensor/itensor.li
> sp
> (%i2) imetric(g);
> (%o2)                                done
> (%i3) decsym(g,0,2,[],[sym(all)]);
> (%o3)                                done
> (%i4) components(a([],[i]),g([],[i,j])*a([j],[]));
> (%o4)                                done
> (%i5) expr:a([i],[])*a([],[i]);
> (%o5)                g([], [i, %1]) a([%1], []) a([i], [])
> (%i6) remcomps(a);
> (%o6)                                done
> (%i7) contract(diff(expr,a([k],[])));
> (%o7)                            2 a([], [k])
>
>
> Viktor
>
>
>
>
>
>
> -----Original Message-----
> From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
> On Behalf Of Valery Pipin
> Sent: Wednesday, June 06, 2012 11:32 PM
> To: maxima at math.utexas.edu
> Subject: Re: [Maxima] Bug in the itensor package?
>
> I think that there is more serious restriction (it is described in the
> help) here than that asked by Dmitry.
> Consider
> expr:a([i],[])*a([],[i])
> and try
> diff(expr,a([i],[]))
>
> V
>
>
>
>> Well, yes. But try 1 - exp() and notice how rename fails to work properly.
> Yes, diff() works a little more sensibly for exp(), but that I think is
> mostly a happy accident.
>> One problem with dealing with tensor expressions as function arguments is
> that we really don't know what the function does and what it returns. In
> particular, the syntax yields no information about the function's return
> type (scalar, tensor, etc.)
>> Just to be clear, I'm not saying that the function syntax will forever
> remain outside the realm of expressions that itensor can deal with, just
> advising caution for now. It is a topic that is on my long-term "to do" list
> for itensor.
>>
>> Viktor
>>
>>
>>
>>
>> -----Original Message-----
>> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Dmitry Shkirmanov
>> Sent: Wednesday, June 06, 2012 5:20 AM
>> To: maxima at math.utexas.edu
>> Subject: Re: [Maxima] Bug in the itensor package?
>>
>> Thanks. But it seems that the itensor can deal with tensor expressions
> that appear as an argument of the exponential function. May be there is
> possibility to expand this functionality to the error function(and other
> functions)? It would be very useful.
>>
>> (%i1) load(itensor)$>> ... >> ... >> (%i2) expr: exp( a([i],[])*b([],[i])); >> b([], [i]) a([i], []) >> (%o2) %e >> (%i3) expr: rename(expr); >> b([], [%1]) a([%1], []) >> (%o3) %e >> (%i4) derivative: diff(expr, a([i],[])); >> b([], [%1]) a([%1], []) >> (%o4) b([], [%1]) %e kdelta([%1], [i]) >> (%i5) res: contract(%); >> b([], [%1]) a([%1], []) >> (%o5) b([], [i]) %e >> >> >> >> >> Not really a bug per se, but a limitation. The itensor package > generallycannot deal with tensor expressions that appear as function > arguments.Function arguments are treated by itensor as opaque, and are > excluded fromitensor operations, which is why contract and rename were > ineffective. Onthe other hand, diff applies its standard rules to the > expression with noregard to the fact that some of the terms it is > manipulating representindexed objects, and the result is an unpredictable > mess. >> >> >> >> Viktor >> >> >> -----Original Message----- >> From: maxima-bounces at > math.utexas.edu<http://www.math.utexas.edu/mailman/listinfo/maxima> > [mailto:maxima-bounces at > math.utexas.edu<http://www.math.utexas.edu/mailman/listinfo/maxima> ] >> On Behalf Of Dmitry Shkirmanov >> Sent: Tuesday, June 05, 2012 8:56 AM >> To: maxima at > math.utexas.edu<http://www.math.utexas.edu/mailman/listinfo/maxima> >> Subject: [Maxima] Bug in the itensor package? >> >> Hello,list. >> >> Maxima 5.27.0 http://maxima.sourceforge.net >> using Lisp CLISP 2.48 (2009-07-28) >> 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) load(itensor)$
>> 	...
>> 	...
>> 	(%i2) expr: erfc(-x([i],[])*y([],[i]))$>> (%i3) expr: contract(expr)$
>> 	(%i4) expr: rename(expr);
>> 	(%o4)                   2 - erfc(y([], [i]) x([i], []))
>> 	(%i5) diff(expr, y([],[i]));
>> 	                   2           2
>> 	                - y ([], [i]) x ([i], [])
>> 	            2 %e                          x([i], []) kdelta([i],
> [i])
>> 	(%o5)      ---------------------------------------------------------
>> 	                                    sqrt(%pi)
>> 	(%i6)
>> 	As it can be seen from this example, the rename() function does not
> work
>> 	correctly. Next, it seems, that the diff() function
>> 	does not work correctly too. Is it bug?
>>
>>
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>