Adept Scientific - English
The world's best software and hardware 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  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Facebook Adept Scientific on Twitter Adept Scientific on YouBube Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Watch Maple Video Demonstrations
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request an Evaluation
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 17 Overview
Maple 17 Professional
Maple 17 Academic
Maple 17 Student Use
What's New in Maple 17
Maple Features
Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes
The Möbius Project

Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
Maple Features
The Maple Reporter Online

Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
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] Functions as Procedure Parameters

Search email archive for  

[MUG] Functions as Procedure Parameters
Author: Nathan Sokalski    Posted: 12/10/2000 16:52:39 GDT
>> From: "Nathan Sokalski"

As you may know, there is no command to visually display trapezoid() like
there is for leftsum, rightsum, and middlesum. I decided to write my own,
and I have been able to make it work for some functions, but not others.
What I have concluded is that functions containing commands (sin(), ln(),
etc.) do not work, but functions without commands (x^2, 2*x+4, etc.) will
work. However, I also noticed that the ^ operator works for integer
exponents but not fractional. My procedure is shown below. How do I make my
procedure work for all functions?

trapezoidplot := proc (func, a, b, partitions) local interval, i, x1, y1,
x2, y2, curve, yview; interval := (b-a)/partitions; yview :=
min(0,evalf(minimize(func(x),x,a .. b))) .. max(0,evalf(maximize(func(x),x,a
.. b))); x2 := a; y2 := func(a); side.0 := PLOT(CURVES([[x2, y2], [x2,
0]],COLOR(RGB,0,0,0)),VIEW(a .. b,yview)); for i to partitions do x1 := x2;
y1 := y2; x2 := evalf(a+i*interval); y2 := func(x2); seg.i :=
PLOT(CURVES([[x1, y1], [x2, y2]],COLOR(RGB,0,0,0)),VIEW(a ..
b,yview),THICKNESS(2)); side.i := PLOT(CURVES([[x2, y2], [x2,
0]],COLOR(RGB,0,0,0)),VIEW(a .. b,yview)) od; with(plots); curve :=
plot(func(x),x = a .. b,thickness = 2); display(curve,[seq(side.j,j = 0 ..
partitions)],[seq(seg.h,h = 1 .. partitions)]) end:

NOTE: func must be defined with the <name>:=x-><function> method beforehand,
and entered as <name>, not <name>(x). a and b are the left and right
endpoints of the graph. partitions is the number of partitions.

EXAMPLE:

STUDENT >f:=x->x^2;
STUDENT >trapezoidplot(f,0,3,10);

Nathan Sokalski

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

[View Complete Thread]



Previous by date: [MUG] X-Error when starting xmaple 6.01 on AIX 4.3, Peter-Klaus Schilling
Next by date: [MUG] non-executable standard math, Ross Spencer
Previous thread: [MUG] FFT,  Bastero De Eleizalde, Carlos
Next thread: [MUG] non-executable standard math, Ross Spencer



Ready to buy?

For more pricing information:
Visit our webstore, call us on +1 800 724 8380 or email us at info@adeptscience.com

Featured Downloads

Maplesoft Product Catalogue
Maple Player for iPad - Datasheet
Maple 17 What's New datasheet
Maple 17 Professional Datasheet
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper - Technological Superiority in Multi-Domain Physical Modelling and Simulation

Latest Downloads

Maple - Global Optimization Toolbox
The Möbius Project - Create it, Share it, Grade it
Maple 17 Programming Guide
Maple 17 User Manual
Maplesoft Product Catalogue - Academic Maths

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

Latest News

Global Optimization Toolbox: Better Optimization to Solve More Problems, Faster
Global Optimization Toolbox: Better Optimization to Solve More Problems, Faster
New MapleSim release delivers advanced model development and analysis, extended toolchain connectivity and quicker results
Maple 17 offers advanced solving and application development capabilities
New release of Maple advances teaching and research
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2013, Adept Scientific Ltd.
Site designed and maintained by Lyndon Ash

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