RE : Differentiating sums




> -----Message d'origine-----
> De?: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] De la part de
> Grze? Andruszkiewicz
> Envoy??: vendredi 13 janvier 2012 18:13
> ??: Robert Dodier
> Cc?: maxima at math.utexas.edu
> Objet?: Re: [Maxima] Differentiating sums
> 
> Hi,
> 
> Thanks for a prompt reply. I actually managed to get it working by
> setting simplify_sum:true. But now I am trying to solve for first
> order conditions:
> 2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0
> solve(%, a)
> 
> which gives:
> [sum(((c^2*X[i]^3+(2*c*d-2*a)*X[i]^2+(d^2-
> 2*b)*X[i])*t+2*R[i]*X[i])/(2*c^2*X[i]^2+4*c*d*X[i]+2*d^2),i,1,M)=0]
> 
> instead of splitting the sum into 2 sums (1 dependent on a and the
> other not) and dividing accordingly. Any ideas how to achieve this?
> 
> Cheers,
> Grzegorz
> 

Hi,

You have to declare sum to be linear.

(%i9) display2d:false;
(%o9) false
(%i10) declare(sum,linear);
(%o10) done
(%i11) eq:2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0;
(%o11) 2*'sum(X[i]*((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])/(c*X[i]+d)^2,i,1,M) = 0
(%i12) solve(eq,a);
(%o12) [a =
-((2*b*'sum(X[i]/(c*X[i]+d)^2,i,1,M)-'sum(X[i],i,1,M))*t-2*'sum(R[i]*X[i]/(c*X[i]+d)^2,i,1,M))/
(2*('sum(X[i]^2/(c*X[i]+d)^2,i,1,M))*t)]