Online help is available for both Maple and Matlab:
To start Maple from an Athena terminal, either start from the dash, or, at the Athena prompt, do
athena% add maple
athena% maple&
Now, wait. Maple, like MATLAB, takes a while to load. Also like
MATLAB, the older versions load and run faster (go figure). To load
an older release, the command is
athena% maple -ver 5r3&
(the commands given here will run on the either release, with the
single exception noted).
If you've downloaded the worksheet, or have your own, you open
these from the File menu item.
Start by telling Maple what you think you want to do. Specifically, enter
assume(n,integer);
This tells Maple that the index n you'll be using is to be
taken as an integer.
Next, define the function you want to analyze. In this case,
there will be two pieces, one for
f1:=z*a/d; f2:=(L-z)*a/(L-d);
Note that the applicable ranges are not given; this will be done when the command to do the integral is invoked. Here goes:
B(n):=int(f1*sin(n*Pi*z/L),z=0..d)+int(f2*sin(n*Pi*z/L),z=d..L);
In the above, note that the range of z is indeed broken
up into two intervals, and the integral that defines
B(n) is the sum of these integrals.
(These notes use B(n) instead of the text's
Am for calculational and historic purposes;
convince yourself that it doesn't matter.)
What you have may look like a mess. To make it look nicer, enter the command
simplify("); in Release 3, or
simplify(%); in Release 8.
Compare this to the expression for Am given in B&B Problem 2.11.
In order to see how these coefficients will indeed reproduce the
given initial condition
L:=7*d; a:=1; d:=1;
To get the sum of the first, say, 25 terms, the command is
S2:=(2/L)sum(B(n)*sin(n*Pi*x), n=1..25):
In the above, a colon instead of a semicolon was used to end the line; this suppresses the display of a rather long expression. Again, S2 for the sum is for historic purposes; any variable not used so far (but not D, E or I, which are reserved for special math purposes) could be used. Also note that the normalization factor (2/L) has been included at this stage.
The punchline is the plot of S2:
plot(S2,x=0..1);
Lastly, for now, it is possible to display the individual terms, but essentially the B(n) need to be recalculated; this is really no big deal. In the given example, one possible set of commands would be:
S3:=plot(S2,x=0..1,color=magenta):
with(plots):
S4:={(2/L)*(int(f1*sin(i*Pi*z/L),z=0..d)+int(f2*sin(i*Pi*z/L),z=d..L))
*sin(i*Pi*x) $ i=1..5}:
S5:=plot(S4,x=0..1):
display([S5,S3]);
In the above, the plot formerly called S2 has been renamed and
given a color, neither of which is necessary. S4 is a set of
functions, iterated with the
For long commands, do not use
returns, as this will enter the command whether or not you've
completed it "Shift-Return" is a discretionary linebreak within
commands.
There are many things beyond those presented here that can be done; the plot output could be varied to a great extent, including line thickness and furthe options for colors. Such details will not be addressed here (see the help menus).