The easiest way to learn how to program an elasticity problem in Maple is to run one of the test programs such as S521 or S522. To run these programs, paste the text into a file, enter the Maple program and at the `>' prompt, type

read filename;

These files contain the commands for the most common mathematical operations required and are quite easy to adapt to different problems.

Some useful hints are:-

1. Notice that each command line is terminated by `;' or `:'. If you use `;', the result of the calculation will be displayed on the screen. If you use `:' it will still be calculated, but not displayed. This is useful for simplifying the output when a lot of routine algebra is involved.

2. The command


creates a new function f and sets it equal to g. Notice that this uses the symbol `:=' rather than just `='.

3. The command


configures the expression f as a function of x. This has two effects.

(i) It enables you to call for the value of f at a particular value of x. For example g(a) will then be the expression f with x replaced by a. This is obviously useful in imposing boundary conditions.

(ii) It ensures that Maple will treat all other parameters in f as being independent of x. You will find this useful if at any point you get output including derivatives of quantities you want to treat as constants.

4. Another way of obtaining the expression f with x replaced by a is to use the `subs' command:-


More than one substitution can be made at the same time, for example


Notice that the separate substitutions are separated by commas and the complete set is then enclosed in {....}.

5. Once you have given a value to an expression (e.g. x:=a;), Maple will assume that value for all subsequent calculations, including new runs of the code. If you want to change such an assignment, you will need to issue the command


which essentially erases the effect of all previous calculations.

6. The most efficient way to develop a Maple program is to edit it in a text file and then use the `read;' command. For example, if you load S521 into a file called `S521' you will be able to run it in the Maple window by typing

read S521;

You can then edit the file S521 in a text editor and run the new file in the Maple window again with the read command. This is much more efficient than typing the mathematical commands directly in the Maple window.

7. You can also use the `read;' command to call subroutines that are stored in other files. For example, if you want to calculate the displacement components for the problem of S521, you can add the line

read uxy;

into S521 after the final stress function has been calculated, assuming that you have already downloaded uxy into your Maple directory or folder.

8. It is generally acceptable to use self-referential commands like


where the same symbol `phi' appears on both sides of the equation. Such commands essentially just redefine the symbol phi. However, occasionally this usage may cause problems. If in doubt, use a new symbol such as


9. The command `solve' can accept any number of equations and any number of unknowns. If there are too many unknowns, Maple will simply eliminate as many as possible and express the answer in terms of the remaining unknowns. If there are two many equations, it will return a solution if there is one - i.e. if the equations are not linearly independent. This is quite helpful in boundary-value problems, since a straightforward approach to the formulation will often generate redundant conditions.

10. The command `combine(function,trig)' can be used to express a function in Fourier (multiple angle) form. For example, the code



will return the function


This is useful when converting from Cartesian to polar coordinates, as in equation (8.37), prior to using the Michell solution.

11. Finite series solutions can be developed using the `sum' command. For example


will generate the function


12. The numerical value 3.14159... is represented in Maple by the symbol `Pi' (with uppercase `P').

13. The limit of a function can be calculated by using the command


which calculates the limit of g as x->a from below or


which calculates the limit of g as x->a from above.

These commands are useful for computing stress intensity factors, as in equation (13.43).

14. The symbol for infinity is `infinity', as in (e.g.)




15. The command


solves the equation f=0 for the unknown A. Simultaneous equations can be solved for several unknowns by writing


It is not necessary for the number of unknowns to equal the number of equations. However, if there are too many equations, Maple will return a solution only if one exists and hence only if the equations are not independent. The command


has the same effect as solve, but it stores the results in the location 'solution'. This is useful because we can then substitute the results into another expression using the form


If you want to use this option, include the parentheses {} even when there is only one unknown - i.e. write


16. If f is a function of x, you can plot it using the command


which will plot in the range 1< x<2. You can plot several functions f,g,h on the same graph using


The plot command has many options for labelling of axes, font sizes, line thickness etc. which you can find through the help menu.

You can also create contour plots using the command


17. The web site contains Maple files for the tables in Chapters 8,9,19,20 and programs for a wide range of other routine operations in two and three dimensions. For a complete list of these files, with clickable links to the files, go to Catalogue of Maple files.

Back to J.R.Barber, Elasticity