Maple Software Tutorial for Modelling
Upcoming SlideShare
Loading in...5

Maple Software Tutorial for Modelling



Maple Software Tutorial for the IO2081 Modelling Course of the faculty of Industrial Design of the TU Delft

Maple Software Tutorial for the IO2081 Modelling Course of the faculty of Industrial Design of the TU Delft



Total Views
Views on SlideShare
Embed Views



2 Embeds 50 43 7



Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Maple Software Tutorial for Modelling Maple Software Tutorial for Modelling Presentation Transcript

    • Maple Software Tutorial
    • Mathematical Symbols MapleDoc, IO, TU Delft
    • Product in werking Construeren Product en beweging Modeling The Arts of Computing MapleDoc Y. Song (Wolf) B.Eng, M.Sc., Ph.D. Erik W. Thomassen M.Sc. Faculty of Industrial Design Engineering Delft University of Technology
    • Preface: Why should industrial design engineers use Maple? MapleDoc, IO, TU Delft Whenever facing a more complex (or “wicked”) design problem which is mathematically solvable, we can benefit from the force of a systematic application such as Maple as a designer’s tool. Maple’s strength lies in that is not merely providing a number as the output to a question, but in adding insight into that question by showing its parametrical relations. A simplified formula itself can be seen as the result, lifting this time to a more fundamental level. It allows system thinking, along with producing valuable output. Understanding the system helps tremendously in rationally improving a design, as well as in communicating about it. What your system is all about is finally up to you. Within this course we use Maple models for mechanics, thermo- and fluid dynamics. But if you’re interested in other aspects of design or research you can use it too: there is no limit to your imagination. We know that Maple may seem rather inaccessible in the beginning: that’s why we wrote this manual. But don’t let that put you off: we are convinced that a vast majority of you will appreciate its opportunities in the end. Erik W. Thomassen, industrial design engineer. Page 2
    • Maple – A general purpose computer algebra system MapleDoc, IO, TU Delft In April 2008, Maplesoft™ celebrated twenty years of being a corporation. Its core intellectual property, Maple™, was developed as an advanced research project at the University of Waterloo, Canada, in the early 1980s. It is currently a private company, with headquarters in Waterloo, Ontario, Canada. Maple is one of the leading general-purpose commercial computer algebra system and widely used in engineering, science, and mathematics. Maplesoft’s customers include Ford, BMW, Bosch, Boeing, NASA, Canadian Space Agency, Canon, Motorola, Microsoft Research, Bloomberg, and DreamWorks, covering sectors such as automotive, aerospace, electronics, defense, energy, financial services, consumer products and entertainment. Over 90% of advanced research institutions and universities worldwide, including MIT, Stanford, Oxford, the NASA Jet Propulsion Laboratory and the U.S. Department of Energy, have adopted Maplesoft solutions to enhance their education and research activities. Maple ≈ Canada? The architecture of Maple is based around a small kernel, written in C, which provides the Maple language. Besides this kernel, many numerical libraries, such as NAG, etc. are used. The standard interface and calculator interface are written in Java. The classic interface is written in C. Maple is cross-platform software. The current version is Maple 17, which was released in March 2013. Maple 16: The starting window Page 3
    • Install Maple on your computer MapleDoc, IO, TU Delft Connected to TU Delft network (use VPN at home) Blackboard->Software-> Maple Single user license installation Purchase code: QR3N8D79YHUUEE92 Preparation Download Installation Activation Check OS of your computer Windows: XP, Vista, 7; 32 or 64 bit Mac: OS version > OS 10.5 Check memory & free space on hard disk: Memory >=2G, HD>=2G Page 5
    • The Maple interface & Important shortcuts MapleDoc, IO, TU Delft Enclose current work in a sub section Print Preview Print Save Remove current section Execute the whole Maple sheet Execute the selected work groups Insert Maple commands after Insert plain text after Fonts & Mode New file Open Maple tools The working area Dynamic help Time used to execute the commands System status Memory usage Mode at the cursor position: Math mode or Text mode Page 6
    • Hallo, Maple MapleDoc, IO, TU Delft 15KM Problems Tom drives a lorry from Delft to Rotterdam (15KM distance) at a speed of 80 km/hour. How long it will take him to reach Rotterdam. 80 KM/Hour Delft Hand writing Lorry Rotterdam Hand writing vs Maple Find a blank paper The distance between Delft and Rotterdam is: dis  15 ( km) The speed of the lorry is: v  80 ( km / h) The time needed is: t  dis 15   0.1875 ( h) v 80 Convert hours to minutes minutes = t × 60 = 0.1875 × 60 = 11. 25 (minutes) Page 7
    • General guidelines in creating a Maple file MapleDoc, IO, TU Delft Page 8
    • Document mode & Worksheet mode MapleDoc, IO, TU Delft In Maple, you can work with either Document mode or Worksheet mode. Both provide different ways how to get required results. You can use any of them at your convenience, and of course, switch between them during your work. Document mode can create interactive documents, and it focuses on What You See Is What You Get (WYSIWYG). Document mode Worksheet mode is Maple´s traditional environment and all commands start with a red [>. For the sake of a clear syntax structure, worksheet mode is used here. In the following two figures, an Ordinary Differential Equation (ODE) is solved in the two modes, respectively. We strongly recommend worksheet mode Worksheet mode Tips & tricks in Maple Clear the memory: Using restart when each section starts Page 9
    • Commands frequently used in Maple All Maple commands should end with a semi-colon “;” or a colon“:”. If ended with a “:”, the system will hide the response. To define a variable, use” := ”; the “ = ” sets up an equation. The evalf command is used to evaluate a symbolic expression numerically to n digits accuracy. [>evalf(Pi,8); 3.1415926 The expand command may be used to expand an algebraic expression. [>expand((x+2)^3); x3+6x2+12x+8 The simplify command may be used to simplify complicated expressions. [>simplify( (x+3)^3 - (x-3)^3 ) 12x2+16 The subs commands may be used to make a substitution, [>f:=x^3+2*x + 7; subs( x=x^2, f); x6 + 2x2 + 7 MapleDoc, IO, TU Delft The diff command is used to compute the (partial) derivative of a function. [>diff(sin(Pi*x), x); cos(πx)π The int command can be used to calculate the indefinite or definite integral. [>f:=2x; int(f, x) ; x2 To compute the definite integral, use [>f:=2x; int(f, x = a..b) ; b2-a2 Commands solve, fsolve can be used to solve an equation or set of equations for a variable or set of variables. The fsolve command solves the equations numerically for real solutions, whereas solve may give complex numbers as solutions. [>solve( {x-y=3, 3*x-2*y=-1}, {x,y}) The plot command may be used to plot simple graphs, [>plot( x^3, x=-3..3); Page 10
    • Time from Delft to Rotterdam clean the memory > > distances > (1.1) > speed > (1.2) > time > (1.3) > change time from hours to minutes > (1.4) > conclusion: it will take Tom 11.25 minutes
    • Do NOT use document mode DO NOT 15 (1.1) 80 (1.2) 3 16 (1.3) Write eqautions always behind a red arrow by click "[>" button > (1.4) > (1.5) > (1.6) > Reason: A hybrid text and equations is a confusion Do use restart in the begining DO NOT Question x: > Do use restart in the begining Question x:
    • > > Reason: The restart clear the memory of the Maple, it looks like you use a white paper in the begining of the calculation Do NOT use super & sub-script unless you are sure DONOT > (3.1) > Use it in this way > (3.2) > Reason: a small blank in the super and sub-script is hard to find Do NOT use graphical input unless you are sure DO NOT > 7 3 (4.1) > (4.2) Use > 7 3 (4.3) > (4.4)
    • Reason: Graphical input may contain unknown blanks, which will ruin the command Do use sections to make the content clear DO NOT Question 1 explanations..... > (5.1) > explanations..... Question 2 explanations..... > (5.2) > explanations..... Use sections as here by click the "Enclose the selctions in a section button" Question 1 explanations..... > (5.1.1) > explanations..... Question 2 explanations..... > (5.2.1) > explanations..... Reason: Here it is much clear
    • Case Study 1: Analytical Solution of an ODE MapleDoc, IO, TU Delft Question: Given an object with mass m (1kg) on a slope with angle (30). What is the speed of the object after travelling a distance s (1.5m)? Suppose the friction coefficient f is 0.2 and the initial speed is 0. F s mg θ Page 12
    • Case Study 2: Numerical Solution of an ODE MapleDoc, IO, TU Delft Many differential equations cannot be solved analytically, in which case we have to satisfy ourselves with an approximation of the solution. In Maple, a numerical solution of an ODE can be done by the dsolve function. In this section, we solve the same question as in Case Study 1, but now in a numerical way. The initial steps “Identify the problem” and “Modeling” are identical, so we move to the next step: F s Same as previous question mg θ Question: Given an object with mass m (1kg) on a slope with angle (30). What is the speed of the object after travelling a distance s (1.5m)? Suppose the friction coefficient f is 0.2 and the initial speed is 0. Page 13
    • Read & Write Data MapleDoc, IO, TU Delft In many cases, it is needed to exchange data between Maple and other software. In this section, we demonstrate (a) how to export Maple data to a text file and analyze it via Excel; and (b) how to load external data to Maple. (Case study 2) Attention: For some computers, a file name is “D:data.txt”. In many other cases, please use “D:data.txt”, where and extra “” is needed. in Excel, read the text file and use Space as delimiter, the series of data are plotted as: Load external text file to maple is quite similar, an example can be found in the following. Page 16
    • Procedure MapleDoc, IO, TU Delft A procedure is a set of actions to be performed on a set of variables. Just like “brush your teeth” is a procedure, implying a sequence of actions. According to Maple Help, a procedure definition is a valid expression that can be assigned to a name. That name may then be used to refer to the procedure in order to invoke it in a function call.) The parenthesized parameter sequence (which may be empty), specifies the names and optionally the types and default values of the procedure's parameters. In its simplest form, the parameter sequence is just a commaseparated list of symbols (‘arguments’) which may be referred to within the procedure. More complex parameter declarations are possible in the parameter sequence, including the ability to declare the type that each argument must have, default values for each parameter, evaluation rules for arguments, dependencies between parameters, and a limit on the number of arguments that may be passed. Also good to know: variables which are only defined within a procedure are called local variables. The arguments are considered input: the output is seen as returned value (“return”). Not too difficult. The power of a proc however is shown in automating a tedious, repetitive task: This may be off topic, but do you know the elegant solution without Maple or even paper? Page 17
    • MapleDoc: Case Study 3: Using procedure - Same question as Case Study 1 Define the proc > > Test the proc Feed proc with its respective input values: m = 1.5, theta = 30 degrees, f =0.2 > 0.9678542184 > (3.1)
    • MapleDoc: Case Study 4 - 1-Dimensional Senstivity analysis Define the proc > > Relation between angle and travel time m = 1.5, f =0.2, Angle ranges from 25 to 90 degrees > > > > >
    • Define the proc for a 3D plot (2 variables) > > Relation between angle and travel time - 3D Plot m = 1.5, f =0.2, Angle Range of angle 1 to 60 > >