Thaks for the suggestion, but it seems that it is impossible to get the derivative
of an expression by using quote:
(%i15) expr:exp('sum(a[i]*b[i],i,1,3));
3
====
\
> a b
/ i i
====
i = 1
(%o15) %e
(%i16) result: factor(sum(diff(expr,a[j])*c[j],j,1,3));
(%o16) 0
Without quote the result is:
(%i17) expr:exp(sum(a[i]*b[i],i,1,3));
a b + a b + a b
3 3 2 2 1 1
(%o17) %e
(%i18) result: factor(sum(diff(expr,a[j])*c[j],j,1,3));
a b + a b + a b
3 3 2 2 1 1
(%o18) %e (b c + b c + b c )
3 3 2 2 1 1
So, it seems that quote cannot provide the result in form:
n
====
\
> a b
/ i i n
==== ====
i = 1 \
(%o7) %e> b c
/ j j
====
j = 1
Other suggestions?
> Dear Dmitry,
>
> Does a quote solve your problem? E.g.:
>
> (%i1) exp('sum(a[i]*b[i],i,1,3))
>
> (%o1) %e^sum(a[i]*b[i],i,1,3)
>
> This is fairly persistent over reevaluation, but of cause at some point it might still be expanded.
>
> Best regards,
>
> Michael
>
> -----Original Message-----
> From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Dmitry Shkirmanov
> Sent: Thursday, April 26, 2012 10:51 AM
> To: maxima at math.utexas.edu
> Subject: do not expand sums explicitly
>
> Hello, list. Is it possible to don't expand sums explicitly?
> Let's consider an example:
>
> (%i1) expr1: exp( sum(a[i]*b[i],i,1,3));
> a b + a b + a b
> 3 3 2 2 1 1
> (%o1) %e
> (%i2) result: factor(sum(c[j]*diff(expr1,a[j]),j,1,3));
> a b + a b + a b
> 3 3 2 2 1 1
> (%o2) %e (b c + b c + b c )
> 3 3 2 2 1 1
>
> Is it possible to get answer in form, that does not have explicit summation, something like this:
>
> exp( sum(a[i]*b[i],i,1,3)) * sum(b[i]*c[i],i,1,3)) ?
>
> I tried to do not specify the number of terms:
>
>
> (%i3) expr2: exp( sum(a[i]*b[i],i,1,n));
> n
> ====
> \
> > a b
> / i i
> ====
> i = 1
> (%o3) %e
>
> It is just what i need. But, it seems that is impossible to get derivative of such expression:
> (%i4) diff(exp2,a[j]);
> (%o4) 0
> It gives zero instead of b[j]*exp( sum(a[i]*b[i],i,1,3)), so i cannot cannot define:
>
> (%i6) result2: sum(c[j]*diff(expr2,a[j]),j,1,n);
>
> It gives zero instead of
>
> n
> ====
> \
> > a b
> / i i n
> ==== ====
> i = 1 \
> (%o7) %e> b c
> / j j
> ====
> j = 1 Any ideas?
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>