Math 244, Spring 2009 Sections 07 and 08
Integration, Differentiation, Plotting, and Solving Differential Equations
Example 1. Enter and evaluate the indefinite integral
Differentiate the output to verify that the anti-derivative is correct. Plot the integrand and the integral on the same set of axes. Then evaluate the definite integral from x=0 to x=Pi.
Solution. The integral is entered and evaluated below. There are two different ways to enter the integral. The first is to type int(x*cos(3*x),x); The ,x tells Maple that you want to integrate with respect to the variable x. An important observation: a times sign * between x and cos(3*x) is required to signify multiplication. Also observe that Maple omits the constant of integration.
The integral can also be entered by choosing the
from the menu on the left-hand side of the screen (under the "Expression" tab). First enter x*cos(3*x) in place of f. Then use the tab key to move the cursor to the dx, and enter x (again to tell Maple that you want to integrate with respect to the variable x). Then hit enter.
| > |
| (1) |
| > |
| (2) |
To differentiate the output, you can either type %' (using the prime notation for the derivative) or the diff(f,x) command. This tells Maple to differentiate f with respect to x.
| > |
| (3) |
| > |
| (4) |
| > |
| (5) |
| > |
| (6) |
As with the int command, you can also choose the
symbol from the menu on the left-hand side of the screen and use the tab key to move between the dx and the f. Don't forget to use the * sign for multiplication. Use the arrow keys to move between numerators, denominators, and exponents.
| > |
| (7) |
| > |
| (8) |
The plot procedure will draw the two curves. Put the integrand and output (1) inside of square brackets. The entry x=0..2 plots the curves over the interval from x=0 to x=2. The caption equation adds a caption. You can use the color= option to adjust the colors of the curves.
| > |
![]() |
In general, use plot([f(x),g(x)]); to plot curves f(x) and g(x) on the same set of axes. You can plot more than two functions by including more functions inside the square brackets.
| > |
| (9) |
| > |
| (10) |
Using the Percent Sign % to Refer to the Previous Output
The percent sign, % , in an input expression refers to the last output (last in time, not position). Use it sparingly to avoid confusion.
Example 2. Differentiate the expression sin(x)/x and then integrate the output.
| > |
| (11) |
| > |
| (12) |
Solving Differential Equations and Initial-Value Problems
The dsolve command solves a given differential equation. The symbol _C1 represents an arbitrary constant.
| > |
![]() |
(13) |
To obtain the solution to an initial value problem put the differential equation and the initial condition inside a set of curly brackets {}, as shown below.
| > |
![]() |
(14) |
The output to dsolve is the solution equation. To plot the solution curve apply the plot procedure to the expression on the right hand side of equation (6). See below.
| > |
![]() |
(15) |
| > |
![]() |
(16) |
| > |
![]() |
The plot is rather disappointing. This is because the solution has a vertical asymptote at the origin and we did not limit the vertical range. See the next plot input. The second range entry y=-8..8 tells plot to use the vertical range from y=-8 to y=8.
| > |
![]() |
Formula (17) shows that, as x approaches infinity, the solution curve approaches the curve y=(1/3)*x^2. See the next plot. The color option makes the first curve red and makes the second curve blue.
| > |
![]() |
Example 4. A house cools at a rate so that Newton's Law of Cooling applies: T' = k*(A-T), where T(x) is the
temperature inside the house at time x, A is the ambient temperature, and k is a positive constant. Assume that the ambient temperature is A=50 degrees F. If the house temperature is 70 degrees at 12 midnight and 65 degrees at 1 AM, then what is its temperature at 6 AM?
Solution. Begin by obtaining the solution to the initial value problem T' =k*(50-T) , T(0) =70 , where we let x=0 correspond to 12 midnight. When entering this equation we must be careful to put a * symbol between k and the
term 40-T to indicate multiplication.
| > |
| > |
| (17) |
To obtain the value of k, we substitute x=1 and set the result equal to 65, and solve for k.
| > |
| (18) |
| > |
| (19) |
| > |
| (20) |
| > |
| (21) |
| > |
| (22) |
| > |
| (23) |
This is the solution formula that is needed to answer the question. Simply evaluate T when x=6.
| > |
| (24) |
| > |
| (25) |
| > |