List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] differentiation of a sum
| [MUG] differentiation of a sum |
|
Author: Maple User Group
Posted: Mon, 17 Feb 2003 22:06:37 -0500
|
>> From: Maple User Group "maple_gr"
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 14 Feb 2003 00:21:21 +0100
From: Helmut Kahovec "helmut.kahovec"
To: "maple-list"
Subject: Differentiation of an arbitrary sum
Ingo Ellersdorfer wrote:
>| how can I differentiate an arbitrary sum like sum(q[i],i=1..n), with respect
>| to q[i], so that I will get "1" instead of "n"?
Well, by extending the built-in procedure diff(). First, put the
following lines into the Maple initialization file maple.ini:
olddiff:=eval(diff):
protect(olddiff);
unprotect(diff);
diff:=proc()
local e,x,d,s;
e,x:=args[1],args[2];
use DIFF=olddiff in
if type(e,specfunc(anything,{sum,Sum})) and type(x,indexed)
then
d:=DIFF(op(1,e),subsop(1=op([2,1],e),x));
if type(e,specfunc(anything,sum)) then
s:=eval(sum)
else
s:=eval(Sum)
end if;
if op([2,1],e)<>op(1,x) then
s(d,op([2,1],e)=op(1,x)..op(1,x))
else
s(
subs(op([2,1],e)=cat(`_`,op([2,1],e)),d),
cat(`_`,op([2,1],e))=op(1,x)..op(1,x)
)
end if
else
DIFF(args)
end if
end use
end proc:
protect(diff);
Then, execute the restart command:
> restart;
Now, you get in turn:
> diff(sum(q[i],i=1..n),q[i]);
1
> diff(sum(q[i]^2,i=1..n),q[i]);
2 q[i]
> diff(sum(q[i],i=1..n),q[j]);
1
> diff(sum(q[i]^2,i=1..n),q[j]);
2 q[j]
> diff(Sum(q[i],i=1..n),q[i]); value(%);
i
-----
\
) 1
/
-----
_i = i
1
> diff(Sum(q[i]^2,i=1..n),q[i]); value(%);
i
-----
\
) (2 q[_i])
/
-----
_i = i
2 q[i]
> diff(Sum(q[i],i=1..n),q[j]); value(%);
j
-----
\
) 1
/
-----
i = j
1
> diff(Sum(q[i]^2,i=1..n),q[j]); value(%);
j
-----
\
) (2 q[i])
/
-----
i = j
2 q[j]
Note, that this extension to diff() is just a start and you must take
care that such an extension does not interfere with the code of the
Maple library.
Kind regards,
Helmut
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Dan. & Linda Willard" "willardd"
To: "maple-list"
Subject: Differentiation of an arbitrary sum
Date: Fri, 14 Feb 2003 14:33:39 -0500
Try: j:=<k>; #some value of k
S:=n->sum(q[i]=1..n);
X:=diff(S(n),q[j]);
----- Original Message -----
From: "Ingo Ellersdorfer" "ie"
To: "maple-list"
Sent: Wednesday, February 12, 2003 8:45 AM
Subject: [MUG] Differentiation of an arbitrary sum
>
> >> From: Ingo Ellersdorfer "ie"
>
> Dear all,
>
> how can I differentiate an arbitrary sum like sum(q[i],i=1..n), with
respect
> to q[i], so that I will get "1" instead of "n"?
>
> Thanks for your help and best regards
> Ingo Ellersdorfer
>
>
>
>
> Ingo Ellersdorfer, Dipl.-Volkswirt
>
> University of Stuttgart, Germany
> Institute of Energy Economics and the Rational Use of Energy / Dept. ESA
>
> Hessbr|hlstr. 49a
> D-70565 Stuttgart
> Germany
>
> Phone: +49 711 780 6114
> FAX: +49 711 780 3953
> "ie"
>
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Dr Francis J. Wright" "F.J.Wright"
To: "ie"
Subject: Differentiation of an arbitrary sum
Date: Sun, 16 Feb 2003 17:51:07 -0000
From: "Ingo Ellersdorfer" "ie"
To: "maple-list"
Sent: Wednesday, February 12, 2003 1:45 PM
Subject: [MUG] Differentiation of an arbitrary sum
> how can I differentiate an arbitrary sum like sum(q[i],i=1..n), with
respect
> to q[i], so that I will get "1" instead of "n"?
The short answer is: you can't!
The longer answer is that I think you really want to differentiate wrt q[j]
and get 1 if 1 <= j <= n and 0 otherwise. It would require a fair amount of
work to provide a facility that would support this in a reasonably general
and useful way. This is another of those problems that falls in the gap
between the concrete and abstract ends of computer algebra and is currently
not well supported.
Francis
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: Ingo Ellersdorfer "ie"
To: "Dr Francis J. Wright" "F.J.Wright"
Subject: AW: Differentiation of an arbitrary sum
Date: Mon, 17 Feb 2003 11:24:17 +0100
Dear Francis,
thank you very much for your answer. By assistance of the maple support team
it was possible to solve the problem. There exists a maple tool for
differentiating arbitrary sums, provided by Prof. Taylor (Clarkson
University, New York). You can download the "TDTools.mpl" from:
http://www.clarkson.edu/~chengweb/faculty/taylor/maple/sum/
On this web side you will also the worksheet "diffsum.mws" with instructions
for application.
Best regards
Ingo Ellersdorfer
-----Urspr|ngliche Nachricht-----
Von: Dr Francis J. Wright "mailto:F.J.Wright"
Gesendet: Sonntag, 16. Februar 2003 18:51
An: "ie"
Cc: "maple-list"
Betreff: Re: [MUG] Differentiation of an arbitrary sum
From: "Ingo Ellersdorfer" "ie"
To: "maple-list"
Sent: Wednesday, February 12, 2003 1:45 PM
Subject: [MUG] Differentiation of an arbitrary sum
> how can I differentiate an arbitrary sum like sum(q[i],i=1..n), with
respect
> to q[i], so that I will get "1" instead of "n"?
The short answer is: you can't!
The longer answer is that I think you really want to differentiate wrt q[j]
and get 1 if 1 <= j <= n and 0 otherwise. It would require a fair amount of
work to provide a facility that would support this in a reasonably general
and useful way. This is another of those problems that falls in the gap
between the concrete and abstract ends of computer algebra and is currently
not well supported.
Francis
|
Previous by date: [MUG] FW: polynomials to operators, Richard Patterson
Next by date: [MUG] Re: Displaying maples graphs in latex., Mark Fitch
Previous thread: [MUG] Problem using evalf(Int), Maple User Group
Next thread: [MUG] Displaying maples graphs in latex., Theo H S Boafo
|