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] declaration of procedure-type

Search email archive for  

[MUG] declaration of procedure-type
Author: Stefano Sofia    Posted: Mon, 06 May 2002 17:08:09 +0100

>> From: Stefano Sofia "stefano.sofia"

Hello everybody!
Here there is a question about declaration of procedure-type.
I hope my terminology is correct and you can understand my problem.

Two of the arguments (f1 and f2) of a procedure called "bif" are
procedure-type:

> bif:=proc(f1::procedure,f2::procedure,nr::procedure,initial::numeric);
> global s;
> local h_old,f_old,h_new,f_new,count,tdlist,dlist;
...
> end:


f1 and f2 are defined outside the bif procedure, for example f1 could be
defined as
> f1:=(x)->0.3*x-(0.5)*arctan(3.2*x)+0.1;
and f2 as
> f2:=(y)->y + 0.3*arctan(3.2*y);

Inside the "bif" procedure, and in particular within a "for" loop of n
steps I evaluate f1(x_t), with t=1..n, x_t different at each step. Let us call
f1(x_t) alpha_t; then, always for each iteration of the loop I need to create
a new procedure-type f3 defined as f2-alpha_t.
How can I define f3 within the bif procedure (not as external argument)? I'm
not able to declare f3 in a correct way.

thank you in advance for the eventual help
Stefano

[MUG] Re: declaration of procedure-type
Author: Robert Israel    Posted: Thu, 9 May 2002 01:13:10 -0700 (

>> From: Robert Israel "israel"

Perhaps I don't understand your problem, but it seems to me that you
may be missing something fundamental. You don't need to declare the type
of a variable that you want to be a procedure. Any name can be assigned
a value of any type, whether procedure or something else. Normally the
only effect of declaring the type of a formal parameter of a procedure is
to produce an error if the procedure is called with an actual parameter
that is not of this type.

As for "f3 defined as f2-alpha_t": if f2 and alpha_t are functions you've
already defined, you can simply say f3:= f2 - alpha_t, and then you can
treat f3 as if it were a function: f3(v) will be f2(v) - alpha_t(v).

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

On Mon, 6 May 2002, Stefano Sofia wrote:

> Hello everybody!
> Here there is a question about declaration of procedure-type.
> I hope my terminology is correct and you can understand my problem.
>
> Two of the arguments (f1 and f2) of a procedure called "bif" are
> procedure-type:
>
> > bif:=proc(f1::procedure,f2::procedure,nr::procedure,initial::numeric);
> > global s;
> > local h_old,f_old,h_new,f_new,count,tdlist,dlist;
> ...
> > end:
>
>
> f1 and f2 are defined outside the bif procedure, for example f1 could be
> defined as
> > f1:=(x)->0.3*x-(0.5)*arctan(3.2*x)+0.1;
> and f2 as
> > f2:=(y)->y + 0.3*arctan(3.2*y);
>
> Inside the "bif" procedure, and in particular within a "for" loop of n
> steps I evaluate f1(x_t), with t=1..n, x_t different at each step. Let us call
> f1(x_t) alpha_t; then, always for each iteration of the loop I need to create
> a new procedure-type f3 defined as f2-alpha_t.
> How can I define f3 within the bif procedure (not as external argument)? I'm
> not able to declare f3 in a correct way.

Previous by date: [MUG] PostScript Bug in Maple 6.02a Win 2k Pro,  Jeff Wright
Next by date: [MUG] Reading the Date from a txt File, Juan Navarro
Previous thread: [MUG] a bug or a feature?,  Rouben Rostamian
Next thread: [MUG] Reading the Date from a txt File, Juan Navarro



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