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] more about implicitdiff:complexity and recursiveness

Search email archive for  

[MUG] more about implicitdiff:complexity and recursiveness
Author: Charles James Leonardo Quarra Cappiello    Posted: Thu, 21 Nov 2002 12:26:09 -0400

>> From: "Charles James Leonardo Quarra Cappiello" "charsquarra"

Hi,

I've noted that the time of calculation of implicitdiff( eq(z,w) , z , w$n
); grows very quick with n, since in most calculations of the n-th implicit
derivative of z respect of w, one has usually:

n n-1 n-2
d z d z d z dz
--- = f ( ----- , ----- , -- , z , w );
n n-1 n-2
dw dw dw dw

now, in a particular calculation im in need of calculating all k-th implicit
derivatives from 1 to n, but it looks like each timestep, each k=1..n-1
derivatives are recalculated, amounting to an enourmous waste. Any ideas how
could implicitdiff reuse the results of the n-1 previous implicit
derivatives to calculate the n-th one?

Greetings,

Charles Quarra




_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

[MUG] Re: more about implicitdiff:complexity and recursiveness
Author: Preben Alsholm    Posted: Tue, 26 Nov 2002 10:38:18 +0100

>> From: Preben Alsholm "P.K.Alsholm"

Here are two solutions. As they are written the output is a Taylor
polynomial. The last one is by far the fastest. It makes use of
implicitdiff just once and then dsolve/series. The only problem with
that one is that dsolve/series has a bug that makes it unreliable.
The case below is not affected by that bug.

restart;
> implicittaylor1:=proc(eq::equation,L::list(name=algebraic),n::posint)
> local x,y,x0,y0,EQ,ym,k;
> x,y:=op(map(lhs,L));
> x0,y0:=op(map(rhs,L));
> EQ:=subs(y=y(x),eq);
> for k to n do
> EQ:=diff(EQ,x);
>
ym[k]:=eval(solve(EQ,diff(y(x),x$k)),{x=x0,y(x)=y0,seq(diff(y(x),x$i)=ym[i],i=1..k-1)})
> end do;
> y0+add(ym[k]*(x-x0)^k/k!,k=1..n)
> end proc:
> eq1:=x^2*y+x^3+y^4-3*y+2 = 0:
> time(implicittaylor1(eq1,[x=0,y=1],25));

30.754

> implicittaylor2:=proc(eq::equation,L::list(name=algebraic),n::posint)
local x,y,x0,y0,ODE,ym,k;
> x,y:=op(map(lhs,L));
> x0,y0:=op(map(rhs,L));
> ODE:=diff(y(x),x)=subs(y=y(x),implicitdiff(eq,y,x));
> Order:=n+1;
> convert(rhs(dsolve({ODE,y(x0)=y0},y(x),type=series)),polynom)
> end proc:
> time(implicittaylor2(eq1,[x=0,y=1],25));

1.102

The bug in dsolve/series is exhibited here:
> restart;
> Order:=2:
This is fine:
> dsolve({diff(y(x),x)=f(x,y(x)),y(x0)=y0},y(x),type=series);

2
y(x) = y0 + f(x0, y0) (x - x0) + O((x - x0) )

this is not
> dsolve({diff(y(x),x)=f(x+y(x)),y(x0)=y0},y(x),type=series);

2
y(x) = y0 + f(y0) (x - x0) + O((x - x0) )

nor is this
> dsolve({diff(y(x),x)=x*f(x+y(x)),y(x0)=y0},y(x),type=series);

2
y(x) = y0 + x0 f(y0) (x - x0) + O((x - x0) )

Preben Alsholm
Department of Mathematics
Technical University of Denmark

Charles James Leonardo Quarra Cappiello wrote:
>>>From: "Charles James Leonardo Quarra Cappiello" "charsquarra"
>>
>
> Hi,
>
> I've noted that the time of calculation of implicitdiff( eq(z,w) , z , w$n
> ); grows very quick with n, since in most calculations of the n-th implicit
> derivative of z respect of w, one has usually:
>
> n n-1 n-2
> d z d z d z dz
> --- = f ( ----- , ----- , -- , z , w );
> n n-1 n-2
> dw dw dw dw
>
> now, in a particular calculation im in need of calculating all k-th implicit
> derivatives from 1 to n, but it looks like each timestep, each k=1..n-1
> derivatives are recalculated, amounting to an enourmous waste. Any ideas how
> could implicitdiff reuse the results of the n-1 previous implicit
> derivatives to calculate the n-th one?
>
> Greetings,
>
> Charles Quarra
>
>
>
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
>

[MUG] Re: more about implicitdiff:complexity and recursiveness
Author: Charles James Leonardo Quarra Cappiello    Posted: Thu, 28 Nov 2002 12:33:48 -0400

>> From: "Charles James Leonardo Quarra Cappiello" "charsquarra"

Thanks Preben,

I come out with a solution in the meantime (this mailing list is SLOOOW)

EfficientImplicitDiff:=proc( Limplicitderivatives::name , f::name ,
z::name , w::name , ord::integer )
local j,k,temp1,temp2;
Limplicitderivatives:=[
diff(z(w),w)=-1/f(z(w)) ]; for
k from 2 to ord do;
temp1:=diff( f(z(w))*diff(z(w),w) , w$(k-1) );
temp2:=isolate( temp1 , diff(z(w),w$k ) );
for j from 1 to k-1 do;

temp2:=op(1,temp2)=subs( Limplicitderivatives[k-j] , op(2,temp2) );
end do;
temp2:=op(1,temp2)=normal(op(2,temp2));
Limplicitderivatives:=[
op(op(Limplicitderivatives)) , temp2 ];
end do;
end proc;

The idea is that it uses L as a list where it puts the implicit derivatives
of z respect to w of increasing order, and f ,z ,w as names for f(z(w)). In
this examples, i assume that f(z(w))*diff(z(w),w) + 1 = 0; and i put that
assumption in the first entry of the list, but it could be generalized for
the case where the dependence on w is a function g(z(w))

Greetings,

Charles Quarra


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus

Previous by date: [MUG] graphing parametric equations in 3d, Han Wesseling
Next by date: [MUG] Numerical error, Madham53
Previous thread: [MUG] problems with subs(),  Charles James Leonardo Quarra Cappiello
Next thread: [MUG] Numerical error, Madham53



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

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