Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
Define
With the define command, evaluation and simplification properties for functions and operators can be defined. Properties are specified by both keywords and by equations that use the syntax of the pattern matcher (patmatch command). The define command then creates a procedure that implements the function and its properties. Note that properties are used in the order that they are given; therefore, if one pattern is more general than the other, it has to be specified first: for example, f(x)=x should be defined before
First Examples
In the first example, we use the keyword linear:
To define commutative and associative operations, use the keywords orderless and flat. orderless means that the arguments of a function have no order, and flat means that f(a,f(b,c)) is equal to f(a,b,c).
One can use define for functional programming:
A nice way to define the greatest common divisor of integers:
The keyword multilinear can be used to define multilinear functions:
Now we use the definemore command to add to the existing definition of H the rule of commutativity (keyword orderless), and a simplification rule for some special arguments:
Further Examples
Define an integration procedure: integration is linear, equals when a does not depend on .
We now define the integral of :
And now the integral for powers of :
An example with the keyword diff and the command diff : We define the derivative of to be :
Define properties of a function which is linear, has a derivative of , and for which .
Check the derivative of :
Given that is linear:
Now Maple can compute the following integral using the fact that is linear and has derivative :
Even nested functions with can be integrated:
Since the derivative is given, we can compute limit and series:
An Example with an Infix Operator
Using the neutral operator &m, we define:
We can add more properties:
The syntax for define is described in the help page of define, while the syntax for patterns is described in the help page of patmatch.
Return to Example Worksheets Index
Download Help Document