Adept Scientific - English
The world's best software for research, science and engineering.
flag arrow
clearclear
 

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Find out about Online Training
• Download a Brochure
• Request a Brochure
• Download a Demo
• Request a Demo
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 11 Professional
Maple 11 Academic
Maple 11 Student Use
Recorded Online Seminars
FREE Training Resources


MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

View Maple 10 in Action
Product Comparison Chart

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


Service & Support

Maple 10 Training Videos
MaplePrimes, blogs, forums
Elite Maintenance Program
Application Centre
Powertools
Maple User Group (MUG)
Join the Maple User Group
(MUG)

Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] differentiation of a sum

Search email archive for  

[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



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

What's New in Maple 11 for Professionals
Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055