{VERSION 2 3 "APPLE_PPC_MAC" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 } {CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE " " -1 256 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 3 3 0 0 0 0 0 0 -1 0 }{PSTYLE "H eading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 4 4 0 0 0 0 0 0 -1 0 } {PSTYLE "Bullet Item" 0 15 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 3 3 0 0 0 0 0 0 15 2 }{PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }{PSTYLE "Author" 0 19 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 8 8 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 22 "Working with Maple V.4" } }}{EXCHG {PARA 19 "" 0 "" {TEXT -1 61 "Version: 9 Sep 96\nŠ Esben Slot h Andersen, esa@business.auc.dk" }}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 17 "Table of contents" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 136 "Here is \+ a table of contents that - if the worksheet is copied correctly - will function as hyperlinks to the individual sections.\n\n " } {HYPERLNK 17 "Introduction to Maple" 1 "" "Introduction" }{TEXT -1 11 " \n " }{HYPERLNK 17 "Maple as a calculator" 1 "" "Calculator " }{TEXT -1 8 " \n " }{HYPERLNK 17 "Maple as a calculator with na med memory cells" 1 "" "NamedCells" }{TEXT -1 8 " \n " } {HYPERLNK 17 "Maple as an algebra machine" 1 "" "Algebra" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Maple as a graphical machine" 1 "" "Graphic al" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Maple as an equation solver " 1 "" "EquationSolver" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Some da ta structures in Maple" 1 "" "DataStructures" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Saving and reading of files" 1 "" "Files" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Creating and using procedures" 1 "" "Procedu res" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Differential equations in \+ Maple" 1 "" "DifferentialEquations" }{TEXT -1 8 " \n " } {HYPERLNK 17 "Graph theory with Maple" 1 "" "GraphTheory" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Creating, saving and reading packages of pr ocedures" 1 "" "Packages" }{TEXT -1 8 " \n " }{HYPERLNK 17 "Creat ing and using Maple worksheets" 1 "" "Worksheets" }{TEXT -1 8 " \n \+ " }{HYPERLNK 17 "References" 1 "" "References" }{TEXT -1 8 " \n \+ " }{HYPERLNK 17 "Endnotes" 1 "" "Endnotes" }{TEXT -1 3 " \n" }}}} {SECT 0 {PARA 3 "" 0 "Introduction" {TEXT -1 21 "Introduction to Maple " }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 323 "Maple is primarily a very str ong system for doing computer algebra (or symbolic mathematics), but i t also supports numerical analysis and graphical presentations. Furthe rmore, Maple V.4's worksheet interface can be used for producing techn ical documents that integrates text, mathematical symbols, graphics an d hyperlinks. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 631 "These differen t functions of the Maple package means that it can be compared with se veral other products. It has some of the facilities of an equation edi tor, but it can also solve surprisingly many types of equations. It ca n draw a graph of a set of results, but it can also recalculate the un derlying function or procedure with new parameters. It can be accesses through individual commands, but you can also create, save and reload procedures that gradually expands the facilities of the system. In ot her words, Maple is a versalite system for solving problems that to so me extent relies on mathematics and computer programming:" }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 106 "Maple is an interpreted (immediate-mode ) language like BASIC or LISP. You write a command, press [" } {HYPERLNK 17 "Endnote 1" 1 "" "1." }{TEXT -1 76 "], and then Maple per forms the required task (if it is specified correctly)." }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 401 "Maple is an extensible language. You ar e, so to say, adding a new word to the vocabulary of Maple each time y ou define a procedure. This procedure can be used in your next command . The procedure can even be used for defining other procedures; these \+ second-level procedures can be used for defining a third layer of proc edures, and so on. You can even define a procedure in terms of itself \+ (recursion)." }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 303 "Maple is an evo lving program to which many mathematicians and scientists have contrib uted. The background for this is Maple's extensibility. New packages a re gradually being included, and better algorithms substitute old ones . This means that newer versions of Maple is not exactly the same as o ld one [" }{HYPERLNK 17 "Endnote 2" 1 "" "2." }{TEXT -1 2 "]." }}} {EXCHG {PARA 15 "" 0 "" {TEXT -1 286 "Maple provides a worksheet envir onment that integrates commands to Maple's mathematical engine with th e results (text or graphics) and with your comments to both the comman ds and the output. The present document is an example of how to use Ma ple worksheets (read more in the section on " }{HYPERLNK 17 "Worksheet s" 1 "" "Worksheets" }{TEXT -1 2 ")." }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 369 "Maple is allows symbolic mathematics. It is built to wor k with algebraic expressions, and this is not only an advantage for de aling with mathematical expressions. Even when you program, you often \+ want to postpone the precise specification of a part of the program. M aple helps by treating many undefined elements of the program as symbo ls that may later obtain a value." }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 150 "Maple provides detailed facilities for manipulating graphics ( although you should turn to e.g. Excel if you want to produce piechart s and histograms)." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 639 "There is a nother mathematics package that works more or less like Maple (Wolfram 's Mathematica). However, when you work in an environment (like Aalbor g University) where a Maple V.4 site licence allows everyone to use th e program freely, there is little choice. Furthermore, mathematicians \+ seem to prefer Maple because they can inspect and modify nearly all of Maple's procedures. This means that the Maple package is not only the result of its originator: the Symbolic Computation Group at the Unive rsity of Waterloo, Canada. Especially Maple's very large library of pr ocedures and functions is also the outcome of a collective endeavour. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 566 "The choice of Maple is in no way based in its simple computational efficiency. Maple simulation mo dels with many numerical calculations runs at least 50 times slower th an similar models programmed in C. However, it should be noted that ma ny more problems and much more time relate to the understanding and re vision of programs than to running them on a computer. Furthermore, wh en a prototype is running without bugs and in an well-defined manner, \+ then experts can translate it to e.g. C. The transformation to the ob ject-oriented paradigm of C++ is more difficult." }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 398 "With respect to economics teaching and the develo pment of complex model prototypes Maple appears to be a good choice. B ut there are significant barrier to enter the Maple community. The pre sent worksheets try to demonstrate the increased power obtainable thro ugh experimental mathematics and computer modelling. Thus they indicat e that the effort needed to overcome the obstacles is well justified. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 226 " The present worksheet gives the necessary acquaintance with Maple needeed for using and (slightly ) modifying a set of worksheets on evolutionary modelling for economis ts. The topics covers are listed in the table of contents." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 229 "NOTE: As always in Maple worksheets, you should make sure that the cursor is placed in the (red) Maple input ( in the next section). When you press , Maple will perform the r equired task (if it setup is made correctly, see " }{HYPERLNK 17 "Endn ote 1" 1 "" "1." }{TEXT -1 223 "). Then there will normally be printed (blue) Maple output, and the cursor will jump to the next Maple input . Thus you can again press when you have tried to figure out w hat has happened and what is about to happen." }}}}{SECT 0 {PARA 3 "" 0 "Calculator" {TEXT -1 21 "Maple as a calculator" }}{EXCHG {PARA 0 " " 0 "" {TEXT -1 34 "We begin our Maple session with a " }{XPPEDIT 18 0 "restart" "I(restartG6\"" }{TEXT -1 157 " which means that all exist ing results in Maple's memory are deleted (this is important to avoid \+ potential confusion if you have already made some commands)." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 12 "If we write " }{XPPEDIT 18 0 "5+5" ",&\"\"&\"\"\"F #F$" }{TEXT -1 307 " in an input field (e.g. marked with red text) and press , Maple consider it as an incomplete command (to add 5 t o 5 and display the result). The command is incomplete because Maple e xecutes statements or commands that must end with a semicolon. The sta ment can run over several lines (see, however, " }{HYPERLNK 17 "Endnot e 1" 1 "" "1." }{TEXT -1 4 "). " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "5 + 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "5 \+ - 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "5*5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "5^5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "3125/5" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 201 " Oops! We forgot a semicolon. Put the cursor after 5, then type semicol on and press . Now the cursor should have jumped to the next in put field, and you can continue reading and pressing ." }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 320 "Maple is designed by mathematicia ns who do not like to be imprecise. A rational number is kept like tha t unless the user asks the program to treat it (evaluate it) as an (im precise) floating-point number with decimals. The user can specify the number of actual digits of the floating-point number (default is 10 d igits)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "5/10;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "5/8;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "evalf(5/10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "evalf(5/10,2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "eva lf(5/8,2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "evalf(25/8,2) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "evalf(1111111/10,2); # very imprecise!" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "27^(1/2) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "evalf(27^(1/2),4);" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "5!;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "25!;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "125!;" }}}}{SECT 0 {PARA 3 "" 0 "NamedCells" {TEXT -1 45 "Maple as a \+ calculator with named memory cells" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 135 "To simplify the treatment of complicated numerical expressions we create short names (abstractions) for their compoments. For instance: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "a1 := 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "a2 := 5^5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "a3 := 10!;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "a4 := a3/(a1*a2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "a5 := ln(a4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "evalf(a5,3);" }}}}{SECT 0 {PARA 3 "" 0 "Algebra" {TEXT -1 27 " Maple as an algebra machine" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 122 "Ma ple is not primarily designed for numerical calculations. Instead it h as the ability of treating symbols systematically." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "a + b;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "2*x^2 - 24*x - 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "x^2 - 2*x + 5;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 112 "In Maple we can eaily create short names (abstractions) for such \+ functions. This can be done in arrow notation. " }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 33 "c_arrow := x -> 2*x^2 - 24*x - 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "c_arrow(5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 139 "We shall not use the arrow notation much in these w orksheets (it is only for simple cases). Instead we shall give a funct ion a simple name:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "c := \+ 2*x^2 - 24*x - 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "d := x ^2 - 4*x + 3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "e := (x*d) ^(1/2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "When we know the numer ical value of " }{XPPEDIT 18 0 "x" "I\"xG6\"" }{TEXT -1 109 ", we also know the numerical value of the expressions. For instance, we look fo r the values of the functions " }{XPPEDIT 18 0 "c" "I\"cG6\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "d" "I\"dG6\"" }{TEXT -1 5 " for " } {XPPEDIT 18 0 "x=5" "/%\"xG\"\"&" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x := 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "c;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "d;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "The problem with Maple is that the value \+ of a variable (e.g. " }{XPPEDIT 18 0 "x" "I\"xG6\"" }{TEXT -1 151 ") i s remembered. So if we move the cursor backwards in the worksheet, the n the output is different compared with the situation before the assig nmenmt (" }{XPPEDIT 18 0 "x := 5" ">%\"xG\"\"&" }{TEXT -1 21 "). We ha ve to make a " }{XPPEDIT 18 0 "restart" "I(restartG6\"" }{TEXT -1 89 " (as we did in the beginning of this worksheet) or we can make an expl icit unassignment (" }{XPPEDIT 18 0 "x := 'x'" ">%\"xG.F#" }{TEXT -1 2 ")." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "c;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "x := 'x';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "c;" }}}}{SECT 0 {PARA 3 "" 0 "Graphical" {TEXT -1 28 "Maple as a graphical machine" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "We can also get a plot of the functions we have just defined." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "plot(c, x=-10..30, title = ` Plot of c(x)`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "plot(d,x =-3..10, title = `Plot of d(x) = x^2 - 4*x + 3`);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 55 "plot([c,d], x=-5..30, title = `Plot of c(x) \+ and d(x)`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 105 "We can also plot \+ series of related functions. Let us consider a simple Cobb-Douglas pro duction function (" }{XPPEDIT 18 0 "Q=A*K^a*L^(1-a)" "/%\"QG*(%\"AG\" \"\")%\"KG%\"aGF&)%\"LG,&F&F&F)!\"\"F&" }{TEXT -1 250 "). First we mak e a three-dimentional plot of for a given A and a given a. The specifi cation of the Cobb-Douglas function is easy. However, the plot definit ion is rather complex, so do not think too much about it. Instead you \+ can consider the outcome." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "Q := A*K^a*L^(1-a);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 136 "A :=1; a:=.5; plot3d(Q,K=0..10,L=0..10, axes=BOXED, orientation=[-120 ,40], style=PATCHCONTOUR, colour=Q, title=`Cobb-Douglas plot # 1`);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 169 "If we project the contour lines of the \"production mountain\" into the K-L plane, we have the normal way of depicting a Cobb-Douglas function. By changing the values for \+ " }{XPPEDIT 18 0 "A" "I\"AG6\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "a " "I\"aG6\"" }{TEXT -1 122 " in the above command (red text) and press ing , we can consider the consequences for the form of the func tion plot." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 406 "It is possible to \+ look at the production mountain from different angles. To do so, selec t the plot, keep pressing the mouse while over one of the corners of t he box, and rotate the box with the mouse pressed. Finally, you have t o select the button: \"redraw the plot\". This reorientation of the pl ot can be done in a way so that we obtain a normal two-dimentional plo t of isoquants, i.e. curves defined by " }{XPPEDIT 18 0 "Q(K,L)=Q[0] " "/-%\"QG6$%\"KG%\"LG&F$6#\"\"!" }{TEXT -1 21 ". Let us have a look: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 133 "A :=1; a:=.5; plot3d(Q ,K=0..10,L=0..10, axes=BOX, orientation=[-90,0], style=PATCHCONTOUR, c olour=Q, \ntitle=`Cobb-Douglas plot # 2`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 208 "To check that we still have a three-dimentional picture, you can try to move the box around the figure. But we may also look f or a more standard presentation of the isoquants. To create some varia tion we set " }{XPPEDIT 18 0 "a=.3" "/%\"aG$\"\"$!\"\"" }{TEXT -1 1 ". " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 134 "A :=1; a:=.3; plot3d(Q ,K=0..10,L=0..10, axes=NORMAL, orientation=[-90,0], style=CONTOUR, col our=black, title=`Cobb-Douglas plot # 3`);" }}}}{SECT 0 {PARA 3 "" 0 " EquationSolver" {TEXT -1 27 "Maple as an equation solver" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 65 "If we look a little back and consider the plots of the functions " }{XPPEDIT 18 0 "c(x)" "-%\"cG6#%\"xG" } {TEXT -1 5 " and " }{XPPEDIT 18 0 "d(x)" "-%\"dG6#%\"xG" }{TEXT -1 187 ", we can approximately see the solutions to the functions. Howeve r, we can also solve them explicitly. The solutions are listed after e ach other. In the first case (with two solutions to " }{XPPEDIT 18 0 " c" "I\"cG6\"" }{TEXT -1 162 ") the solutions are difficult to interpre t in relation to the graph (because Maple upholds the procese solution s). Therefore, we ask for a floating point version." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "c1 := solve(c = 0, x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "evalf(c1,4);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 22 "d1 := solve(d = 0, x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 75 "We can also find precisely where the two functions are eq ual to each other:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "cd1 : = solve(c = d, x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalf (cd1,4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 238 "Maple's equation-sol ving facilities are also relevant to the analysis of Cobb-Douglas func tions. We shall only consider the standard issue of deriving marginal \+ products of capital and labour from the already defined Cobb-Douglas f unction " }{XPPEDIT 18 0 "Q" "I\"QG6\"" }{TEXT -1 63 ". To obtain the \+ general solutions we have to remember to reset " }{XPPEDIT 18 0 "A" "I \"AG6\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "a" "I\"aG6\"" }{TEXT -1 19 " , and the function " }{XPPEDIT 18 0 "Q" "I\"QG6\"" }{TEXT -1 1 "." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "A := 'A': a := 'a': Q := 'Q' :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "Q := A*K^a*L^(1-a);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "MP[K] := diff(Q,K);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "MP[L] := diff(Q,L);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "Before we can consider other facil ities of equation solving (like " }{HYPERLNK 17 "differential equation s" 1 "" "DifferentialEquations" }{TEXT -1 49 "), we shall consider som e other aspects of Maple." }}}}{SECT 0 {PARA 3 "" 0 "DataStructures" {TEXT -1 29 "Some data structures in Maple" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 333 "To get Maple to perform more complex tasks, we need data structures. Let us start with ordered sequences and lists and unorder ed sets. Remark that Maple distinguishes between small letters and cap ital letters. Remark also that variables do not have to be declared be fore they are used (in contrast to e.g. Pascal and C++). Variables " } {TEXT 261 3 "can" }{TEXT -1 108 " be declared explicitly,but they can \+ also be implicitly declared by their first use (like in BASIC or LISP) ." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "Sequence := a,b,1,2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "Sequence[1];" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 15 "Sequence[1..3];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "list := [a,b,c,1,2,3,a,2];" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 117 "Oops! We used a name that is reserved for Maple expres sions. However, Maple will accept the name with a small change." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "List := [a,b,c,1,2,3,a,2];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "List[1];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "List[2..5];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "List[8];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "nops(List); # Number of list elements" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "Set1 := \{a,b,d,1,2,3,a,2\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "Set2 := \{a,b,c,d,e\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "Set1 union Set2; # Set theoretic union" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "Set1 minus Set2; # Set theo retic difference" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 248 "We now turn \+ to the potentially very complex tables. We start by considering the in clusion of simple elements and retrival of their values. To make thing s somewhat clearer we start by declaring the table (even though this i s not necessary in Maple)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "Table := table(); # We create the table" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "Table[1] := 1; # We store a value" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "Table[2] := 4; # We store another value" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "Table[2]; # We \+ retrieve a value" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "Now we fill o ut the table. It is done by a loop that runs from 3 to 10. Remember th e " }{XPPEDIT 18 0 "do" "?(6\"\"\"\"F$F#%%trueGF#" }{TEXT -1 37 " pare nthesis around the statement(s)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "for i from 3 to 10 do\nTable[i] := i^2;\nod;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "Table[9];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "for i from 1 to 10 do\nprint(Table[i]);\nod ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 100 "The table we have under con struction can also include quite different kinds of indexes and elemen ts:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "Table[1,1] := Yawn; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "Table[1,1];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "Table[Nelwin,2,8] := Interesting;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "Table[1,1] <> Table[Nelwi n,2,8];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "print(Table);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 111 "If we try to access an element \+ of the table that has not yet been created, we receive an echo of our \+ statement:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "Table[Nelwin, 1,1];" }}}}{SECT 0 {PARA 3 "" 0 "Files" {TEXT -1 24 "Saving and readin g files" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 309 "File names depend on t he individual operation systems as does the directory in which user fi les should be placed. Since the present worksheet is intended to be us ed on different platforms, we shall only say little about files. Howev er, here are a few ideas (others are mentioned in the section on proce dures)." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 114 "One important task is to save your results. Maybe a complex computation have created a huge number of elements in " }{XPPEDIT 18 0 "Table" "I&TableG6\"" }{TEXT -1 270 ". We have found out what is the pathname and filename. Now we \+ want to save the table. (To avoid the wrong statements to be performed , all statements are written as \"comments\" that are ignored by Maple . To perform some of them, we have to remove the comment markers (#).) " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "To save the file on the hardd isk of a Power Macintosh we e.g. write:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "# save Table,\n# `MacintoshHD:MapleVR4:Modelling:Tabl e.m`;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "Later we can retrieve th e " }{XPPEDIT 18 0 "Table" "I&TableG6\"" }{TEXT -1 21 " and its elemen ts by:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "# read\n# `Macint oshHD:MapleVR4:Modelling:Table.m`;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "# Table[9];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "A lternatively we can use a Windows system and save on a discette by:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "# save Table, `xxxxxxx:Tab le.m`;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "# read `xxxxxxx:T able.m`;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "# Table[9];" }} }}{SECT 0 {PARA 3 "" 0 "Procedures" {TEXT -1 29 "Creating and using pr ocedures" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 180 "Maple statements can \+ be collected into procedures. Such procedures are first defined. Later they can be called whenever it is relevant. We shall start with a ver y simple procedure." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "hell o := proc()\nprint(`Important information on Maple procedures.`);\nend ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "hello();" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 451 "We see that after the procedure has been defined, it can be called by its name followed by a pair of parenthes es. We also see that Maple echo our definition of the procedure with t he formatted procedure text. To avoid this echo we shall in the follow ing finish definitions with a colon instead of a semicolon. The proced ure can easily be extended, especially if we give it an input (an argu ment). We also specify the data type of acceptable inputs (a " } {XPPEDIT 18 0 "name" "I%nameG%*protectedG" }{TEXT -1 49 " as it is def ined in Maple, e.g. with no blanks)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 159 "hello := proc(onename::name)\n\n# This procedure req uires the input of a\n# single name\n\nprint(onename,`here is importan t information on Maple procedures.`);\nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "hello(Esben);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "hello(117);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 275 " Let us now make a couple of somewhat more complex procedures. First, w e make a procedure that takes the two functions we have earlier plotte d. For any argument the procedure selects the value of the function th at is largest. The procedure introduces the selection statement (" } {XPPEDIT 18 0 "if c>d then else" "@%2%\"dG%\"cG6\"F&" }{TEXT -1 2 "). " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 106 "biggest := proc(x)\nlo cal c,d;\nc := 2*x^2 - 24*x - 5;\nd := x^2 - 4*x + 3;\nif d < c then c ;\nelse d;\nfi;\nend:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 393 "Oops! W e forgot that Maple distinguishes between global variables and variabl es that are local to a procedure. No variable in the procedure is supp osed to be globally available, so we can just accept Maple's warning. \+ However, it is useful to be explicit about the availability of variabl es (we might avoid much confusion later). Therefore, we rewrite the pr ocedure (including a little layout)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 109 "biggest := proc(x)\nlocal c,d;\n\nc := 2*x^2 - 24*x \+ - 5;\nd := x^2 - 4*x + 3;\n\nif d < c then c;\nelse d;\nfi;\n\nend:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "biggest(0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "biggest(5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 259 "We now write a plotting procedure. It takes as inpu t a function of one variable and a range for plotting. It prints a plo t of the function in the given range, together with a title of the plo t. In the procedure we include type checking of the second argument." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 409 "biggestplot := proc(inte rval::range)\n\nlocal header,start,finish,plotpoints, x;\n\n# This fun ction takes two inputs:\n# a name of a function with one argument\n# a nd a plot interval (like 25..100).\n# Outputs is a graph of the functi on.\n\nheader := cat(`Plot of \"biggest\"`);\nstart := lhs(interval); \nfinish := rhs(interval);\nplotpoints := seq([x,biggest(x)],x=start.. finish);\nplot([plotpoints], title = header);\n\nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "biggestplot(-3..24);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "We shall also define a " }{XPPEDIT 18 0 " CoDo" "I%CoDoG6\"" }{TEXT -1 58 " procedure for plotting Cobb-Douglas \+ production functions:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 289 "C oDo := proc(A,a)\nlocal Q;\n\n# This procedure takes two arguments:\n# A and a from the function A*K^a*L^(1-a)\n\nQ := A*K^a*L^(1-a);\n\npri nt(`A is`,A, ` a is`, a);\nplot3d(Q,K=0..10,L=0..10, axes=BOXED, orie ntation=[-120,40], style=PATCHCONTOUR, colour=Q, title=cat(`Cobb-Dougl as plot`));\n\nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "CoDo (1,.3);" }}}}{SECT 0 {PARA 3 "" 0 "DifferentialEquations" {TEXT -1 33 "Differential equations with Maple" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 53 "Let us take a simple differential equation like\n " }{XPPEDIT 18 0 "diff(y,t) = -2+t+y" "/-%%diffG6$%\"yG%\"tG,(\"\"#!\"\"F'\"\"\"F& F+" }{TEXT -1 35 "\nWe start by writing this equation:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "deq := diff(y(t),t) = - 2 + t - y(t );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 144 "We consider some graphical and analytical tools for treating exploring this equation. The graphi cal tools are provided by the following command." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(DEtools):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 99 "Given these tools we can make a plot indicating the direc tion field for the differential equation. " }{XPPEDIT 18 0 "t" "I\"tG6 \"" }{TEXT -1 40 " is measured at the horizontal axis and " }{XPPEDIT 18 0 "y(t)" "-%\"yG6#%\"tG" }{TEXT -1 22 " at the vertical axis." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "DEplot(deq,[y(t)], t=0..4, y =-1..1, \ntitle = `Direction field for deq`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 284 "Let us now consider how a trajectory in the direction field will look like. Let us start at the origin (0,0). The arrows in dicates that the movement will first be towards south-east, then east \+ and finally north-east. That this interpretation is correct can be see n from the next plot." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 84 "DE plot(deq,[y(t)], t=0..4, [[0,0]], y=-1..1,\ntitle=`Trajectory of deq, \+ init=(0,0)`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "We can also cons ider a family of trajectories by giving Maple a list of initial points :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 135 "DEplot(deq,[y(t)], t= 0..4,\n[[0,-1],[0,-.5],[0,0],[0,.5],[0,1]],\ny=-1.5..1, linecolour=t, \+ dirgrid=[15,15],\ntitle=`Trajectories of deq`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 "We now turn to the analytical solution of our diffe rential equation. Here we have a standard Maple command (" }{XPPEDIT 18 0 "dsolve" "I'dsolveG%*protectedG" }{TEXT -1 79 "). First we find t he general solution (with the arbitrary initial value called " } {XPPEDIT 18 0 "_Cl" "I$_ClG6\"" }{TEXT -1 58 ") which is placed after \+ the expression that it multiplies:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "dsolve(deq, y(t));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Given an initial value, we can find a specific solution to " } {XPPEDIT 18 0 "deq" "I$deqG6\"" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 39 "spec_sol := dsolve([deq,y(0)=0], y(t));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "This specific solution is itself a n equation that gives the value of " }{XPPEDIT 18 0 "y(t)" "-%\"yG6#% \"tG" }{TEXT -1 18 " for any value of " }{XPPEDIT 18 0 "t" "I\"tG6\"" }{TEXT -1 201 ". We transform the solution to a Maple procedure and ck ecks it with a couple of arguments. The procedure is a bit tricky, so \+ we better forget its details at the moment. The result is, however, co rrect." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 129 "sdeq := proc(tim e)\nlocal f,result,floatresult;\nf := rhs(spec_sol);\nresult := subs(t =time,f);\nfloatresult := evalf(result,2);\nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "sdeq(0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "sdeq(1); sdeq(2); sdeq(3); sdeq(4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "We end by plotting the solution function for t he initial value (0,0) without the direction field arrows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "plot(sdeq(t), t=0..5, y=-1..2,\ntit le=`Solution curve, init=(0,0)`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 504 "This figure is based on the analycal solution of our differential equation. Thus it is precise (except for the floating-point evaluatio n which can howver, be improved tas far as our comput resources permit ). On the other hand, the same curve in the earlier graphs was produce d by means of a numerical calculations applied directly to the differe ntial equation before we knew the analytical solution. However, many d ifferential equations have no analytical solutions. For them we need c omputer simulation." }}}}{SECT 0 {PARA 3 "" 0 "GraphTheory" {TEXT -1 23 "Graph theory with Maple" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 225 "We now move from continuous to discrete mathematics. The example is grap h theory. For instance, we want to explore tools for a formal represen tation of the structure and evolution of production trees and industri al networks. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "When dealing wit h graphs, we start from a set of " }{XPPEDIT 18 0 "N" "I\"NG6\"" } {TEXT -1 48 " different elements called nodes (or vertices), " } {XPPEDIT 18 0 "V" "I\"VG6\"" }{TEXT -1 42 ". To define a graph we also need a set of " }{XPPEDIT 18 0 "K" "I\"KG6\"" }{TEXT -1 48 " differen t elements called branches (or edges), " }{XPPEDIT 18 0 "E" "I\"EG6\" " }{TEXT -1 117 ". A branch is a connection between pairs of nodes. An undirected branch is characterised by a set of two nodes, e.g. " } {XPPEDIT 18 0 "\{a,b\}" "<$%\"aG%\"bG" }{TEXT -1 77 ". A directed bran ch (or arrow) is characterised by a list of two nodes, e.g. " } {XPPEDIT 18 0 "[a,b]" "7$%\"aG%\"bG" }{TEXT -1 83 "; the directed bran ch goes from the first to the second node of the list. A graph, " } {XPPEDIT 18 0 "G" "I\"GG6\"" }{TEXT -1 69 ", is a list consisting of a set of nodes and a set of branches, i.e. " }{XPPEDIT 18 0 "G=[V,E]" " /%\"GG7$%\"VG%\"EG" }{TEXT -1 312 ". A graph can be created by two typ es of assignments: one type (new) gives an empty structure; another ty pe (graph) gives a graph with initial nodes and branches. When a graph has been created, it can be modified by adding or deleting nodes and \+ branches. Furthermore, weights can be given to nodes and branches. " } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "To handle graphs we start by loa ding links to the package " }{XPPEDIT 18 0 "networks" "I)networksG%*pr otectedG" }{TEXT -1 203 ". We start by creating a tree with directed b ranches. (When ordering the networks facilities and creating graphs, r emember to end the commands with a colon - otherwise you will see too \+ much information.)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "with( networks):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "V1 := \{a,b,c ,d\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "E1 := \{[a,b], [a, c]\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "G1 := graph(V1, E1 ):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "draw(Linear([d,a],[c, b]), G1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 257 "The drawing shows a representation of the graph with 4 nodes and 2 branches. The graph ca n also be described in other ways. One method is the adjacency table t hat shows the possibility of coming from one node through another by m eans of a (directed) branch." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "adjacency(G1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 300 "What we \+ have drawn is an example of a tree. A tree is a graph that is connecte d and has no circuit. Trees are created, modified and inspected as gra phs. The drawing also shows an oriented tree. An orientation of a tree is obtained by making one of the nodes the root node of the tree (in \+ the crawing " }{XPPEDIT 18 0 "root=a" "/%%rootG%\"aG" }{TEXT -1 102 ") . Thus the rooted tree is defined by nodes, branches and the root. Let us look at another tree (with " }{XPPEDIT 18 0 "root=0" "/%%rootG\"\" !" }{TEXT -1 2 ")." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "V2 := \{0,1,2,3,4,5,6,7,8\};\011" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "E2 := \{[0,1],[1,2],[1,3],[2,4], \013 [2,5], [3,6],[4,7],[4,8]\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "G2 \+ := graph(V2, E2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "draw(L inear([0],[1],[3,2],[6,5,4],[8,7]), G2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 335 "Another type of graph is created by gradually adding ext ra branches between randomly chosen nodes. Thereby we create an evolvi ng grahp with interesting properties that e.g. have been studied by Ar tificial Life research. In the following we shall study random graphs \+ with 15 nodes. We start by constructing a procedure for this purpose. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 383 "RandGraph :=proc(noden um,branchprob)\nlocal Rgraph,Edges,Components;\n\n# This procedure req uires the number of\n# edges and the probability of a branch.\n# It de livers a plot and informative text.\n\nRgraph := random(nodenum,prob=b ranchprob);\nEdges := nops(edges(Rgraph));\nComponents := nops(compone nts(Rgraph));\n\nprint(`K/N `,Edges/nodenum,` Components `,Components) ; \ndraw(Rgraph);\n\nend:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "The \+ procedure will give information about the " }{XPPEDIT 18 0 "K/N" "*&% \"KG\"\"\"%\"NG!\"\"" }{TEXT -1 405 " relationship as well as the numb er of individual components (single nodes or interconnected nodes) in \+ the graph. Unless you specify the \"seed\" of the ransom-number genera tor, the a call to the procedure will normally give very different res ults. It is the statistical properties of the results that is of inter est. But at present we can only experiment with repeated calls. This r equires a lot of plots [" }{HYPERLNK 17 "Endnote 3" 1 "" "3." }{TEXT -1 2 "]." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "RandGraph(15,0. 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "RandGraph(15,0.1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "RandGraph(15,0.2);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "RandGraph(15,0.3);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "RandGraph(15,0.4);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 371 "One of the issues of the theory o f random graphs is at wheich parameter value there is a very rapid inc rease on the probability of obtaining a single integrated component. I n other words, we want to know how few branches are needed before we c an be almost sure that there is only a single component. The other cas e where all possible connections are drawn is much easier:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "RandGraph(15,1);" }}}}{SECT 0 {PARA 3 "" 0 "Packages" {TEXT -1 51 "Creating, saving and reading pack ages of procedures" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 169 "When we cre ate complex models with a large number of procedures, we may easily fo rget to load one of the procedures into Maple. This problem can be sol ved by creating a " }{XPPEDIT 18 0 "helper" "I'helperG6\"" }{TEXT -1 154 " package of procedures that can be saved as a Maple-format file ( an *.m file). This file can then be loaded as a whole when we start ou r simulation work. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 214 "hel per[calculator] := proc()\nprint(`Maple can be used as a calculator.`) ;\nprint(`Maple does not by itself transform to decimal numbers.`);\np rint(`Write e.g. evalf(5/8, 4); - where 4 is the number of digits.`); \nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 262 "helper[variables ] := proc()\nprint(`A variable has a name that starts with a letter.`) ;\nprint(`The rest of the name can be either letters or numbers.`);\np rint(`No spaces and special characters are allowed.`);\nprint(`Undersc ores are allowed, e.g. Table_27.`);\nend:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 215 "To define a place for the package at the harddisk, we us e a hack that is a little complex and will not necessarily function (i t depends on the setup of Maple). [Remome the #'es if you dare to try \+ out the procedure.]" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 86 "# fi lepath := cat(substring(\n# libname[nops([libname])],1..-4),\n# \+ `Helper.m`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "# save he lper, filepath;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "We have now s aved the package. To be sure that it has disappeared, we restart. Then we look for the package, load it, and (hopefully) find it." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "# restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "# variables();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 86 "# filepath := cat(substring(\n# libname[nops([ libname])],1..-4),\n# `Helper.m`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "# read filepath;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "# with(helper);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "# calculator();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "# variables();" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 305 "These helper texts are very limited. However, Maple has a very ex tensive help system. Either we can browse through the help pages or we can go for a specific topic. Concerning the naming of variables we wr ite \"?name\", press , read the text, close the help window, an d return in our main workshweet." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "?name;" }}}}{SECT 0 {PARA 3 "" 0 "Worksheets" {TEXT -1 35 "Creating and using Maple worksheets" }}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 21 "The worksheet concept" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 341 "Through the experiences relating to the present worksheet much kn owledge about Maple worksheets has already been obtained. Here is a sl ightly more formal exposition of Maple worksheets. This exposition may help you to make your own worksheets (but the exposition does not cov er all the necessary topics (see e.g. Heal et al., 1996, 12-20). " }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 373 "A new worksheet looks like a fil e for a word processor program (like Word or WordPerfect). However, wh en you look at the present worksheet, it is obvious that text processi ng is only one aspect of a worksheet. Text processing takes place in T ext Cells while the writing of input intended for Maple takes place in Input Cells. Finally Maple answers by creating Output Cells." }}}} {SECT 0 {PARA 4 "" 0 "" {TEXT -1 10 "Text Cells" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 377 "Text Cells are not the default for Maple. That the \+ worksheet has not started with a Text Cell is indicated by the Maple i nput prompt in the beginning of the cell (> ). You should not try to d elete this input prompt. Instead you select the menu or type . Now you can write ordinary text. Be aware that Maple can be a bit sluggish for good typists." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 312 "If you are using the same setup as the present auth or, then a will only mean . Therefore, you have to a sk explicitly for a new Cell. This is done by which insert s a new Cell after the Cell in which the cursor is placed. The new cel l is an Input Cell so you change it by ." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 325 "You can format individual words or the whole c ell (by Maple's styles). You can also insert mathematical expressions \+ into the text. The securest way seems to continue a couple of characte rs beyond the place where the mathematical expression should be insert ed, then place the cursor at the precise place and finally click the \+ " }{XPPEDIT 18 0 "Sigma" "I&SigmaG6\"" }{TEXT -1 220 " in the tools li ne of Maple. Now a questionmark is placed in the text and the cursor i s ready in a special Excel-like entry line. Here you write a valid Map le expression and the formatted result is inserted in your text." }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 230 "You may rather easily change the \+ mathematics. Place the cursor in the math text; then place the cursor \+ at the relevant place in the entry line; finally, do the necessary rev isions. Let us have a try. In an equation we want to use " }{XPPEDIT 18 0 "alpha" "I&alphaG6\"" }{TEXT -1 21 " (alpha) instead of " } {XPPEDIT 18 0 "a" "I\"aG6\"" }{TEXT -1 24 ". Here is the equation: " } {XPPEDIT 18 0 "Q=A*K^a*L^(1-a)" "/%\"QG*(%\"AG\"\"\")%\"KG%\"aGF&)%\"L G,&F&F&F)!\"\"F&" }{TEXT -1 280 ". To to change it, mark the expressio n by clicking the cursor in the middle of it [do it now]. Then place t he cursor just after the \"a\" in the entry line. Write \"alpha\" inst ead. Now a Greek alpha is shown in the text. Do similarly with the sec ond \"a\". Now the equation should be: " }{XPPEDIT 18 0 "Q=A*K^alpha*L ^(1-alpha)" "/%\"QG*(%\"AG\"\"\")%\"KG%&alphaGF&)%\"LG,&F&F&F)!\"\"F& " }{TEXT -1 1 "." }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 11 "Input Cells " }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "As mentioned, and Input Cell i s marked with an input prompt. This is an empty Input Cell:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 255 "Input Cells are used for writing \"living\" Maple expres sions. When we press the input is given to Maple's engine. How ever, Maple can only interpret correct statements. If the statement is not correct, we get often get an error message. Here is one:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "a^(1/2;" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 232 "Oops! We forgot the left parenthesis. Sometimes t hings are more difficult. We might even commit a semantic error that i s not recognised by Maple. It will probably be revealed as we go along with our computations. Here is an example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart; Q := A(K*L);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 125 "This looks nice, but it is probably incorrect. Maple con siders the right-hand expression as a call to the undefined function \+ " }{XPPEDIT 18 0 "A" "I\"AG6\"" }{TEXT -1 19 " with the argument " } {XPPEDIT 18 0 "K" "I\"KG6\"" }{TEXT -1 7 " times " }{XPPEDIT 18 0 "L" "I\"LG6\"" }{TEXT -1 41 ". Probably the intension was to multiply " } {XPPEDIT 18 0 "A" "I\"AG6\"" }{TEXT -1 19 " by the product of " } {XPPEDIT 18 0 "K" "I\"KG6\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "L" "I \"LG6\"" }{TEXT -1 71 ". However the latter expression should be writt en in the following way:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 " A*(K*L);" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 12 "Output Cells" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 239 "Output Cells are not produced by \+ the user by by Maple inself. It includes text formatted as you require (e.g. simple text or formatted text). You can copy this text and past e it into your word processor. The result may be unformatted text." }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 198 "Output Cells may also contain Ma ple plots (if you ask Maple to put plots within the worksheet instead \+ of in separate windows). Even plots can be selected, copied and pasted into your word processor." }}}}}{SECT 0 {PARA 3 "" 0 "References" {TEXT -1 10 "References" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Anderse n, E.S. (1996), " }{TEXT 256 56 "Evolutionary Economics: Post-Schumpet erian Contributions" }{TEXT -1 33 ", paperback edn., Pinter, London." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "Friedman, F.L., and Koffman, E. B. (1995), " }{TEXT 257 50 "Problem Solving, Abstraction, and Design U sing C++" }{TEXT -1 32 ", Addison-Wesley, Reading, Mass." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Heal, K.M., Hansen, M.L., and Rickard, K. M. (1996), " }{TEXT 258 22 "Maple V Learning Guide" }{TEXT -1 21 ", Sp ringer, New Your." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 82 "Monagan, M.B ., Geddes, K.O., Heal, K.M., Labahn, G., and Vorkoetter, S.M. (1996), \+ " }{TEXT 259 25 "Maple V Programming Guide" }{TEXT -1 21 ", Springer, \+ New York." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "Redfern, D. (1996), \+ " }{TEXT 260 37 "The Maple Handbook: Maple V Release 4" }{TEXT -1 21 " , Springer, New York." }}}}{SECT 0 {PARA 3 "" 0 "Endnotes" {TEXT -1 8 "Endnotes" }}{EXCHG {PARA 0 "" 0 "1." {TEXT -1 567 "1. There are two s et-ups of Maple. In one setup means \"insert newline characte r\", and means a command to the Maple engine: \"if this is a M aple input, then perform the required task\". In another setup means \"insert a new line\", and means the same as , namely that a command is given to the Maple engine: \"if this i s a Maple input, then perform the required task\". In order to read th e present notes easily, you should secure that your version of Maple h as the first type of setup. Otherwise, you should change the setup." } }}{EXCHG {PARA 0 "" 0 "2." {TEXT -1 500 "2. The differences between th e revisions of Maple are both revolutionary and evolutionary. The work sheet interface is , so to say, a revolutionary change: it will not wo rk at all in Maple V Revision 2. Most of the changes of mathematical e xpressions and programming language found in Maple V Revision 4 are of an evolutionary character. Although they will not work in Maple V Rev ision 3 or Maple V Revision 2, there are still hope: with a little mod ification most of the commands can be made to work." }}}{EXCHG {PARA 0 "" 0 "3." {TEXT -1 154 "3. Maple's plots can easily be resized (e.g. made smaller) by catching the lower right corner of the plot window a nd then drag the window with the mouse. " }}}}}{MARK "2 0 0" 17 } {VIEWOPTS 1 1 0 1 1 1803 }