Advanced Engineering Computation
Advanced Engineering Computation
Engineering
Computations
the low-pass filter used in the design of a direct current (DC) power supply.
this cutoff frequency. The application in this chapter uses complex phasors
low-pass filter. This technique is very general, and is a powerful tool for
braic equations forms the foundation upon which the remainder of the
analysis can be completed. You will also learn Maple commands and
155
156 M AP L E V F OR E NGINE E R S
M
aple can be used in many different branches of mathematics
INTRODUCTION
including algebra, calculus, combinatorics, financial mathematics,
graph theory, linear algebra, logic, number theory, and optimiza-
tion. The first five chapters of this module showed you how to use Maple
to solve problems requiring mainly algebra and trigonometry. In this
chapter, you will see some of the ways Maple can be used to solve prob-
lems that involve complex analysis, calculus, and (briefly) differential
equations. The application in this chapter shows how an electrical engi-
neer uses nodal analysis to investigate some of the characteristics of a
low-pass electrical filter. Recall that the bandwidth application in Chapter 3
also involved the analysis of a filter. Even though there are similarities in
how engineers discuss both types of filters, the discussion in this chapter
is quite different from the one presented in Chapter 3.
Although you will learn many useful techniques for solving mathemati-
cal problems in this chapter, it is not comprehensive in its presentation of
Maple’s mathematical capabilities. Some of the examples and Try It! exer-
cises refer to problems encountered earlier in the module. For example,
the solution to the Streeter–Phelps equation that was provided in Chapter 5
will now be found and verified using Maple. References to the earlier dis-
cussions are provided; if you do not recall the details of a problem, please
take a few minutes to refresh your memory.
Several dozen packages contain collections of additional Maple com-
mands. The plots and student packages have been introduced previ-
ously. The student package will be used in the discussion of calculus
(Section 6-2) and the DEtools package will be used to produce plots relat-
ing to differential equations (Section 6-3). Other packages likely to be of
interest to many engineers include the linalg package for linear algebra,
the numtheory package for number theory, and the inttrans package for
integral transformation such as the Laplace and Fourier transform. The
full list of Maple packages can be found on the online help worksheet with
keyword index,package.
> z := 2+3*I;
z := 2 + 3 I
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 157
> w := 6-4*I;
w := 6 − 4 I
SUMzw := 8 − I
1
QUOTzw := I
2
Common commands specifically designed for use with complex-valued
objects include abs, conjugate, Re, and Im. For expressions involving
symbolic names, the evalc command is used to force the evaluation of
complex-valued expressions in the standard form: x + I y.
SOLUTION
The two complex numbers are
z := Rez + I Imz
w := Rew + I Imw
> zC := conjugate(z);
zC := Rez + I Imz
> zC := evalc( zC );
zC := Rez – I Imz
Note how evalc is used to reduce the expression into standard form.
The product of z and w is
> PRODzw := z * w;
(Rez + I Imz) (Rew + I Imw) = Rez Rew − Imz Imw + I (Rez Imw + Imz Rew)
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
You may have noticed that expressions returned by evalc (in standard
form) are valid only when the real and imaginary parts of z and w (that is,
Rez, Imz, Rew, Imw) are real–valued. In fact, the fundamental assumption
made by evalc is that unassigned variables represent real-valued quantities.
For example, when neither a nor b is assigned a value, evalc( Re( a+I*b ) )
evaluates to a. Furthermore, evalc assumes that an unknown function of
a real variable is real–valued. For additional explanation and examples, see
the online help document for evalc.
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 159
Try It Use Maple to find the formulae for the roots of a general quadratic, cubic,
and quartic polynomial. Verify that Maple returns the appropriate number
! of roots. Note that the allvalues command can be used to force evaluation
of results that involve RootOf.
(In fact, many of the special functions, for example, exp, ln, sin, cos, tan,
actually arise more naturally in this setting.)
In most cases, the complex-valued extensions of the functions are of lit-
tle concern. However, one place where this cannot be ignored is when
working with fractional powers. Although most humans immediately
simplify (−1)1/3 to −1, Maple realizes that there are three possible values
to this expression. Maple does choose one of the three values, but—for
mathematical reasons beyond the scope of this module—it is not the real-
valued root. The surd command provides a means of obtaining a real-val-
ued output from odd roots of negative numbers:
1 1/ 3 1 1/ 3
(−8)1/ 3 = 8 + I8 3
2 2
> (-8)^(1/3) = surd( -8, 3 );
(−8)1/3 = −2
SOLUTION
The preceding discussion suggests that the naive approach will not be
successful. The following plot confirms that each of these functions is, in
this form, real–valued only when x ≥ 0.
FNSI := [ x , x 1/ 3, x 2 / 3, x 1/ 4 , x , x 3/ 4 ]
> plot( FNS1, x=-1..1, color=[RED,RED,BLUE,RED,BLUE,GREEN],
> symbol=CIRCLE, style=[POINT,LINE$5],
> title=`Six Fractional Powers` );
0.8
0.6
0.4
0.2
-1 -0.5 0 0.5 1
x
Note that each plot starts at x = 0, not x = −1, as requested. This is not a
surprise for the even roots since, for example, ( −1) = −1 = i , which is not
1/ 2
real valued. Note also that the plots with α = 1 2 and α = 2 4 are identical.
To obtain the desired plot, each of the functions must be represented in
terms of surd:
[ ( ) (
FNS2 := surd (x, 2), surd (x, 3), surd x 2, 3 , surd (x, 4), surd x 2, 4 , surd x 3, 4 ) ( )]
Note the steps taken to comply with the requirement that the second
argument to surd be an integer (see the online help for surd).
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 161
0.5
-1 -0.5 0 0.5 1
x
-0.5
-1
From the second plot, you can see that using surd allowed three of the
plots to be extended to the negative real line.
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Try It Identify the three functions that were able to be extended to the negative
real line in the final plot in Example 6-2.
!
Try It Use convert and simplify (and, if necessary, assume) to verify that the
surd-based representations are equivalent to the original power represen-
! tation. (Pay particular attention to α = 2 4 .)
SOLUTION
The ninth roots of −10 are the nine solutions to the ninth-degree polynomial
EQ := x9 = −10
1 1 1 1 1 1 1
ROOTS := −101 / 9, 101 / 9 − I 3 101 / 9, 101 / 9 + I 3 101 / 9, %21 / 3, − %21 / 3 − I 3 %21 / 3,
2 2 2 2 2 4 4
− %21 / 3 + I 3 %21 / 3, %11 / 3, − %11 / 3 + I 3 %11 / 3, − %11 / 3 − I 3 %11 / 3
1 1 12 1 1 1 1
3 %11 / 3
4 4 4 4 4 4
− %21 / 3 + I 3 %21 / 3, %11 / 3, − %11 / 3 + I 3 %11 / 3, − %11 / 3 − I
4
%1 4
4 10 1/3 2
4I 3 10 1/3 4 4 4 4
%1 := 4 101 / 3 + 4I 3 101 / 3
%2 := 4 101 / 3 − 4I 3 101 / 3
It can be difficult to see any structure in the preceding representations
of the roots. A point plot of these numbers, in the complex plane, should
yield more information:
0.5
Im 0
-0.5
-1
-1 -0.5 0 0.5 1
Re
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 163
Note that there is only one real-valued root, and none of the roots are
purely complex. Moreover, the roots appear to be regularly spaced on the
circle centered at the origin with radius a little larger than 1.25.
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Fundamentals
The circuit diagram in Figure 6-1 shows a set of input terminals (the
input port) and a set of output terminals (the output port). The dashed
box encloses the portion of the circuit designated the low-pass filter.
The input port has a voltage signal vi(t) across its terminals, and the
output port similarly has output voltage vo(t). Attached to the output
terminals is an electrical load with resistance, R. There is an input AC
voltage source across the input terminals, with a 170-volt peak ampli-
tude, 120 ° phase shift, and oscillating at the radian frequency of ω radi-
ans/second (= 2π60 for AC voltages available from wall outlets in the
United States). That is, the input source is v i (t ) = 170 cos(ωt + 2 3π ) .
(This represents a standard 120-volt rms AC voltage available from wall
outlets.)
Time-periodic (or steady-state sinusoidal) sources are so prevalent in
the analysis of electrical circuits (as well as other systems in engineer-
ing) that it is common to describe them in terms of the peak amplitude
and phase shift (in degrees), that is, as a phasor. For example, the pha-
sor representation of the input voltage is 170 ∠ 120 °, in units of Volts
(note that 2π 3 radians = 120°). Conversion between the phasor and time-
164 M AP L E V F OR E NGINE E R S
+ L L +
170cos(ωt + 2π/3)
+ vi (t) vo (t)
Input voltage C R Load resistor
−
source
Capacitor
− −
Low-pass filter
170 −j/ωC
Input voltage ∠ 120° Load
+
source (phasor) − Vi R (impedance)
Vo
− −
2. Gather information
Kirchhoff’s current law (KCL) is the underlying principle on which this
application is developed. The first step in the analysis is, therefore, to
determine the two nodal equations in terms of general values of the
inductance, L, capacitance, C, and resistance, R.
The phasor current leaving node 1 through the input inductor is the
ratio of the voltage difference across its terminals, VC − Vi , to the
VC − Vi
impedance, j ωL, of this element: . Similarly, the phasor currents
jωL
VC − Vo
and , respectively. Thus, applying KCL at the first node means
jωL
that the sum of all currents leaving node 1 is zero:
VC − Vi VC V − Vo
+ + C =0
jωL −
j jωL
ωC
166 M AP L E V F OR E NGINEE R S
The second node connects only two elements. The current phasor
leaving the output inductor is the negative of the current entering that
Vo − VC V
element: ; the current phasor through the resistor is 0 . The
jωL R
equation obtained from applying KCL at node 2 is
Vo − VC V0
+ =0
jωL R
> restart;
> alias( I=I, j = sqrt(-1) );
SOLN := VC = −
(
Vi jR − ωL ) = −
jRVi
3 2
, Vo
− jR + jRω CL + 2ωL − ω L C
2 3 2
− jR + jRω CL + 2ωL − ω L C
2
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 167
jR
RESPONSE :=
− jR + jRω CL + 2ωL − ω 3L2C
2
Note that the frequency response is, for most frequencies, a complex
Vo
number. If it is written in polar form, = M e j θ, the magnitude M is
Vi
commonly called the gain, and θ is called the relative phase shift (relative
to the phase of the input source). The gain is found to be
( ) ( )
2 2
R2 2ωL − ω 3L2C R2 − R + Rω 2CL
M := +
( ) ( ) ( ) + (− R + Rω CL )
2 2 2 2
2ωL − ω 3L2C 2
+ − R + Rω CL 2 2ωL − ω 3L2C 2 2
R2
M :=
( ) (
ω 6 L4C 2 + −4L3C + R2C 2L2 ω 4 + 4L2 − 2R2CL ω 2 + R2 )
(The map command is needed to force the collection with respect to ω
in the numerator and denominator of this expression. Compare this
result with that obtained from collect( normal( M ), omega );.)
The phase angle is the argument of a complex-valued frequency
response function. Maple’s argument is used in the same manner as
abs, Re, and Im:
jR
θ := argument 3 2
− jR + jRω CL + 2ωL − ω L C
2
The argument is, essentially, the arctangent of the ratio of the imagi-
nary and real parts of the expression. (Exceptions occur when the real
part is zero; furthermore, the signs of the real and imaginary parts
must be used to determine the correct quadrant for the argument; see
the online help for argument and invtrig for further details.)
168 M AP L E V F OR E NGINEE R S
( )
MdB = 20 log10(M), versus log10 ω ω where the natural (radian) frequency,
0
ω0, satisfies ω 0 =
2 1
LC
. Thus,
1
ω0 :=
LC
> MdB := 20*log[10](M);
R2
ln
MdB := 20
( ) ( )
ω 6 L4C 2 + −4L3C + R2C 2L2 ω 4 + 4L2 − 2R2CL ω 2 + R2
( )
ln 10
The formula for the amplitude gain can be simplified using the prop-
erties of logarithms. Before Maple will apply these properties, it is nec-
essary to tell Maple that all the variables are real valued:
MdB :=
10
( )
2 ln R ~ − ln(ω ~ 6 L ~ 4C ~ 2 − 4ω ~ 4 L ~ 3C ~ + ω ~ 4 R ~ 2C ~ 2 L ~ 2 + 4ω ~ 2L ~ 2 − 2ω ~ 2 R ~ 2C ~ L ~ + R ~ 2 )
() ()
ln 2 + ln 5
( )
log10 ω ω against MdB as desired.
0
The plot will be created using the default set of parameter values for
the components of the filter:
3
PARAM := L ~ = 10, C ~ = , R ~ = 1000
500000
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 169
-10
-20
-40
-50
-60
.1000000000 .5000000000 1. 5. 10.
omega/omega0
Observe that this curve is essentially linear when ω > 2 ω0. Since the
slope is approximately −60, this circuit is said to exhibit a rolloff of 60 dB
per decade (factor of 10 in frequency) or 18 dB per octave (factor of 2
in frequency).
This corrected Bode amplitude plot can be easily approximated by zero
dB for low frequencies and by a linear function (in log10 ω ω ) for high fre-
0
( )
quencies. The corresponding uncorrected Bode amplitude plot consists of
these two straight lines. The frequency at which these lines intersect is
called the cutoff frequency (corner frequency and break frequency are
other names that appear in the literature). The cutoff frequency for this
low-pass filter is ωc = 119 rad/sec, which corresponds to fc = 19 Hz. So
you can see that this low-pass filter could be used, for example, as a
component of a DC power supply, since it would reject any surviving
AC signals at f = 60 Hz from household outlets and transmit only the
desired DC (f = ω = 0) voltage signals that the power supply generates.
input source), and the asymptotic behavior for large frequencies (see
Problem 9). The consideration of each of these special cases both adds
to our understanding of this problem and confirms the utility of the
general expressions obtained in Step 4.
> M;
R2
( ) ( )
ω 6 L4C 2 + −4L3C + R2C 2L2 ω 4 + 4L2 − 2R2CL ω 2 + R2
> theta;
jR
argument −
− jR + jRω 2CL + 2ωL − ω 3L2C
In this case it is clear that the gain is M = 1 and the phase shift is
θ = arctan(0) = 0. The same results are obtained by Maple:
gain = 1
phaseshift = 0
C~
gain = R ~
L~
> phaseshift = simplify( subs( omega=omega0, theta ) );
1
phaseshift = − π
2
Observe that though the gain of a low-pass filter at the natural fre-
quency depends on the specific values of the circuit parameters, the
phase shift is always −90 °.
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 171
R ~2 1
EQ 3dB := =
4 2 3 2 2 2 4 2 2
(
ω ~ L ~ C ~ + ( −4L ~ C ~ + R ~ C ~ L ~ )ω ~ + 4L ~ − 2R ~ C ~ L ~ ω ~ + R ~
6 2 2
2 )
You could simply ask Maple to solve this equation for ω, but this is
likely to return a total of six solutions. (Do you see why?) The number
of solutions can be cut in half simply by noting that the denominator is
an even function of ω. Let µ = ω2 and then solve for µ. Each real and
positive root, µ, will lead to a 3-dB frequency, ω = µ .
The change of variables leads to the equation
R ~2 1
EQ 3dB 2:= =
3 4 2 3 2 2 2 2 2 2
(
µ L ~ C ~ + ( −4L ~ C ~ + R ~ C ~ L ~ )µ + 4L ~ − 2R ~ C ~ L ~ µ + R ~ 2
2 )
The solutions to this equation are
172 M AP L E V F OR E NGINEE R S
1 %11 / 3 2 1 −4L ~ + R ~ 2 C ~
+ %2 −
MU := 6 L ~ C ~ 3 3 C~L~ ,
L ~
1 %11 / 3 1 1 −4L ~ + R ~ 2 C ~ 1 1 %11 / 3 2
− − %2 − + j 3 − %2
12 L ~ C ~ 3 3 C~L~ 2 6 L ~ C ~ 3
,
L~
1 %11 / 3 1 1 −4L ~ + R ~ 2 C ~ 1 1 %11 / 3 2
− − %2 − − j 3 − %2
12 L ~ C ~ 3 3 C~L~ 2 6 L ~ C ~ 3
L~
%1 := − 64L ~ + 156R ~ C ~ L ~ + 24L ~ R ~ C ~ − 8R ~ C ~ 3
3 2 2 4 2 6
Since there are, in fact, three positive values of µ that satisfy this
equation, there will be three separate 3-dB frequencies:
These results are consistent with the corrected Bode amplitude plot:
there are three points on this curve where the gain is −3 dB. Further
verification of these results requires conversion from frequency into
( )
the normalized variable log10 ω ω 0 :
ω
CONVERT := ω → evalf subs PARAM , log10
ω 0
3dB frequencies
-2
gain (dB)
-4
-6
-8
-10
-0.2 -0.1 0 0.1 0.2
omega/omega0
This example should not be used to conclude that all LP filters have
more than one 3-dB point. Though a full analysis of 3-dB points is
beyond the scope of this discussion, note that the cutoff frequency is
very close to the mean of ω0 and the middle 3-dB point.
What If Suppose you need to design a low-pass filter whose cut-off frequency, ωc ,
is increased by a factor of 10. How would the value of L need to be
? changed if the original values for R and C are used? How would C be cho-
sen if the original L and R values are used? How would R be chosen if the
original L and C are used? Find all physical solutions and verify each result
with an appropriate Bode plot.
6-2 CALCULUS
Limits are the fundamental concept behind the two principal components
of calculus: the derivative and the integral. The corresponding Maple com-
mands are limit, diff, and int and their inert forms Limit, Diff, and
Int. This brief introduction discusses only these fundamental concepts;
the student package contains a large collection of additional calculus-based
tools, including integration by parts, line integrals, and triple integrals.
The limit of an expression f(x) as x approaches a, lim f(x ) , is translated
x →a
to Maple as limit( f(x), x=a );. An optional third argument can be used
to specify one-sided limits.
θ
(b) lim tan
θ→ π 2
θ
(c) lim tan
θ→ π − 2
(d) lim
(
sin 3x 2 − 27 )
x →3 −2x + x + 45
3 2
1
(e) lim sin
x →0 x
sin ( y ) − sin (x )
(f) lim
y →x y −x
SOLUTION
Each limit can be directly translated into Maple. The only special consider-
ation is in (c), where the one-sided limit from the left is specified by
including left as the third argument of the limit command
> restart;
12
undefined
∞
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 175
−1 .. 1
cos(x)
The results from parts (b) and (c) illustrate the way Maple responds to
limits that do not exist or are unbounded. The result in (e) should be inter-
1
preted to mean that the limit is not defined because the value of sin
x
oscillates within the interval [−1,1] infinitely often near x = 0. The limit in
(f) is recognized as the definition of the derivative of sin(x); in light of this
observation, the result is exactly what you should expect.
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
( )
n
Euler’s constant, e, can be defined as lim 1 + 1 n . Use the inert form
n →∞
SOLUTION
The definition of e, as an unevaluated limit, is
n
1
lim 1 + = 2.7182818284590452354
n→ ∞ n
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Try It Note how the presentation of the limit and its value in Example 6-5 is
more informative than the format used in Example 6-4. Redo each of the
! problems in Example 6-4 using a style similar to that introduced in
Example 6-5.
SOLUTION
The function could be entered as a Maple expression or, using the arrow
operator, as a function. For a change of pace, and in preparation of later
examples in this chapter, the arrow operator will be used here:
2x 2 − 7x + 1
f := x →
3−x
The singularity in the denominator when x = 3 suggests the probable
existence of a vertical asymptote at x = 3. To confirm this, it is necessary
to check that at least one of the left and right one-sided limits is
unbounded at x = 3:
2x 2 − 7x + 1
lim =∞
x →3+ 3−x
> limL := Limit( f(x), x=3, left ):
> limL = value( limL );
2x 2 − 7x + 1
lim = −∞
x →3− 3−x
Thus, x = 3 is a vertical asymptote for f.
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 177
Since the degree of the numerator exceeds the degree of the denominator,
there are no horizontal asymptotes to this function. But there should be
an oblique asymptote. Long division is the usual technique used to manu-
ally compute an oblique asymptote. The Maple commands quo and rem
can be used to obtain this information. The oblique asymptote can be ob-
tained from the quotient of the numerator and denominator of f as follows:
NN := −2x2 + 7x − 1
DD := −3 + x
obliq_asymp := −2x + 1
2
fEQUIV := − 2x + 1 +
−3 + x
One way to check this result is to normalize the difference between the
two representations of the function:
2x 2 − 7x + 1
lim + 2x − 1 = 0
x →∞ 3−x
> obliqLIM2 := Limit( f(x)-obliq_asymp, x=-infinity ):
> obliqLIM2 = value( obliqLIM1 );
2x 2 − 7x + 1
lim + 2x − 1 = 0
x → ( −∞ ) 3−x
Of course, these results can be seen by inspection from the fact that
2
f(x ) − ( −2x + 1) = . (Three alternative methods for finding the oblique
x −3
asymptote are presented in Problem 3 in this chapter.)
The last step is to create a plot of the function f. Since f is discontinu-
ous, you know that it is necessary to use the discont=true option and to
provide an appropriate vertical range:
178 M AP L E V F OR E NGINEE R S
40
20
-10 -5 0 5 10
x
-20
-40
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
SOLUTION
Since both diff and D are to be used, it will be necessary to implement
the function using the arrow operator:
∂ x 2 + 3x
1
x + sin (2x ) + e
x
df := +
∂x x +1
> df = value( df );
1
∂ x 2 + 3x 1 1
1
e x 2x + 3 x 2 + 3x
x + sin (2x ) + e + 2 cos(2x ) − 2 +
x
+ = −
∂x x +1 2 x x x + 1 (x + 1)2
> Df := D(f);
1
1 1 e x 2x + 3 x 2 + 3x
Df := x → + 2 cos(2x ) − 2 + −
2 x x x + 1 (x + 1)2
> df = Df(x);
1
∂ x 2 + 3x 1 1
1
e x 2x + 3 x 2 + 3x
x + sin (2 ) + x +
x e = + 2 cos(2x ) − 2 + −
∂x x +1 2 x x x + 1 (x + 1)2
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Note that Maple displays all derivatives using the standard notation for
partial derivatives. This is something that you need to accept; it cannot be
changed.
Second- and higher-order derivatives can be found by specifying addi-
tional arguments to diff or Diff. For example, the second and fifth deriv-
atives of EXPR with respect to X can be obtained with diff( EXPR, X, X )
and diff( EXPR, X $ 5 ), respectively. The corresponding second and
fifth derivative functions obtained with D would be D( D( f ) ) and, using
the repeated composition operator @@, ( D @@ 5 )( f ).
−1
Try It Compute the first three derivatives of the function f(x ) = e x2 using both
diff and D. (See also Problem 4 in this chapter).
!
Note the close correspondence between Maple syntax and mathematical
notation and terminology. This connection is particularly strong for the
180 M AP L E V F OR E NGINEE R S
SOLUTION
The inert integration command is used here to, once again, improve the
clarity of the results.
1
∫ sin(x ) cos(x )dx = 2 sin(x )
2
+C
1
∫ sin(x ) cos(x )dx = 2 sin(x )
2
+C
Try It The indefinite integrals when b = 1 are easily found using the substitution
u = sin(x). The integrals could also be found by using the substitution
! sin (2x )
v = cos(x) or by noting that sin (x ) cos(x ) = . Compute the indefinite
2
sin (2x )
integral ∫ 2
dx . Does this yield the same result as in Example 6-8?
Are the results equivalent? Explain.
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 181
∫ f(x )dx ,
2
Evaluate the definite integrals
∫−2
f(x )dx and
0
where
2x 2 − 7x + 1
f(x ) = . Note that the second integral is an improper integral.
3−x
SOLUTION
The function f is given by
2x 2 − 7x + 1
f := x →
3−x
The definite integral over the interval [−2, 2] can be evaluated as follows:
()
⌡−2 3− x
Since f has a singularity at x = 3, the second integral is improper. Thus,
f(x )dx converges. Maple auto-
3− a
the integral converges if and only if lim ∫0
α →0 +
matically detects the singularity and evaluates the appropriate limit, when
possible, for improper integrals. Thus, as far as Maple is concerned, the
user does not have to change the way in which the integral is computed:
3 3− α
⌠ 2x − 7x + 1dx = lim ⌠ 2x 2 − 7x + 1
2
dx
⌡0 3−x α →0 + ⌡
0 3−x
= −∞
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
where the stress is 12000 ε for 0 ≤ ε ≤ 2.8%, 330 for 2.8% ≤ ε ≤ 3.2%, and
−210000 ε2 + 23000 ε − 210 for 3.2% ≤ ε ≤ 7.4%. Compute the toughness of the
material analyzed in Chapter 2.
SOLUTION
The three parts of the stress function are
stress1 := 12000 ε
stress2 := 330
∫ 0 ∫ ∫
12000ε dε + 330 d ε + −210000ε 2 + 23000ε − 210 dε = 22.33008000
.028 .032
120.00
310.960000
184 M AP L E V F OR E NGINEE R S
The last result is zero because this is the default value returned from a
piecewise-defined function when none of the Boolean expressions evalu-
ates to true.
Try It Use the piecewise definition of stress and strain to create a plot of the
stress-strain curve for the material analyzed in Chapter 2.
!
EXAMPLE 6-11 Toughness as a Single Integral
Find the toughness of the material by the integration of the piecewise-
defined stress function.
SOLUTION
.074
⌠ 12000 ε ε < .028
ε < .032 d ε = 22.33008000
330
−210000ε + 23000ε − 210 ε < .074
2
0 otherwise
⌡0
Note that this value is identical to the one obtained in Example 6-10.
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Try It The piecewise-defined stress function used in Example 6-11 is not quite
correct. Note that although the stress is forced to be zero for strains after
! failure, no similar efforts have been made to prevent erroneous values for
negative strains. Redefine the stress function so that this potential prob-
lem is avoided. Further, for the sake of simplifying evaluation, use the
unapply command to make the stress a function of the strain. (See Chap-
ter 3, or a help worksheet, for information about the unapply command)
Plot this function over the domain −0.01 < ε < 0.10.
Try It The first objective is to understand that the mathematical theory guarantees
that the existence of this integral is independent of our ability to express
! 3
the value in terms of elementary functions. First, plot y = e−x on an
SOLUTION
(a) Maple’s inability to evaluate the integral will be detected when value
attempts to evaluate the inert form of the integral.
∫ e ∫
dx = e
dx
0 0
(b) The following segments of Maple code can be used to test the execu-
tion time for the two different expressions given in the problem
statement. Note that the restart commands are used to prevent any
residual information from the first evaluation from influencing the
execution speed of the second form.
> restart;
> tstart := time():
> area := evalf( int( exp( -x^3 ), x = 0 .. 1 ) ):
> tend := time():
> printf( `\n elapsed time: %6.3f seconds (area = %12.10f)\n `,
> tend-tstart, area );
> restart;
> tstart := time():
> area := evalf( Int( exp( -x^3 ), x = 0 .. 1 ) ):
> tend := time():
> printf( `\n elapsed time: %6.3f seconds (area = %12.10f)\n `,
> tend-tstart, area );
Note that the values of the integrals are the same up to (at least) 10
decimal digits, but that the form that used Int was more than four times
as fast as the evaluation that used int. The difference in execution time is
a result of the fact that Maple attempted to evaluate the int command
before it realized that a numerical integration was necessary.
The appearance of the output has been improved with the use of the
printf command (see the online help for printf).
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
You should note that if the integral can be evaluated, then evalf( int( ... ) )
returns a floating-point approximation to the evaluated expression; no
numerical integration is performed. To ensure the numerical evaluation of
an integral, evalf( Int( ... ) ) should be used.
L ′(t ) = −kd L (t )
D ′(t ) = kd L (t ) − kr D (t )
You are also provided with the solution to this system of equations,
with initial conditions L(0) = BODu and D(0)=D0:
L (t ) = BODu e
−kd t
D (t ) =
kd
kr − kd
( )
BODu e −k t − e −k t + D0 e −k t
d r r
SOLUTION
The BOD differential equation is entered as
∂
BODeqn : = L (t ) = −kdL(t )
∂t
The syntax for dsolve is very similar to the syntax for solve and
fsolve. The general solution of an equation can be found by specifying
the differential equation and unknown function as arguments to dsolve:
∂ −kd t
CHECK := e ( ) _ C1 + kd e ( ) _ C1
−kd t
∂t
0
Since the result is zero, or an expression that reduces to zero, the equa-
tion is satisfied and the function is a solution.
The particular function that also satisfies the initial condition,
L(0) = BODu, can be found by substituting the initial condition (and initial
time) into the equation for the general solution, then solving for the con-
stant(s). For example, for the BOD problem:
{_C1 = BODu}
Thus, the initial condition is satisfied if and only if _C1 = BODu, and the
only function that satisfies the BOD differential equation and the initial
condition is
SOLUTION
Using the assignments made in Example 6-13, the set containing the dif-
ferential equation and initial condition is
∂
BODivp := L(t ) = −kd L(t ), L(0) = BODu
∂t
Then, the particular solution can be found with the single command
This solution is, by inspection, the same as the one found in Example 6-13.
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Try It Find the general and particular solutions to the Streeter–Phelps equation,
with initial condition D(0) = D0. Hint: Begin by substituting the solution to
! the BOD equation into the Streeter–Phelps equation:
∂ ∂
DOeqn := DO(t ) = − DD(t )
∂t ∂t
∂
DOeqn := DO(t ) = −kd L(t ) + kr DD(t )
∂t
∂
DOeqn :=
∂t
(
DO(t ) = −kd L(t ) + kr − DO(t ) + DOsat )
190 M AP L E V F OR E NGINEE R S
SUMMARY This chapter demonstrated how Maple can be used in problems that
involve complex numbers, calculus, and differential equations. The appli-
cation used nodal analysis to investigate a low-pass electrical filter,
including the determination of the circuit’s frequency response. Expres-
sions for the voltage transfer ratio amplitude and phase were calculated
and plotted. The calculus section focused on problems that involve limits,
derivatives, and integrals. Several ways that inert commands can be used
to improve both appearance and efficiency were introduced and demon-
strated. Some of the examples revisited applications introduced in earlier
chapters. In particular, the toughness of a material was computed by
direct integration after the stress-strain curve was defined as a piecewise-
defined function and the biochemical oxygen demand (BOD) and oxygen
deficit levels in the water quality application were obtained by solving the
BOD and Streeter–Phelps equations.
Keywords
Maple Commands
References
1. Lopez, R., Maple via Calculus: A Tutorial Approach, New York: Birkhauser, 1994.
2. Crawford, R.S. Jr., Waves, New York: McGraw-Hill, 1968, pp. 128–130.
3. Johnson, D.E., Hilburn, J.L, Johnson, J.R., and Scott, P.D., Basic Electric Circuit
Analysis, 5th ed. Englewood Cliffs, N.J.: Prentice-Hall, 1995, pp. 284–308, 322–327.
Problems
1. (a) Find the eighth roots of 10. Use nops to verify that the correct
number of roots have been found.
(b) Create separate lists containing the real-valued roots and the com-
plex-valued roots. Hint: The select and remove commands are
recommended for creating subsets of lists or sets as requested in
this problem. Further, a common method for testing if an object is
complex valued is to use the Boolean function has to check if the
object contains I. For example, has( f, I ); returns true if f con-
tains I and otherwise returns false.
2. The modulus and argument of a complex number can be used to spec-
ify a complex number in polar coordinates. This conversion can be
accomplished using Maple’s polar command, whereas conversion
from polar to standard form is obtained using evalc. (For additional
details, see the help worksheet for polar.)
Let a be a positive number. Find the polar representations of the
square, cube, and fourth roots of a. Without using solve, what are the
fifth roots of a?
3. Let f be the function introduced in Example 6-6, that is,
2x 2 − 7x + 1
f(x ) = .
3−x
(a) Use asympt to find the asymptotic expansion of f.
(b) Use series to find the series expansion of f about both x = 0 and
x = 3.
(c) Use convert,parfrac to find the partial fraction decomposition
of f.
(d) Compare the results found in parts (a), (b), and (c). How hard is it
to identify the oblique asymptote in each case? What other infor-
mation is contained in these results?
Consult the appropriate help worksheets for information about the
syntax and interpretation of results from each of these commands.
−1
4. Note that the function f(x ) = e x2 is not defined at x = 0. (See also the
Try It! exercise immediatedly following Example 6-7.)
(a) Plot f and its first three derivatives on the interval [−1, 1].
(b) Is it possible to define f(0) so that f is continuous at x = 0?
(c) Use part (b), and the definition of the derivative, to compute f′(0).
Are any derivatives of f continuous at x = 0?
192 M AP L E V F OR E NGINEE R S
2x 2 − 7x + 1
5. (a) Compute the definite integral of g(x ) = and
3− x
2x 2 − 7x + 1
h (x ) = . Cross-check your results using a graph and
(3 − x )2
interpreting the integral as a (signed) area.
3
⌠ 2x 2 − 7x + 1
(b) For what values of p does dx converge?
⌡0 (3 − x )
p
(d) Use the result from part (c) to show that the cut-off frequency, ωc,
satisfies ωc3 = ω′ ω02.
(Hint: Use a combination of limit, series, and/or asympt.)
10. a) Produce corrected Bode amplitude plots, and compute the cut-off
frequencies when the load resistance is R = 10Ω, R = 1kΩ,
R = 500kΩ, R = 1MΩ, R = 10MΩ,and R = 100MΩ. How does changing
the load resistance value affect the operation of the low-pass filter?
CHAP T E R 6 A D V A N C E D E N G I N E E R I N G C O MP U T A T I O N S 193
( )
log10 ω ω . Create the corrected Bode phase plot for the original
0
m
V ln L
m0
s=
D gTSFC