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] Print the procedure output from dsolve

Search email archive for  

[MUG] Print the procedure output from dsolve
Author: Reuben D Budiardja    Posted: Mon, 13 May 2002 21:06:24 -0500

>> From: "Reuben D Budiardja" "reubendb"

Greetings,
I need some help with this. Suppose I have a differential equation that I
solve numerically using dsolve, something like:

dsol := dsolve({def_eq,ic}, numeric, output=listprocedure);

Maple wil then give me a listprocedure, for example:
dsol1 := [ t=proc(t) ... end proc, y(t)=proc(t) ... end proc ]

I can get the procedure by doing
fy := eval(y(t), dsol1);
and thus I can do
fy(1) ;
and get a result.

But what I really want, is either the function or the procedure of y(t). How
can I get that? I tried to do eval and print fy, and all I get is:
proc(t)... end proc.

How can I get the actual procedure ? I want this, because I use maple to
solve my differential equation, and then if I can get the procedure, I want
to use that numerical procedure / algorithm in other program such as C++.

Any help or pointer on this will be greatly appreciated.

Thanks.
Reuben D. Budiardja

[MUG] Re: Print the procedure output from dsolve
Author: Maple User Group    Posted: Fri, 17 May 2002 15:11:00 -0400

>> From: Maple User Group "maple_gr"

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Wed, 15 May 2002 11:40:09 -0700 (PDT)
From: Robert Israel "israel"
To: "maple-list"
Subject: Print the procedure output from dsolve

You could see the code with either

> showstat(fy);

or

> interface(verboseproc=3): eval(fy);

But you'll have to do some digging to get actual procedures that can
be used in C++. It might be easier to consult some of the references
listed in the help page ?dsolve,numeric, or use ready-made C code that is
available in various places.

Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Thu, 16 May 2002 10:14:46 +0200
From: Preben Alsholm "ifakpa"
To: "maple-list" "reubendb"
Subject: Print the procedure output from dsolve

You can do as follows (here illustrated with y'=y, y(0)=1):

> restart;
> L:=dsolve({diff(y(t),t)=y(t),y(0)=1},y(t),type=numeric,output=listprocedure):
> f:=subs(L,y(t)):
> interface(verboseproc=2);
> eval(f);

Then you see the procedure f. That procedure, however, calls other Maple
procedures, so it might not be of any help in your situation.

--
Preben Alsholm
Institut for matematik (Department of Mathematics)
DTU (Technical University of Denmark)



-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Thu, 16 May 2002 08:25:34 +0200
From: Helmut Kahovec "helmut.kahovec"
To: "maple-list" Reuben D Budiardja "reubendb"
Subject: Print the procedure output from dsolve

Well, you may set interface(verboseproc=2); or use showstat(). However,
it will be rather difficult to extract the numerical algorithm of the
solution from this.

> restart:
> ode:=diff(y(x),x$2)+y(x)=0:
> IC:=y(0)=0,D(y)(0)=0:
> dsol:=dsolve({ode,IC},numeric,output=listprocedure):
> f:=eval(y(x),dsol);

f := proc(x) ... end proc

> f(Pi);

0.

> showstat(f);

f := proc(x)
local res, plistproc, outpoint, ndsol;
1 outpoint := evalf(x);
2 plistproc := proc (rkf45_x)
local i, comp_soln_data, odeproc, icvec, LR_case, Y, val,
outpoint, pt, stop_proc, stop_array, cplex;
option `Copyright (c) 2000 by the University of Waterloo. ...

...

val := `dsolve/numeric/SC/IVPval`(comp_soln_data,outpoint);
[x = outpoint, seq(Y[i] = val[i],i = 1 .. nops(Y))]
end proc;
plistproc("complex") := false;
plistproc("right_comp_soln_data") := [
2, 9,
Array(
1..9,
[ ... ],
datatype = float[8],
storage = rectangular,
order = C_order
),
Array(
1..9, 1..2,
[ ... ],
datatype = float[8],
storage = rectangular,
order = C_order
),
4, false, 13, 0, true, 14, 1
];
plistproc("soln_procedures") := [14249992, 14325068, 14250072];
3 if not type(outpoint,'numeric') then
4 if member(outpoint,["start", "left", "right"]) then
5 return plistproc(x)
elif outpoint = "procedurelist" then
6 return eval(plistproc)
elif procname <> unknown then
7 return ('procname')(x)
else
8 ndsol := pointto(plistproc("soln_procedures")[2]);
9 return ('ndsol')(x)
end if
end if;
10 res := [traperror(plistproc(x))];
11 if type(res[1],string) then
12 error op(res)
else
13 rhs(res[1][2])
end if
end proc


Kind regards,

Helmut

Previous by date: [MUG] Re: eigenvect for real nonsymmetric matrix, Maple User Group
Next by date: [MUG] Coupled, nonlinear ODEs., Anders Ballestad
Previous thread: [MUG] MathML Conference,  Stan Devitt
Next thread: [MUG] Coupled, nonlinear ODEs., Anders Ballestad



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