Up to Main Lab Page | Next Lesson - Derivatives | Previous Lesson - Trig Functions |
Maple uses square brackets [ .. ] to represent ordered information. Thus an ordered pair (i.e a point in R2) in Maple is represented by a pair of numbers in square brackets. So [1, 2] represents the point with x coordinate 1 and y coordinate 2.
We can plot a series of points by giving Maple and ordered set of points.
> plot([[0, 1], [1, 3], [2, 3],[4, 5]]);
Notice how this is an ordered list of ordered points.
We can of can of course use any of the plot features discussed already, to specify an x or y plot range, a color, etc.
By default plot joins the points up with straight lines. We can tell plot to
just plot the points with the optional style=point argument to
plot.
> plot([[0, 1], [1, 3], [2, 3],[4, 5]], style=point);
> plot([[0, 1], [1, 3], [2, 3],[4, 5]], -0.5..4, -0.5..5, style=point,
color=magenta, axes=box);
The second example specifies an x and y range and a plot color.
The axes=box tells Maple to put the axes in a box on the
left hand side and bottom of the plot, this together with extending the range
makes the point at 0 easier to see.
Note that since we are dealing now with a series of points, there is no x, thus
we can omit the 'x =' part of the range specification.
Plot the following sequence of points:
x 1 3 6 8
y 2 9 25 48
It is useful to be able to plot these sequences, since this lets us see what is
going on more clearly.
We can use the $ operator to generate a sequence of ordered pairs:
> g := x -> 1/x;
> f := x -> 1/x^2;
> rightpoints := [g(n), f(g(n))] $ n = 1..10;
> leftpoints := [-g(n), f(-g(n))] $ n = 1..10;
> plot([leftpoints, rightpoints], style=point);
Try to plot this without the "style = point", what goes wrong? Why?
In fact this is more or less how Maple plots functions, in fact Maple avoids regularity in the space between points and peturbes each one by a random amount to avoid special 'bad' points.
This seems to indicate that 1/x2 tends to infinity as x tends to 0 (i.e. 1/x2 has a vertical asymptote at 0). Of course no amount of plotting will ever allow us to be sure, to do that we must use conventional (algebraic) limit techniques.
We can also use this type of technique to investigate what happens to a
function as x approaches infinity.
> f := x -> 1/(-x^2);
> points := [n, f(n)] $ n = 5..100;
> plot( [points], style=point);
> points := [-n, f(-n)] $ n = 5..100;
> plot( [points], style=point);
This seems to indicate that f tends to 0 from above, as x tends to both +-
infinity.
Once again we must be careful, and not rely too heavily on these plots.
Consider the following:
> f := x -> sin(Pi*x);
> points := [n, f(n)] $ n = 5..100;
> plot( [points], style=point);
> points := [-n, f(-n)] $ n = 5..100;
> plot( [points], style=point);
This seems to indicate that sin(Pi*x) is identically 0.
But we know lim x->infinit sin(x) does not exist.
What went wrong?
For example:
> limit( x^2, x = 1);
> limit( y/y, y = 0);
> limit( a*y/y, y = 0);
In the last case the limit will depend on the value of a, which may depend on other
variables or y.
If the limit does not exist limit will report
undefined.
If the limit is unbounded (infinite) Maple will report either +- infinity.
If Maple cannot find the limit but it is bounded Maple will report a range
which bounds it.
> limit( 1/x, x = 0);
> limit( 1/x^2, x = 0);
> limit( sin(1/x), x = 0);
We also can tell Maple to take infinite limits
> limit( 1/x, x = infinity);
> limit( 1/x, x = -infinity);
Note though that Maple gives no information about how 1/x aproaches 0 as x
approaches infinity, from above, 0+. On the other hand as x approaches
-infinity, 1/x tends to zero from below 0-.
Try a plot of 1/x from -infinity to infinity.
We can also get Maple to compute left and right hand limits by using the
optional left or right arguments to
limit.
> limit( 1/x, x=0, left);
> limit( 1/x, x=0, right);
> limit( 1/x, x=0);
Care must be taken when using the limit function in Maple as it often makes
mistakes. This is usually because Maple assumes that any variable may be
complex valued. Thus the following are incorrect:
Why?
> limit(sqrt(x), x = 0);
> limit(sqrt(x), x = 0, left);
Despite an amazing ability Maple cannot do everything. Try
> f := x -> sin(1/x) - sin(1/x - x);
> limit(f(x), x = 0);
Maple tells us that this function must lie between -2 and 2 (the sum of two
sine functions). But now try
> plot(f(x), x = -.1.. .1);
This graph seems to indicate that f(x) is quite close to 0 at x = 0, despite
some serious wiggling!
We could try to plot f on intervals closer and closer to 0.
Try to plot f on the intervals +-a for a = 0.01, 0.001 and 0.0001.
Notice how all of these plots look similar, even though each interval is contained in the previous one. In particular at the end points we seem to get f(x) = x. If this were true the squeeze theorem would tell us that the limit was zero, which is indeed the case.
Up to Main Lab Page | Next Lesson - Derivatives | Previous Lesson - Standard Functions II | Top of this Lesson |