(6) Calculus
Before examining this topic, please make sure that you have read: (1) Working Through the New User's Tour.
Maple provides many powerful tools for solving problems in single-variable and multi-variable calculus. You can use Maple to solve problems in the areas of differentiation, integration, limits, series expansions, summations, products, integral transforms (such as Laplace, Z, Mellin, or Fourier), and piecewise-defined functions. Maple's architecture allows you to solve problems numerically and symbolically.
Use the restart command to clear Maple's internal memory and get started with this page of the tour.
> restart;
Differentiation and Integration
Maple can symbolically display and compute derivatives and integrals.
For example, define the function
.
> f := x -> x*sin(a*x) + b*x^2;
Construct an expression for the derivative,
, and call the computed value
.
> f_prime := diff( f(x), x);
If you compute
's
antiderivative
, you get the original function. Verify this assumption by using the following commands:
> int(f_prime, x);
> simplify(%);
Definite Integration
You can use Maple to perform definite integration.
For example, compute the previous integral within the interval
x
=1 to
x
=2. This problem is represented symbolically as
.
> int( f_prime, x=1..2 );
Elliptic Integrals
Maple can also compute elliptic integrals.
For example,
is evaluated in a normal form expression.
> int( 1/sqrt( 1 + x^4 ) , x=0..1 );
Use the evalf command to evaluate a floating-point approximation of the previous value.
> evalf(%);
Special Functions
In the previous integration examples, some of the results were displayed in terms of special mathematical functions and numbers. Maple supports hundreds of special functions and numbers encountered in many areas of mathematics, science, and engineering. Here are some of these:
Area and Volume
You can also calculate area and volume. Consider the curve
.
If you rotate the curve around the
-axis, you obtain a surface. The area of this surface is infinite, which we find by multiplying the circumference by the arclength:
> area := int( 2*Pi/x*sqrt(1^2 + diff(1/x,x)^2), x=1..infinity );
The volume of the corresponding solid is
.
A famous irony in mathematics is that if you compute this integral, the volume turns out to be finite, even though the area is infinite.
> volume := int( Pi*(1/x)^2, x=1..infinity );
Limits
Maple can compute the limits of functions approaching finite and infinite values. It can take the limits in both positive and negative directions, and compute limits involving absolute values. Maple also recognizes undefined limits.
Finite and Infinite Values
Maple can compute limits of functions approaching finite and infinite values, as shown in the following example.
> expr := (2*x+3)/(7*x+5);
> limit( expr, x=infinity );
Positive and Negative Directions
You can also take the limit of an expression from both the positive and negative directions. Consider
.
> limit( tan(x+Pi/2), x=0, left );
> limit( tan(x+Pi/2), x=0, right );
Since the left-hand limit and the right-hand limit are not equal,
does not exist.
Absolute Values
Maple can compute limits involving absolute values. Consider
.
> limit( abs(x-4)/(x-4) , x=4, right );
Undefined Limits
Maple can easily recognize undefined limits, such as
.
> limit( sqrt(1-cos(x)) / x*sqrt(2), x=0 );
The Maple command piecewise allows you to express piecewise-continuous functions.
Example 1
You can define piecewise functions as follows.
> p := x -> piecewise( x<0, -1, x>1, 2*x, x^2 );
> p(x);
The following expression calculates the derivative of
.
> p_prime := diff( p(x), x );
Example 2
Consider another expression.
> expr := piecewise( x<=-1, -x, x<=1, x*x, x>1, sin(x-1)/(x-1) );
Integrating the expression yields the following expression.
> anti := int( expr, x );
Note : Si(x) is the Sine Integral function.
Series Expansions
Maple provides you with many ways to manipulate series approximations.
Consider the series approximation of the expression
.
> expr := sin(4*x)*cos(x):
> approx1 := series( expr, x=0 );
You must convert the series approximation to a polynomial before you can plot it.
> poly1 := convert( approx1, polynom );
Now compare the original expression and the approximation on a graph.
>
plot( {expr, poly1}, x=-1..1, y=-2..2, title =
cat( convert(expr, string)," vs. Series Approximation" ) );
The environment variable Order represents the order of series calculations performed by Maple. Its default value is 6. You can increase this value by using the following command .
> Order := 12;
Now recompute the series approximation.
> approx2 := series( expr, x=0 );
> poly2 := convert( approx2, polynom );
>
plot( {expr, poly2}, x=-1..1, y=-2..2, title =
cat( convert(expr, string)," vs. Series Approximation" ) );