SlideShare ist ein Scribd-Unternehmen logo
1 von 415
Downloaden Sie, um offline zu lesen
AN INTRODUCTION TO NUMERICAL
METHODS USING MATHCAD
Mathcad Release 14
Khyruddin Akbar Ansari, Ph.D., P.E.
Professor of Mechanical Engineering
School of Engineering and Applied Science
Gonzaga University
Spokane, Washington
Copyright 2007 Khyruddin Akbar Ansari.
All rights reserved
No part of this book may be used or reproduced or distributed in any form , or by any means or
stored in a database or retrieval system, without the prior written permission of the author .
Mathcad screenshots are reprinted by permission of Parametric Technology Corporation (PTC).
Mathcad is a registered trademark of PTC, 140 Kendrick Street, Needham, MA 02494. All rights
reserved
Dedicated to my dear wife, Fatima
ABOUT THE AUTHOR
Khyruddin Akbar Ansari, who has been a professor of mechanical engineering at Gonzaga
University in Spokane, Washington, since 1986, received his bachelor’s degree in electrical
engineering from Osmania University, Hyderabad, India in 1964, his master’s degree in mechanical
engineering from the University of California at Berkeley in 1965 and his Ph.D. degree in
engineering mechanics from the University of Texas at Arlington in 1972. He did his doctoral
thesis work in the area of nonlinear vibrations of rotating blades under the guidance of the late
Professor Nils O. Myklestad. Professor Ansari has many years of varied industrial , teaching and
research experience, having been associated in the past with such organizations as Bell Helicopter,
Westinghouse Electric , Bell Aerospace, Brown and Root, King Fahd’s University of Petroleum
and Minerals and Battelle Pacific Northwest Laboratories .
At Gonzaga University, Professor Ansari is currently involved in the teaching of courses in the
areas ofengineeringmechanics,numerical methods,advancedengineeringmathematics,vibrations,
system dynamics and controls , and machine design. His research, which has been varied, has
resulted in several published articles and contributions to books including chapters in the
Encyclopedia of Fluid Mechanics and Developments in Offshore Engineering.
Professor Ansari is a member of the American Society of Mechanical Engineers and the American
Society for Engineering Education. He is also a registered professional engineer.
TABLE OF CONTENTS
Preface v
1. Basics of Mathcad. 1
1.1 Introduction 1
1.2 The Mathcad Screen 1
1.3 Exact Answers 3
1.4 Variables, Functions and Live math. 3
1.5 Feedback 4
1.6 Graphics 5
1.7 Graphing of Functions and Plotting of Data 5
1.8 Animations 7
1.9 The Mathcad Tutorials 7
1.10 Advantages of Mathcad 7
1.11 Computations in Mathcad 10
1.12 The Mathcad Window, Toolbars and Palettes 13
1.13 Mathcad Regions 15
1.14 Entering Math and Text 16
1.15 Mathcad Worksheets,Templates and Styles 17
1.16 Defining Variables 18
1.17 Defining Functions in Mathcad 19
1.18 Building and Editing Mathematical Expressions 21
1.19 Defining Range Variables 23
1.20 Defining Vectors and Matrices 24
1.21 Creating Graphs 28
1.22 Formatting Math, Text and Results 35
1.23 Using Units 39
2. Introduction to Numerical Methods. 43
2.1 The Use of Numerical Methods in Science and Engineering 43
2.2 Comparison of Numerical Methods with Analytical Methods 43
2.3 Sources of Numerical Errors and their Computation 44
2.4 Taylor Series Expansion 44
Problems 49
3. Roots of Equations. 53
3.1 Introduction 53
3.2 Methods Available 53
3.3 Bisection Method 53
3.4. The Regula Falsi or the False Position Method 58
3.5 Newton-Raphson Method 65
3.6 Use of Mathcad’s root and polyroots Functions 71
Table of Contents: i
3.7 Secant Method 72
3.8. Method of Successive Substitution 78
3.9 Multiple Roots and Difficulties in Computation 80
3.10. Solution of Systems of Nonlinear Equations 84
3.11 Solving Systems of Equations using Mathcad's
Given and Find Functions 86
3.12 Applications in Root-Finding 87
3.12.1 Maximum Design Load for a Column 87
3.12.2 Natural frequencies of Vibration of a Uniform Beam 89
3.12.3 Solving the Characteristic Equation in Control
Systems Engineering 91
3.12.4 Horizontal Tension in a Uniform Cable 93
Problems 96
4. Matrices and Linear Algebra. 103
4.1 Basic Matrix Operations 103
4.2 Use of Mathcad in Performing Matrix Operations 105
4.3 Solution of Linear Algebraic Equations by Using the Inverse 108
4.4 Solution of Linear Algebraic Equations by Cramer’s Rule 110
4.5 Solution of Linear Algebraic Equations Using the Function lsolve 112
4.6 The Eigenvalue Problem 114
4.7 Solving the Eigenvalue Problem with Mathcad 116
4.8 Application of the Eigenvalue Problem to Vibration Engineering 117
4.9 Application of the Eigenvalue Problem to Stress Analysis-
Determination of Principal Stresses and Principal Directions 125
4.10 Repeated Roots in the Determinantal Equation 128
4.11 Solution of Nonlinear Simultaneous Equations 131
Problems 134
5. Numerical Interpolation. 141
5.1 Linear Interpolation 141
5.2 The Method of Undetermined Coefficients 141
5.3 The Gregory-Newton Interpolating Polynomial 144
5.4 Interpolation Using Finite Differences 149
5.5 Newton’s Method Utilizing Finite Differences 151
5.6 The Lagrange Interpolating Polynomial 155
5.7 Interpolation Using Linear, Quadratic and Cubic Splines 158
5.8 Interpolation with Mathcad 159
5.9 Applications in Numerical Interpolation 168
5.9.1 Stress-Strain data for Titanium 168
5.9.2 Notch Sensitivity of Aluminum 169
5.9.3 Speech Interference Level 172
5.9.4 Load-Deflection Data for Elastomeric Mounts 175
Problems 177
ii AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
6. Curve-Fitting. 183
6.1 The Need to Fit a Function to Measured Data 183
6.2 The Method of Least Squares. 184
6.3 Straight Line Regression 185
6.4 Curve-Fitting with a Quadratic Function 188
6.5 Curve-Fit with a Power Function 191
6.6 Curve-Fitting with an Exponential Function 194
6.7 Curve-Fitting with a Linear Combination of Known Functions 199
6.8 Curve-Fitting with Polynomials. 203
6.9 Use of Mathcad's Regression Functions for Curve-Fitting 207
6.9.1 Linear Regression with Mathcad 207
6.9.2 Nonlinear Regression with Mathcad 209
6.9.3 Use of the Function linfit 211
6.9.4 Use of the Function genfit 213
6.9.5 Use of the Mathcad Functions logfit, lnfit, pwrfit and expfit 215
6.9.6 More Examples with Mathcad 220
6.10 Applications in Curve-Fitting 236
6.10.1 Fatigue Failure Curve for Loading in the Finite Life Range 236
6.10.2 Temperature Response of an Object Placed in a
Hot Stream of Air 239
6.10.3 The Effect of Operating Temperature on the Strength of a
Mechanical Element 242
6.10.4 Drop-Testing of Packaged Articles 245
Problems 248
7. Numerical Differentiation 255
7.1 Introduction to Numerical Differentiation and
the Use of the Mathcad Derivative Operators 255
7.2 Method of Finite Differences 255
7.3 Interpolating Polynomial Method 259
7.4 Applications in Numerical Differentiation 262
7.4.1 Determination of Velocities and Accelerations
from Given Displacement Data 262
7.4.2 Determination of Shock Absorber Parameters, and Damper
and Spring Restoring Forces from Given Vehicle Displacement Data 266
Problems 271
8. Numerical Integration 277
8.1 Introduction to Numerical Integration and
the Use of the Mathcad Integral Operator 277
8.2 The Interpolating Polynomial Method 279
8.3 Trapezoidal Rule 280
8.4 Simpson’s Rules 283
Table of Contents: iii
8.4.1 Simpson’s One-Third Rule 283
8.4.2 Simpson’s Three-Eighth Rule 286
8.4.3 Limitations of Simpson’s Rules 287
8.5 Romberg Integration 288
8.6 Applications in Numerical Integration 301
8.6.1 Centroid of a Rod Bent into the Shape of A Parabola 301
8.6.2 Moment of Inertia of a Beam of Semi-Elliptic Cross Section 302
8.6.3 Launch of a Projectile 303
8.6.4 Large Oscillations of a Simple Pendulum 304
Problems 306
9. Numerical Solution of Ordinary Differential Equations. 311
9.1 Introduction 311
9.2 Taylor Series Method 312
9.3 Euler’s Method 317
9.4 Modified Euler’s Method 323
9.5 Runge- Kutta Methods 329
9.5.1 Fourth-Order Runge-Kutta Method 329
9.5.2 Mathcad Solutions to a First-Order Differential Equation 335
9.6 Systems of Ordinary Differential Equations 341
9.7 Solution of Higher-Order Ordinary Differential Equations 349
9.8 Boundary-Value Problems and the Shooting Method 358
9.9 Applications in Numerical Solution of Ordinary Differential Equations 363
9.9.1 Response of an Electric R-L Circuit to a Unit-Step Voltage Input 363
9.9.2 Deflection Curve of a Cantilevered Beam with a Uniformly
Distributed Load 364
9.9.3 Temperature Response of a Solid Steel Ball Placed in a Hot
Stream of Air 366
9.9.4 Nonlinear Vibration of a Simple Pendulum 367
9.9.5 Transient Vibration of a Spring-Mass-Damper System
Excited by a Pulse Function 370
9.9.6 Nonlinear Vibration of a Damped System with a
Hardening Spring 373
9.9.7 Temperature Distribution in the Wall of a Pipe
Carrying a Hot Fluid 378
9.9.8 Response of an R-L Circuit with a Nonlinear Resistor 382
9.9.9 The Effect of Damping on the Step Response of a
Second-Order Control System 384
Problems 386
Bibliography 399
Index 401
iv AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
PREFACE
This book, which is designed to be used in a first numerical methods course in a computer science,
mathematics, science , engineering or engineering technology curriculum, has been developed from
notes that I generated over several years in the process of teaching a one- semester / three-credit
sophomore level course in computer methods at Gonzaga University. It should also provide a
reliable source of reference material to practicing engineers and scientists and in other junior and
senior-level courses such as machine design, vibrations, system dynamics and controls, where
Mathcad can be effectively utilized as a software tool in problem solving. A principal goal of this
book , then, is to furnish the background needed to create Mathcad documents for the generation
of solutions to a variety of problems. Specific applications involving root-finding, interpolation,
curve-fitting, matrices, derivatives, integrals and differential equations are discussed and the broad
applicability of Mathcad demonstrated. The material contained herein should be easily grasped by
students with a background in calculus, elementary differential equations and some linear algebra,
and when utilized in a mathematics, science, engineering, computer science or engineering
technology course sequence, it should give a good basic coverage of numerical methods while
simultaneously demonstrating the general applicability of Mathcad to problem- solving and
solution documentation.
The first chapter discusses Mathcad basics while the second gives a general introduction to
numerical methods in science and engineering and presents the computation of numerical errors
along with the Taylor series as a basis of approximation in numerical analysis. Chapter 3 offers a
coverage of the popular methods of finding roots of equations such as Bisection, Regula-Falsi,
Newton-Raphson, Secant and Iteration . Solutions to systems of nonlinear algebraic equations
obtained by the iteration method are also presented. The applicability of root-finding to practical
problems such as those that occur in column design, vibration analysis and control systems
engineering is demonstrated. In the fourth chapter, matrices and linear algebra are dealt with along
with the solution of eigenvalue problems. Applications to the field of vibration engineering and
stress analysis are also discussed. Chapters 5 and 6 focus on numerical interpolation and curve-
fitting respectively. The common techniques of interpolation and the functions generally resorted
to for curve-fitting of data are covered quite thoroughly. The applicability of these to the analysis
of scientific and engineering data such as stress-strain, load-deflection and fatigue failure is
presented. Chapters 7 and 8 address numerical differentiation and integration. The concept of finite
differences is introduced and the common methods of differentiation and integration , such as the
interpolating polynomial method, trapezoidal and Simpson’s rules and Romberg integration are
covered. Applications of numerical differentiation and integration such as determination of
velocities and accelerations from given displacement data and computation of the moment of inertia
of a cross section are included. The last chapter, which is the ninth one, deals with coverage of
numericalsolutionofordinarydifferentialequations,andalthough it does not discuss each and every
technique that is available, it does focus on the popular ones such as Taylor series method, Euler,
modified Euler and Runge-Kutta methods. A variety of practical applications of numerical
procedures are included in this chapter, ranging from the response of an electric circuit to an input
Preface: v
voltage to the effect of damping on the response of a control system. Partial differential equations
is a topic that is typically dealt with in detail only in graduate level courses and , therefore, I did not
think it very appropriate to introduce it in this book which is really aimed at the needs of
undergraduate students. Mathcad documents are generated and examples showing the applicability
and use of Mathcad are presented throughout the book. Wherever appropriate, the use of Mathcad
functions offering shortcuts and alternatives to otherwise long and tedious numerical solutions is
also demonstrated. At the end of every chapter is included a set of problems to be solved covering
the material presented. A solutions manual that provides solutions to these exercises can be made
available to instructors.
Although Mathcad is a very powerful and versatile tool that combines text, graphics and equations
in a single worksheet, several figures and sketches in the book had to be done using AutoCad. The
help provided by Carlos G. Alfaro earlier in generating these figures and Ryan Lambert later in
making some additions and modifications to them is gratefully acknowledged. I am also thankful
to those of my students who have so kindly made useful suggestions and pointed out errors and
mistakes in the manuscript. Their input and feedback have certainly been helpful. Last but not least,
I am indebted to my wife, Fatima , for her patience, support and understanding during the
preparation of this book. Without her encouragement, its completion would still be wishful thinking.
Users of this book are welcome to e-mail any comments and suggestions to me at
ansari@gonzaga.edu , and, of course, I will be pleased to address these in subsequent versions /
editions.
Khyruddin . Akbar Ansari
October 2007
vi: AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
C H A P T E R 1
BASICS OF MATHCAD
1.1 INTRODUCTION
Mathcad 14 is the first global release of Mathcad presented by Parametric Technology
Corporation (PTC) with many significant enhancements since it acquired Mathsoft in April 2006.
This is a very powerful software that offers a wide variety of tools in the solution of problems
requiring the use of numerical analysis. New ways of using Mathcad are constantly being found
leading to overwhelming possibilities. The sections that follow give an overview of the features in
Mathcad 14 and will help the novice to get introduced to its problem-solving capabilities.
Mathcad 14 has a number of improvements and added capabilities designed to increase the
productivity of the user as well as Web connectivity. There is a wealth of information that can
be found by clicking on "Help" and going to "Tutorials" , where you can get an overview and a
quick tour of Mathcad , see the new features available in Mathcad 14, learn the fundamental
skills for working in Mathcad, and obtain on-line help if needed. By clicking on "Help", the
Mathcad Quicksheets can be accessed, which are ready-made recipes for performing a variety
of tasks in Mathcad. E-books and Reference Tables, user-contributed files, samples,
animations and graphs along with other example files for using and extending Mathcad can also
be accessed. By choosing "User Forums" under the "Help" menu, questions can be posted
for other Mathcad users. The Mathcad web site can always be accessed for updates, technical
support information and user files , and Mathcad documents can now be saved on the Web or
in Microsoft Word using Rich Text Format (RTF).
1.2 THE MATHCAD SCREEN
Mathcad has a full screen numerical and symbolic calculator, which is essentially a blank
workspace that you see when you open up a new Mathcad document. To use Mathcad's
calculating capabilities, type the expression you want to evaluate and then type an equals sign
to get the result:
435
57
24
+ 437.375
=
As shown in Figure 1.1. the palette buttons open up palettes that include a host of math
operations . An expression such as the following can be assembled quite easily.
sin
π
8
⎛
⎜
⎝
⎞
⎟
⎠
ln 76.5
( )
e
95.2
⋅ 1.952 10
40
×
=
Chapter 1: Basics of Mathcad 1
Figure 1.1 The Math palettes
2 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Matrix arithmetic, calculus operations such as differentiation and integration, and essentially all
of the mathematical operations normally required in engineering and scientific analysis can be
easily done in Mathcad. Some examples are given below.
2
7
x
e
2x
sin 4 x
⋅
( )
⋅
⌠
⎼
⌡
d 2.641 10
5
×
=
7 9i
+
13 7i
−
0.128 0.761i
+
=
5
4
7
2
8
3
7
9
6
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
1
− 0.168
−
0.312
−
0.352
0.072
−
0.152
8 10
3
−
×
0.304
0.136
0.256
−
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
=
1.3 EXACT ANSWERS
If exact answers are needed in terms of fractions and radicals instead of decimals, the
"symbolic equals sign" (-->) on the fourth math palette can be used to obtain exact answers.
Some examples are given below.
546
59
17
+
9341
17
→
sin
π
16
⎛
⎜
⎝
⎞
⎟
⎠
ln 75.6
( )
e
90.5
⋅ 9.0751625112586372168e37
→
5
4
9
2
8
3
3
9
5
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
1
−
13
7
61
7
60
7
−
1
7
−
2
7
−
3
7
6
7
−
33
7
−
32
7
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
→
2
7
x
e
2 x
⋅
sin 4 x
⋅
( )
⋅
⌠
⎼
⌡
d
cos 8
( ) e
4
⋅
5
cos 28
( ) e
14
⋅
5
−
e
4
sin 8
( )
⋅
10
−
e
14
sin 28
( )
⋅
10
+
→
1.4 VARIABLES, FUNCTIONS AND LIVE MATH
When there is a need to evaluate an expression for several different inputs, the desired
variables and functions can be defined and calculated like built-in constants and functions.
This computational feature in Mathcad is called live math.
Chapter 1: Basics of Mathcad 3
For example, if the area of a circle for various values of the radius is to be calculated, define a
radius variable r and give it a value.
r 8
:=
The := symbol can be inserted by typing a colon. Evaluate the area as
π r
2
⋅ 201.062
=
The numerical value of r can now be changed to some other number . Click anywhere outside
the definition to recalculate the area . . This is live math .
If this area computation is to be usable in other parts of the worksheet, an area function must
be defined.
area r
( ) π r
2
⋅
:=
Use this function as needed to calculate an area . Length units for the radius can also be
assigned as shown..
area 60 cm
⋅
( ) 1.131 m
2
=
Live math works for symbolic answers as well. Put in a function , obtain the derivative of the
function, and then change the function to some other function. Click outside the definition to
see how Mathcad redoes the derivative symbolically.
1.5 FEEDBACK
There is continuous feedback in Mathcad. As you edit math expressions, the status line will
provide advice and information . When Mathcad cannot understand something, it will color the
expression red. Clicking on this red expression will give an error message indicating what is
wrong. To see an example, click on the expression below.
p q
+ =
p
In the above, variables p and q were not defined. Therefore, Mathcad tells us so. Also,
Mathcad calculates from top to bottom and left to right.
p 5
:= q 9
:= <--This works ---> p q
+ 14
=
4 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
F 4
( ) =
F <-This does not work
F x
( ) x
2
4
−
:=
1.6 GRAPHICS
It has been demonstrated that Mathcad can be used as a calculator and as an equation solver.
It can also be used as a versatile visualization tool that supports a full set of plot types, an
animation facility, as well as simple image processing.
1.7 GRAPHING OF FUNCTIONS AND PLOTTING OF DATA
To create a plot in Mathcad, type the expression you would like to plot, say t
9
. Then click the
graphing button on your palette bar (See Figure 1.2 ) to bring up the graphing palette and click
the upper left button for an XY plot. Click outside the graph or press [Enter] to see the result:
4
− 2
− 0 2 4
1
− 10
5
×
5
− 10
4
×
0
5 10
4
×
1 10
5
×
t
9
t
Parametric plots can also be done easily . .
1
− 0.5
− 0 0.5 1
1
−
0.5
−
0
0.5
1
sin 5 t
⋅
( )
cos 7 t
⋅
( )
Chapter 1: Basics of Mathcad 5
Figure 1.2 The graph palette
6 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
. . . and like all Mathcad calculations, plots are also live, which means that changes can be
easily made.
1.8 ANIMATIONS
Mathcad can create and play short animation clips by using the built-in variable FRAME and
the Animation dialog box. Choose Animation, and then Record from the Tools menu to bring
up this dialog box Plots as well as numerical results can be animated, and the animation
played back at different speeds.
1.9 THE MATHCAD TUTURIALS
The Mathcad tutorials offer a step-by-step guide to building and editing expressions, creating
and formatting graphs, using Mathcad's wordprocessing capability to enter and format text,
working with units and utilizing Mathcad's built-in functions and operators. For a Mathcad
novice, this is a good place to begin. The Mathcad tutorials can be accessed as indicated in
Figure 1.3 by choosing Help and then Tutorials .
1.10 ADVANTAGES OF MATHCAD
Mathcad offers a great way to work with equations, numbers, text, and graphs. Unlike other
programs, Mathcad uses the language of mathematics and does mathematics in a very natural
way. It works like a scratchpad and pencil combination . Mathcad's on-screen interface is a
blank worksheet on which equations, graph data or functions can be entered and combined
with text -- anywhere on the page.
In Mathcad, an equation looks exactly as in a textbook :
x
b
− b
2
4 a
⋅ c
⋅
−
+
2 a
⋅
=
Mathcad's equations and graphs are live, which means that any data, variable, or equation can
be changed with Mathcad doing an instant recalculation and redrawing of the graphs.
Mathcad can solve a wide range of problems, numerically as well as symbolically, and
equations and data can be evaluated with 2D and 3D plots.
Mathcad Quicksheets are full-featured worksheets that offer ready-made Mathcad templates
that can be customized to perform a wide range of mathematical tasks from solving equations
to graphing and calculus. They also demonstrate how some of Mathcad's special features like
programming and animation can be used. Choose Help and then QuickSheets to use this
capability.
Chapter 1: Basics of Mathcad 7
Figure 1.3 Accessing the Mathcad tutorials
8 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Mathcad's Electronic Books have a wealth of mathematical knowledge and reference
material -- all live - which can be dragged and dropped into your worksheets. In order to do
this, choose Help and then E-books .
Mathcad has proven to be an extremely remarkable , effective and powerful tool for the
solution of problems. A wide range of problems can indeed be explored, formulated,
analyzed and optimized, after which the best solution can be documented and presented.
By choosing Help and then User Forums, users can connect with and share their work
with colleagues and other professionals around the world , and collaboration is easy . A
host of forums can be accessed as shown in Figure 1.4.
Figure 1.4 Accessing the Mathcad Collaboratory
Chapter 1: Basics of Mathcad 9
1.11 COMPUTATIONS IN MATHCAD
Figure 1.5 The Insert/ Function buttons in Mathcad
10 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Several mathcad palettes can be found on the palette strip at the top of the window that give
access to Mathcad's mathematical operators. A click in your worksheet will place a red
crosshair cursor. Math operators can now be placed in the worksheet via these palettes. To
access Mathcad's built-in functions, go to the Insert menu as shown in Figure 1.5, and
select Function , or click on the Insert Function button on the toolbar
.
EXAMPLES
In the following examples, the number of decimal places required may be put in by choosing
Result from the Format menu and then selecting Number Format.
The red crosshair
Use the Arithmetic Palette (See Figure 1.1)
, and type = to obtain the answer. The basic
operations are +, -, *, and / which are
available on the keyboard .
2.645 10
8
⋅
30007
5
5
6
+
1.0426928428 10
7
−
×
= <--
<- Examples of built-in functions (See
Figure 1.5)
log 1768.985
( ) sin
4
79
π
⋅
⎛
⎜
⎝
⎞
⎟
⎠
⋅ 0.514
=
14.95 5.7i
( )
+
[ ]
3
e
6 5i
−
+ 1.999 10
3
× 4.024i 10
3
×
+
= <-- Complex numbers.
Use of units- Choose Unit from
the Insert menu (See Figure 1.5)
<--- .
7600 km
⋅
1 hr
⋅
2.11 10
3
× m s
1
−
⋅
=
Use of := by typing a colon
character or using the
Arithmetic Palette
a 8
:= a
3 a
4
+ 513.414
= <----
f x
( )
sin x
( )
a
x
6
+
:= f 37
( ) 0.045
−
= <-- Use of a defined function
Chapter 1: Basics of Mathcad 11
Use of the range operator in the
Arithmetic Palette. You can also use
a semicolon (;). This will evaluate
any function of z for z values from
zero to 1 in increments of 0.2
z 0 .2
, 1
..
:= <--
z
0
0.2
0.4
0.6
0.8
1
= f z
( )
0
0.025
0.048
0.07
0.088
0.103
= cos f z
( )
( ) z
⋅
0
0.2
0.4
0.599
0.797
0.995
=
<-- Create these tables by
typing z=, f(z)=, etc.
x 0 0.2
, 20
..
:= <-- Define a range of values for the plot.
0 5 10 15 20
0.2
−
0.1
−
0
0.1
0.2
f x
( )
cos x
( ) f x
( )
x
Use the X-Y Plot button in
the Graph Palette, and type
expressions to be plotted in the middle
placeholders on the x and y axes.
Several expressions separated by a
comma (,) can be entered in these
placeholders.
<--
0
100
n
1
n! cos 2 n
⋅
( )
⋅
∑
=
2.28758499
−
=
Use the Calculus Palette (See
Figure 1.1) to do sums, derivatives
and integrals. Click in your worksheet
to position the red crosshair, click on
the proper button in the palette, then
fill in each placeholder as appropriate .
<--
0
25
x
1
1 x
3
e
x
⋅
+
⌠
⎼
⎼
⎼
⌡
d 0.842
=
x 5
:=
x
e
x
sin x
( )
⋅
( )
d
d
100.218
−
=
12 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Matrices can be entered using the
Vector and Matrix palette or by going
to the Insert menu and choosing
Matrix .
A
3
1
1
7
5
10
1
6
2
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
:= <--
A
1
−
0.427
0.034
−
0.043
−
0.034
0.043
−
0.197
0.316
−
0.145
0.068
−
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
= <-- Type A ^-1= to obtain the inverse
A 117
−
= <-- Use the Vector and Matrix Palette to
obtain the determinant.
t 2.5
:= root t
4
cos 3 t
⋅
( )
− t
,
( ) 0.502
= <-- Find the root of an
expression using the root
function, starting with the guess
of t =2.5
1.12 THE MATHCAD WINDOW, TOOLBARS AND PALETTES
The Mathcad Window and the Main Menu
This does math, graphics and symbolic algebra besides handling the editing and management
of a worksheet. The array of computational and formatting capabilities available can be seen by
clicking on each of the menus.
The Math Toolbar
This is below the main menu. It opens up palettes of math operators as described below.
Chapter 1: Basics of Mathcad 13
Calculator toolbar Boolean toolbar
Graph toolbar Programming toolbar
Matrix toolbar Greek toolbar
Evaluation toolbar Symbolic toolbar
Calculus toolbar
Just click on one of these as appropriate and start inserting math symbols into the
worksheet.
The Standard Toolbar
This provides shortcuts for many common tasks from opening and saving files, cutting and
deleting to spell checking and bringing up lists of built-in functions and units. Hover over each
button to see tooltips with a brief description.
The Formatting Toolbar
This formats your text and math at the click of a button. In case the Format Bar does not
show, go to the View Menu, select Toolbars and then Formatting.
The Resources Window and E- books
If you seek examples, want information that can be utilized in your Mathcad worksheets or wish to
access web information from within Mathcad, go to the Help menu, and then open Tutorials,
QuickSheets , Reference Tables or E-books. Tutorials includes Getting Started Primers,
Migration Guide and Features In-Depth, while Quicksheets are live examples showing the use of
Mathcad functions, graphs and programming features. Information on physical constants,
chemical and physical data and mathematical formulas in Mathcad format can be found in
Reference tables . Mathcad E-books can be accessed by opening E-books. These E-books
have the advantage that all equations are live in them and you can change the values of variables,
constants etc. to test and evaluate different results. A number of Mathcad E-books and articles are
also available in the Resources section on http://www.ptc.com/go/mathsoft/mathcad/.
14 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Controlling Calculation and The Status Line
The calculation mode, whether manual or automatic, is a property saved in your worksheet and
template files. Mathcad starts in the automatic mode and all calculations and results are updated
automatically. The word " Auto " can be seen in the message line at the bottom of the Mathcad
window. This line provides status alerts, tips, keyboard shortcuts, and other helpful information
along with the calculation status of the worksheet . Here, "auto" refers to the automatic
mode , in which Mathcad automatically recalculates any math expressions when changes in the
worksheet are made. When "WAIT" appears on the status line, the cursor changes to a flashing
lightbulb, indicating that Mathcad is still completing computations. Besides giving the page
number of the current worksheet, the message line will also indicate whether the Caps Lock or
the Num Lock key is depressed on your keyboard. In manual mode, Mathcad does not
compute or show results until recalculation is specifically requested. However, while in manual
mode, Mathcad does keep track of pending computations . Once a change is made that requires
recalculation, the word " Calc " appears on the status line to indicate to the user that the results
being displayed are not correct and that recalculation is necessary to ensure accuracy. The
screen can then be updated by going to the Tools menu and choosing Calculate and then
Calculate Now . Alternatively, click = on the Standard toolbar or press [F9]. To force
Mathcad to recalculate all equations in the worksheet, go to the Tools menu and choose
Calculate and then Calculate Worksheet .
1.13 MATHCAD REGIONS
Mathcad allows you to enter equations, text and graphs as separate objects anywhere in the
worksheet and each equation, text paragraph or plot is considered a region. A region can be
selected by clicking in math or text in your worksheet, after which it is indicated by a thin
rectangle around it. Moving the cursor to one of the edges of the region, will change it to a
small hand with which the region can be moved to anywhere in the worksheet. While clicking
in the math region will bring blue selecting lines under the material selected, clicking in a text
region will bring black boxes to each corner and the middle of each line. With these boxes
text regions can be resized as needed. To add a border around a region or regions, select the
region(s), then right-click and choose Properties from the menu. Then click on the Display tab
and check the box next to " Show Border ".
A math region looks like: A text region looks like:
x 1535.56
:= What is shown on the left was
created by typing
x:1535.56
Chapter 1: Basics of Mathcad 15
Moving Regions in the Worksheet
This can be accomplished by clicking in a region and drag-selecting it to put it in a dashed
selection box and then moving the cursor to the edge where it shows up as a small black
hand. Now, use the mouse to move the region as necessary by holding down the left
mouse button and dragging it. Once the regions are positioned in the desired manner, the
mouse button may be released . Then, an empty part of the screen may be clicked on to
deselect the regions. Alternatively, choose Regions from the View menu, which will
highlight the boundaries of the region against a contrasting background. Cut and Paste
can also be used to move regions. Once regions are inserted in the worksheet, they can
be aligned horizontally or vertically by going to the Format menu and choosing Align
Regions.
How Mathcad Reads Your Document
Mathcad reads your document from left to right and top to bottom . For example, if the value of
a function , ln(y) is desired for y= 67, either of the following setups will work.
(a) y 67
:= ln y
( ) 4.205
=
(b) y 67
:=
ln y
( ) 4.205
=
Deleting Selected Regions
Selected regions in dashed line boxes can be deleted by choosing Cut from the Edit menu.
Copying and Pasting Selected Regions
Selected regions can also be copied and put into any place within a document or into another
document by choosing the Copy and Paste commands from the Edit menu .
1.14 ENTERING MATH AND TEXT
Entering Math
Math can be entered by clicking the mouse in a blank space to see a red crosshair cursor.
Type
1+
which will get you
16 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
on the screen. The little black box delimited by blue editing lines that you see is called a
placeholder . Continue typing. Type 6 in the placeholder and press the equals key (=) to see
the result.
1 6
+ 7
=
The Arithmetic Palette can be seen by clicking on the Math Palette. This is shown below
Math Palette button
Operation Keystroke Button
Addition +
Subtraction -
Multiplication *
Division /
Powers ^
Entering Text
A text region can be created by clicking in a blank space to see the red crosshair cursor.
Then choose Text Region from the Insert menu or type the double quote (") . The
crosshair transforms to an insertion point with a black text box around it.
1.15 MATHCAD WORKSHEETS, TEMPLATES AND STYLES
Creating and Using Templates
Mathcad styles and templates are similar to those of any word-processing software. When
you create a new worksheet in Mathcad, you can start with Mathcad's default choices, or you
Chapter 1: Basics of Mathcad 17
can use a template containing customized formats. Several predefined templates are available
each with a variety of styles, and if necessary, new templates can also be created. Any
Mathcad worksheet can be saved as a new template. To create a new worksheet based on a
template, choose File/New , and then select a template from the list, or browse to your own
template directory. In the placeholders, substitute your own text or bitmaps in any of the
placeholders, or use the built-in styles. You can also revise them if needed. When you create
a worksheet based on a template, all of the formatting information, and any math, text and
image regions are copied into the new worksheet. By creating a new template or revising
another template , a customized format can be generated. Text styles and number formats
can be created, number formats, fonts and sizes can be set, bitmaps can be added , and also,
page numbers, filenames and dates can be inserted . Thus, by using templates, you maintain
consistency across multiple worksheets through definition of math styles, text styles, printing
margins, numerical result formats, units etc. To save a template, choose Save As from the
File menu and use the file extension .mct. The settings, styles and bitmaps saved will be
available for the next file you may want to create, leading to greater consistency in your files.
Using Styles
The use of Text Styles allows you to create a consistent appearance in your worksheets.
Styles in each template are available by choosing Style from the Format menu. Any specific
style with a defined font, size, etc. can be applied to a text region. To create or modify a style,
again choose Style from the Format menu . To save your styles for use in new files, you
must make a template file. Math Styles can be used to assign specific fonts, font sizes etc. to
mathematical expressions. There are predefined ones but additional styles can be defined and
applied. This can be accomplished by going to the Format menu and choosing Equation.
1.16 DEFINING VARIABLES
There are times when the value of a number may need to be changed several times in a
document . Such a number is termed a variable . Let Apples be, then, a variable . Type
Apples:50
to see on the screen
Apples 50
:=
By doing the above, we have given the value of 50 to the variable Apples . Similarly, another
variable Unitprice can be defined
18 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Unitprice 0.35
:=
A third variable can also be defined as
Totprice Apples Unitprice
⋅
:=
Type
Totprice=
to see on the screen
Totprice 17.5
=
Now, if new values need to be given to Apples and to Unitprice, change the numbers
above as necessary and the result which is Totprice will also change accordingly as
shown below.
Apples 75
:= Unitprice 0.40
:= Totprice Apples Unitprice
⋅
:=
Totprice 30
=
1.17 DEFINING FUNCTIONS IN MATHCAD
The value of a function depends on the values assigned to its arguments. For example, to
define a function f(x), type
f(x):x^7
to see on the screen
f x
( ) x
7
:=
Putting in a numerical value of 6 as the argument of f(x) will give
Chapter 1: Basics of Mathcad 19
f 6
( ) 2.799 10
5
×
=
This can also be accomplished by doing
x 6
:= f x
( ) 2.799 10
5
×
=
If a range of values for the argument is given
x 1 6
..
:=
f(x) will yield a table of numbers as shown below
x
1
2
3
4
5
6
= f x
( )
1
128
3
2.187·10
4
1.638·10
4
7.813·10
5
2.799·10
=
In addition to defining a customized function, Mathcad's library of built-in functions can
also be utilized. To do this, select Function from the Insert menu, or click on the
function button on the toolbar
The Insert Function dialog box, shown below, will allow insertion of a function name
directly into the placeholder
Built-in functions can also be inserted directly from the keyboard. Some examples are given
below.
Trigonometry and Logarithms
ln 56
( ) 4.025
= cos 50 deg
⋅
( ) 0.455 2
⋅
= asinh 0.95
( ) 0.846
=
20 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Matrix Functions
identity 6
( )
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
= cols identity 6
( )
( ) 6
=
1.18 BUILDING AND EDITING MATHEMATICAL EXPRESSIONS
Building Mathematical Expressions
In Mathcad, various parts of an expression are assembled by observing the rules of precedence
and some additional procedures that enable entering denominators, exponents and expressions
inside of radicals. The following examples will illustrate the process.
Example 1
To create
Chapter 1: Basics of Mathcad 21
f x
( ) x 6
+
( ) x
3
5
−
( )
⋅
:=
Type
f(x):x+6[Spacebar]*(x^3[Spacebar]-5)
Example 2
To create
f x
( ) x 765 x
6 4
−
( )
⋅
+
:=
Type
f(x):x+765*(x^6-4)
The exponent operator is called a sticky operator because unless you get out by pressing
[Spacebar] , your keystrokes will "stick" to the exponent . This stickiness applies to
exponents, square roots, subscripts, and division.
Example 3
To create the expression
x
7
675
+
780
Type
x^7[Spacebar] <-- Puts x 7 in blue editing lines
+675[Spacebar] <-- Puts the whole equation in the editing lines
/780[Enter] <-- Expression is complete
Example 4
To create
22 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
x
7 675
780
+
do the same as above but without pressing the spacebar after +675
Example 5
To create
x
17
t
7
450
type
x^17/t^7[Spacebar][Spacebar][Spacebar]/450
Editing Expressions
The equation editor functions very much like a text editor and goes from left to right. Most
problems dealing with editing equations stem from working with operators. Although Mathcad
automatically inserts parentheses wherever necessary, the Mathcad user must put in
parentheses himself in accordance with his own judgement to give clarity to expressions .
When expressions become complicated, it is definitely preferable to work with smaller and
more manageable subexpressions within them. The reader is referred to Chapter 4 of the
Mathcad 14 User's Guide for a detailed discussion on Editing Expressions. This can be
accessed by choosing Tutorials from the Help menu.
1.19 DEFINING RANGE VARIABLES
To assign a range of values to a variable x going from 0 to 30, say, with an increment
of 3, type
x:0,3;30
The result on the screen will be
x 0 3
, 30
..
:=
To evaluate a function f(x) for x= 0 to 7 with an increment of 1, type
x:0;7 f(x):x^5[Spacebar]-6*x^3[Spacebar]+9
Chapter 1: Basics of Mathcad 23
to see on the screen
x 0 7
..
:= f x
( ) x
5
6 x
3
⋅
− 9
+
:=
Now, typing x= and f(x)= will give the following output table on the screen
x
0
1
2
3
4
5
6
7
= f x
( )
9
4
-7
90
649
3
2.384·10
3
6.489·10
4
1.476·10
=
If the range is to have increments other than 1, which is the default value, the next value in the
range must be entered. The following will provide a range of x values going from 2 to 4 with
increments of 0.5 and the corresponding f(x) values.
x 2 2.5
, 4
..
:=
x
2
2.5
3
3.5
4
= f x
( )
-7
12.906
90
276.969
649
=
1.20 DEFINING VECTORS AND MATRICES
To create a vector or a matrix in Mathcad, the dimensions of the array must be chosen and the
placeholders must be filled in.
24 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Figure 1.6 Inserting matrices in Mathcad
Chapter 1: Basics of Mathcad 25
To create a vector V , click in a blank space, Choose Matrix from the Insert menu (See
Figure 1.6 ) or click on the button inside the Vector and Matrix Palette . Then, fill in the
appropriate number of rows and columns, click on Insert and finally fill in the placeholders with
given values. To move from placeholder to placeholder inside the vector, use [Tab] or click on
the appropriate placeholder to select it
V
7
8
9
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
:=
To access a particular element of a vector, use the subscript operator , which can be
created by typing a left square bracket ( [ ), or by using the Xn button in the Matrix
Palette .
In Mathcad , by default the first element has the index 0. Type
V[0=
to see on the screen
V0 7
=
The next two elements will have indices 1 and 2 Thus typing V[1= and V[2= will
produce on the screen
V1 8
= V2 9
=
In order to obtain all the elements of the vector at the same time, the index can be defined
as a range variable as shown below::
i 0 2
..
:= giving Vi
7
8
9
=
<--- Type V[i=
The elements of a vector can also be used as the arguments of a function as shown below.
Define a function f(x) as.
f x
( ) sin 2 x
⋅
( ) cos 3 x
⋅
( )
+
:=
Let a vector V be a three-element vector as given below
26 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
v
1.3
2.6
−
7.9
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
:=
Then, typing i:0;2 and then f(v[i)= will show the following on the screen
i 0 2
..
:= f vi
( )
-0.21
0.937
0.046
=
The Vector and Matrix Palette contains most of the common matrix and vector operators.
These are listed below.
Operation Keystroke
Palette
Button Display
Dot product [Shift]8 v w
⋅ Displays like scalar
multiplication.
Cross product [Ctrl]8 v w
×
Determinant | M
Column [Ctrl]6 M
2
〈 âŒȘ
Returns the 2nd
column of M.
There is also a wide range of built-in functions in Mathcad that return information about the
size of an array and its elements. For a given matrix [M], various pieces of information can
be generated as shown below.
M
9
4
12
10
5
13
11
7
14
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
:=
Chapter 1: Basics of Mathcad 27
Number of columns: cols M
( ) 3
= Number of rows: rows M
( ) 3
=
Largest value in matrix: max M
( ) 14
= Determinant of matrix: M 3
=
Eigenvalues of a matrix: eigenvals M
( )
28.768
0.176
−
0.592
−
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
=
1.21 CREATING GRAPHS
To create an x-y plot, choose Graph/ X-Y Plot from the Insert Menu as shown in Figure
1.7. Press [Enter] and fill in the placeholders on the x and y axes. Alternatively, type an
expression depending on one variable such as: sin(x) + cos (3x) and click on the X-Y Plot
button on the Graph toolbar . The resulting plot will be
x 10
− 9.9
−
, 10
..
:=
10
− 5
− 0 5 10
2
−
1
−
1
2
sin x
( ) cos 3 x
⋅
( )
+
x
28 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Figure 1.7 Creating graphs in Mathcad
X-Y Plot Button
Chapter 1: Basics of Mathcad 29
Using Range Variables to Plot a Function
The range of values being plotted on the x-axis must, in general, be specified. If this range is
not prescibed by you, Mathcad will choose a default range for the dependent variable. For
example, let us plot
f x
( ) x
3
8 x
2
⋅
+ 9 x
⋅
+ 14
+
:=
The graph of this function over the range x= 0 to x= 6 can be accomplished as follows.
x 0 1
, 6
..
:= f x
( ) x
3
8 x
2
⋅
+ 9 x
⋅
+ 14
+
:=
Now create the plot by clicking in the worksheet window. Type @ to create the x-y plot, type
x in the middle placeholder on the horizontal axis and type f(x) in the middle placeholder
on the vertical axis. Press [Enter] . The following graph should then appear on the screen.
0 2 4 6
0
200
400
600
f x
( )
x
The plot generated above does not seem to be very smooth. In order to obtain a smoother
trace, change the definition of x to x 0 0.1
, 6
..
:= . The smaller step enables Mathcad to
calculate more points. This will make the plot a lot smoother (see graph below ) because now
there are more points or dots being connected together.
Formatting of an x-y plot can be accomplished as follows. Double-click on it or choose Graph
from the Format menu to open up a dialog box. This dialog box will allow several options in
terms of grid lines, legends, trace types, markers, colors, axis limits etc.
30 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
x 0 0.1
, 6
..
:=
0 2 4 6
200
400
600
f x
( )
x
Plotting a Vector of Data Points
Let us say that we need to plot a vector of data points called Temp , which is the rising
outside temperature on different days of a week in a summer month. This vector which will
have 7 rows and 1 column can be created using the Matrix command on the Insert menu.
Temp
78
82
84
86
88
90
92
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
:=
This data can be graphed by making the horizontal axis an index variable or a vector with
the same number of elements as the vector Temp . Define the index i as:
i 0 6
..
:=
Create your plot by typing [@] and typing in
Temp[i
Chapter 1: Basics of Mathcad 31
In the placeholder on the y axis, and i in the placeholder on the x axis. The resulting plot
should be
0 2 4 6
75
80
85
90
95
Tempi
i
Notice here that box symbols have been used on a dashed line.
Alternatively, two vectors of equal size can be plotted against each other. Thus, the second
vector which will be called day is defined as
day
1
2
3
4
5
6
7
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
:= Temp
78
82
84
86
88
90
92
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎟
⎠
=
Now create the plot by typing @ , as was done previously, and type day in the
placeholder on the x-axis and Temp in the placeholder on the y-axis
The resulting plot should look like this
32 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
0 5 10
70
85
100
Note that the symbol type used here is O's , and the grid lines have been turned off on both
axes.
Plotting a Function of Vector Elements
Sometimes, a function may need to be plotted over points that are not evenly spaced . As an
example, let us define a function
f x
( ) 3 x
3
⋅ 5 x
2
⋅
+ 9 x
⋅
+ 12
+
:=
to be plotted over the range x as shown: -2.0, 0,3.50,10, 15. In order to do this, x has to be
defined as a vector of the given numbers in the prescribed range. This can be done using the
Matrices dialog box with the placeholders properly filled in as shown.
x
2.0
−
0
3.5
10
15
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎠
:=
The index variable must be defined as i 0 4
..
:=
Now, type @ and fill in the middle placeholders on the x and y axes with xi and f xi
( ).
The resulting graph should be
Chapter 1: Basics of Mathcad 33
5
− 0 5 10 15
5
− 10
3
×
5 10
3
×
1 10
4
×
1.5 10
4
×
f xi
( )
xi
When plotting a function of a range variable , notice that the horizontal axis can be any set of
prescribed numbers and does not have to be in even increments
Plotting Several Functions on One Graph
Plotting multiple functions over a single domain on a single graph can be done by typing these
functions on the y- axis one after the other but separated by commas. For example, the
following should illustrate how the two functions sin(x) and cos(2x) can be plotted on the
same graph.
x 0 0.1
, 6
..
:=
0 2 4 6
1
−
0.5
−
0.5
1
sin x
( )
cos 2x
( )
x
34 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
1.22 FORMATTING MATH, TEXT AND RESULTS
Using the Format Bar in the Mathcad window, the appearance of the text as well as the
math can be altered quite easily, and different fonts, sizes and styles can be readily selected.
If the Format Bar is hidden, ensure that the Formatting bar on the View/Toolbars menu
is checked.
Formatting Text
Using the drop-down lists in the Format Bar, different fonts as well as point sizes can be
selected . Appropriate buttons must be clicked to generate special effects like boldface,
italics, etc. Several options become available upon choosing Text from the Format menu .
(See Figure 1.8).
Text Styles and Templates
Text styles provide consistency in the appearance of worksheets and enable the application of
text formatting to the text regions. Available text styles depend on the template used to create
a worksheet. To examine the different templates and text styles provided in Mathcad, choose
New from the File menu and modify them or create new ones.
Formatting Math
In Mathcad different font tags can be applied to variables and to constants. To make
changes in the font, click on a variable or constant in a math region and use the Format Bar.
Alternatively, you can choose Equation from the Format menu.
Highlighting of equations can also be done in Mathcad. To do this, click on an equation and
choose Properties/Highlight Region from the Format menu in the main worksheet
window. Below is shown an example of a highlighted equation.
S
1
n
i
ai xi
⋅
( )
∑
=
=
In Mathcad, you can specify how answers can be displayed in terms of the desired decimal
places, precision etc. Also, fonts and their sizes can be controlled and highlighting of
equations can be done as desired.
Chapter 1: Basics of Mathcad 35
Figure 1.8 Formatting text in Mathcad
Formatting Results and Graphs
To control the format of a result, double-click on the result , or click on the result and
choose Result from the Format menu . In the Number Format dialog box that shows
up, change the Exponential Threshold , and Number of decimal places as necessary
and click on OK . This will set the format only for this particular result. (See Figure 1.9 ).
However, if this needs to be done for the entire worksheet, click on a blank part of the
worksheet, and do the above .
36 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Figure 1.9 Formatting results in Mathcad
Chapter 1: Basics of Mathcad 37
The reformatting of graphs can be easily done using a dialog box generated by double-
clicking on the plot, or by going to Insert/Graph/X-Y Plot and clicking on the Traces
tab shown in Figure 1.10. Under the " Legend label " column, type the desired name of
the trace . Symbols, line types, colors, trace types, etc. can all be controlled by clicking
on the appropriate options. Finally, preview the changes and click OK to finalize them .
An example is shown at the end of this section.
Figure 1.10 Formatting graphs in Mathcad
38 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
f x
( ) sin x
( )
:= g x
( ) cos 3 x
⋅
( )
:= h x
( ) f x
( ) g x
( )
+
:= x 10
− 9.9
−
, 10
..
:=
10
− 5
− 0 5 10
2
−
1
−
0
1
2
sin(x)
cos(3x)
sin(x)+cos(3x)
Graphing Functions and labelling Plots
x- values
y-values
f x
( )
g x
( )
h x
( )
x
1.23 USING UNITS
Although units are not required to be put into Mathcad equations, a great feature within
Mathcad is its ability to track standard units during calculations and to automatically perform
conversions. The program will also flag incorrect and inconsistent dimensional calculations,
and mixing and matching of units can be done as desired.The default system in Mathcad is
the SI unit system
To define a variable in terms of the built-in unit kilometers , for example, just multiply the
given number by km. Type
R:4*km
to see on the screen
R 4 km
⋅
:=
Chapter 1: Basics of Mathcad 39
Figure 1.11 Inserting units in Mathcad
40 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
The equation for a circular area of radius R now will automatically generate the result in terms
of the appropriate units
A π R
2
⋅
:= A 5.027 10
7
× m
2
=
Note that the above result is automatically shown in terms of the base units of the default
unit system, which, in this case, is SI. To change this result to feet , for example, click in
the name of the unit that you want to replace, then drag-select it and type in the new desired
unit in its place. Finally click outside the equation to see the new result. Alternatively, click
in the placeholder next to the unit name , go to Insert/Unit (See Figure 1.11) , click on the
appropriate Dimension name, then double-click on the unit name desired , and finally click
outside the equation to see the desired result.
R 1.312 10
4
× ft
⋅
=
To see a list of buit-in units in Mathcad, go to the Insert menu . The following equivalents can
be easily generated using the procedures described above.
Work 14000. J
⋅
:= Work 1.4 10
4
× m
2
kg s
2
−
⋅
⋅
= Work 13.269 BTU
⋅
=
Power 2000 kW
⋅
:= Power 2.682 10
3
× hp
⋅
=
Force 1500lbf
:= Force 6.672 10
3
× N
⋅
=
A calculation involving mixing of units is shown below. Although each term in the calculation is
expressed in a different unit of length, the result is calculated in the base SI unit for length,
namely, meters
6 ft
⋅ 30 in
⋅
+ 1.4 m
⋅
+ 0.8 yd
⋅
+ 4.722 m
=
The following calculation, obviously, cannot be completed and Mathcad indicates the same.
7 ft
⋅ 6 sec
⋅
+ =
6 sec
⋅
Click on the expression to see the error message,which is:
This value has units: Time, but must have units: Length
Chapter 1: Basics of Mathcad 41
To change the unit system of the worksheet from SI to U.S. units, select Worksheet
Options from the Tools menu. Then, click the Unit System tab, and select U.S. This
option gives you results in "English System" measures.
In the following calculation, a mass is multiplied by an acceleration to give force in proper
units. The result should be in Newtons or an equivalent force unit.
mass 5 kg
⋅
:= acc 20
m
sec
2
⋅
:=
Force mass acc
⋅
:= Force 100 m kg s
2
−
⋅
⋅
=
To display units, choose Result from the Format menu. Then, go to Unit Display and
check Format Units and Simplify units when possible, and results will display as shown
below.
g 9.807 s
2
−
⋅ m
⋅
:= 60 N
⋅ 20
⋅ m
⋅ 1.2 10
3
× J
=
8 kg
⋅ 6
⋅
m
sec
2
⋅ 48 N
=
42 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
C H A P T E R 2
INTRODUCTION TO NUMERICAL METHODS
2.1 THE USE OF NUMERICAL METHODS IN SCIENCE AND
ENGINEERING
Analysis of problems in engineering and the physical sciences typically involves four steps as
follows.
(1) Development of a suitable mathematical model that realistically represents a given physical
system.
(2) Derivation of the system governing equations using physical laws such as Newton's laws of
motion, conservation of energy, the laws governing electrical circuits etc.
(3) Solution of the governing equations, and
(4) Interpretation of the results.
Because real world problems are generally quite complex with the generation of closed-form
analytical solutions becoming impossible in many situations, there exists, most definitely, a
need for the proper utilization of computer-based techniques in the solution of practical
problems. The advancement of computer technology has made the effective use of numerical
methods and computer-based techniques very feasible, and thus, solutions can now be
obtained much faster than ever before and with much better than acceptable accuracy.
However, there are advantages as well as disadvantages associated with any numerical
procedure that is resorted to , and these must be kept in mind when using it.
2.2 COMPARISON OF NUMERICAL METHODS WITH ANALYTICAL
METHODS
While an analytical solution will be exact if it exists, a numerical method , on the other hand,
will generally require iterations to generate a solution, which is only an approximation and
which certainly cannot be considered exact by any means.
A disadvantage associated with analytical solution techniques is that they are generally
applicable only to very special cases of problems. Numerical solutions, on the contrary, will
solve complex situations as well.
While numerical techniques have several advantages including easy programming on a
computer and the convenience with which they handle complex problems, the initial
estimate of the solution along with the many number of iterations that are sometimes required
to generate a solution can be looked upon as disadvantages.
Chapter 2: Introduction to Numerical Methods 43
2.3 SOURCES OF NUMERICAL ERRORS AND THEIR COMPUTATION
It is indeed possible for miscalculations to creep into a numerical solution because of various
sources of error. These include inaccurate mathematical modeling, wrong programming, wrong
input, rounding off of numbers and truncation of an infinite series. Round-off error is the general
name given to inaccuracies that affect the calculation scene when a finite number of digits are
assigned to represent an actual number. In a long sequence of calculations, this round-off error
can accumulate, then propagate through the process of calculation and finally grow very rapidly
to a significant number. A truncation error results when an infinite series is approximated by a
finite number of terms, and, typically, upper bounds are placed on the size of this error.
The true error is defined as the difference between the computed value and the true value of a
number.
ETrue XComp XTrue
−
=
(2.1)
while the relative true error is the error relative to the true value
(2.2)
er
XComp XTrue
−
XTrue
=
Expressed as a percentage, the relative true error is written as
er
XComp XTrue
−
XTrue
100
⋅
= (%) (2.3)
2.4 TAYLOR SERIES EXPANSION
The Taylor series is considered as a basis of approximation in numerical analysis. If the
value of a function of x is provided at " x 0", then the Taylor series provides a means of
evaluating the function at " x 0 + h", where " x 0" is the starting value of the independent
variable and " h " is the difference between the starting value and the new value at which
the function is to be approximated
f x0 h
+
( ) f x0
( ) h
x
f x0
( )
⎡
⎣ ⎀
⎊
d
d
⎡
⎱
⎣
⎀
⎄
⎊
⋅
+
h
2
2! 2
x
f x0
( )
d
d
2
⋅
+
h
3
3! 3
x
f x0
( )
d
d
3
⋅
+ .....................
+
= (2.4)
This equation can be used for generating various orders of approximations as shown
below. The order of approximation is defined by the highest derivative included in the
series. For example, If only terms up to the second derivative are retained in the series,
the result is a second order approximation.
44 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
First order approximation:
f x0 h
+
( ) f x0
( ) h
x
f x0
( )
d
d
⋅
+
=
(2.5)
Second order approximation:
f x0 h
+
( ) f x0
( ) h
x
f x0
( )
d
d
⋅
2
x
f x0
( )
d
d
2
⋅
+
= (2.6)
Third order approximation:
f x0 h
+
( ) f x0
( ) h
x
f x0
( )
d
d
⋅
+
h
2
2! 2
x
f x0
( )
d
d
2
⋅
+
h
3
3! 3
x
f x0
( )
d
d
3
⋅
+ ...........................
+
= (2.7)
It is to noted that the significance of the higher order terms in the Taylor series increases with
the nonlinearity of the function involved as well as the difference between the " starting x" value
and the "x" value at which the function is to be approximated. Thus , the fewer the terms that
are included in the series, the larger will be the error associated with the computation of the
function value. If the function is linear , however, only terms up to the first derivative term need
to be included.
Example 2.1
Using the Taylor series expansion for
f(x) = - 0.15 x4 - 0.17 x 3 - 0.25 x 2 -0.25 x + 1.25
determine the zeroth, first, second, third, fourth and fifth order approximations of
f(x0 + h ) where x0 = 0 and h = 1,2, 3, 4,5 and compare these with the exact solutions.
h=1.0: Put in the function and generate its derivatives:
f x
( ) 0.15
− x
4
⋅ 0.17 x
3
⋅
− 0.25 x
2
⋅
− 0.25x
− 1.25
+
:= x0 0
:= h 1.
:=
fprime x
( ) 0.60
− x
3
⋅ 0.51 x
2
⋅
− 0.50 x
⋅
− 0.25
−
:= <--Generate
derivatives
f2prime x
( ) 1.8
− x
2
⋅ 1.02 x
⋅
− 0.50
−
:=
f3prime x
( ) 3.6
− x
⋅ 1.02
−
:= f4prime x
( ) 3.6
−
:= f5prime x
( ) 0.
:=
Chapter 2: Introduction to Numerical Methods 45
term1 f x0
( )
:= term2 h fprime x0
( )
⋅
:= term3
h
2
2
f2prime x0
( )
⋅
:=
term4
h
3
6
f3prime x0
( )
⋅
:= term5
h
4
24
f4prime x0
( )
⋅
:= term6
h
5
120
f5prime x0
( )
⋅
:=
ftaylor0 term1
:= <---- one-term or zero-order approximation
ftaylor1 term1 term2
+
:= <---- first order approximation with two terms
ftaylor2 term1 term2
+ term3
+
:= <---second order approximation with 3 terms
ftaylor3 term1 term2
+ term3
+ term4
+
:= <---third order approximation with 4 terms
ftaylor4 term1 term2
+ term3
+ term4
+ term5
+
:= <---fourth order approximation with 5 terms
fifth order approximation
with 6 terms
ftaylor5 term1 term2
+ term3
+ term4
+ term5
+ term6
+
:= <-----
x x0 h
+
:= x 1
=
These are the zero- fifth order
approximations of the given
function f(x) using the Taylor
series.
ftaylor0 1.25
= ftaylor1 1
= ftaylor2 0.75
=
<--
ftaylor3 0.58
= ftaylor4 0.43
= ftaylor5 0.43
=
f 1
( ) 0.43
= <---EXACT ANSWER USING FUNCTION GIVEN.
err0 f x
( ) ftaylor0
−
:= err0 0.82
−
=
err1 f x
( ) ftaylor1
−
:= err1 0.57
−
=
err2 f x
( ) ftaylor2
−
:= err2 0.32
−
= These are errors ( differences between exact
values and approximations ) for the above
zero - fifth order approximations.
<--
err3 f x
( ) ftaylor3
−
:= err3 0.15
−
=
err4 f x
( ) ftaylor4
−
:= err4 0
=
err5 f x
( ) ftaylor5
−
:= err5 0
=
Similarly, by using h= 2, 3, 4, 5 , the zeroth- fifth order approximations for f(2), f(3), f(4),
f(5) and the associated errors can be determined. These are given in Tables 2.1 and 2.2
Plots of the various Taylor series approximations of the given function and associated errors
are generated below and are presented in Figs. 2.1 and 2.2
46 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
x0 0
:= x 0 0.01
, 5
..
:=
ftaylor0 x
( ) f x0
( )
:= <-- zeroth-order approximation
ftaylor1 x
( ) ftaylor0 x
( ) x x0
−
( ) fprime x0
( )
⋅
+
:= <---first-order approximation
ftaylor2 x
( ) ftaylor1 x
( )
x x0
−
( )
2
2
f2prime x0
( )
⋅
+
:= <--second-order approximation
ftaylor3 x
( ) ftaylor2 x
( )
x x0
−
( )
3
6
f3prime x0
( )
⋅
+
:= <---third-order approximation
ftaylor4 x
( ) ftaylor3 x
( )
x x0
−
( )
4
24
f4prime x0
( )
⋅
+
:= <---fourth-order approximation
ftaylor5 x
( ) ftaylor4 x
( )
x x0
−
( )
5
120
f5prime x0
( )
⋅
+
:= <---fifth- order approximation
Errors generated with the various approximations are as follows
Zero order approximation: err0 x
( ) f x
( ) ftaylor0 x
( )
−
:=
First order approximation: err1 x
( ) f x
( ) ftaylor1 x
( )
−
:=
Second order approximation: err2 x
( ) f x
( ) ftaylor2 x
( )
−
:=
Third order approximation: err3 x
( ) f x
( ) ftaylor3 x
( )
−
:=
Fourth order approximation: err4 x
( ) f x
( ) ftaylor4 x
( )
−
:=
Fifth order approximation: err5 x
( ) f x
( ) ftaylor5 x
( )
−
:=
The various approximations generated by the above calculations and the associated errors
are compared in the Table 2.1.
Chapter 2: Introduction to Numerical Methods 47
0 1 2 3 4 5
150
100
50
0
50
Zeroth order approx
Third order approx
Fifth order approx/ given function
Zeroth order approx
Third order approx
Fifth order approx/ given function
Taylor series approx of given function
x- value
Function
approximated
by
Taylor
series
ftaylor0 x
( )
ftaylor3 x
( )
ftaylor5 x
( )
x
Figure 2.1. Taylor series approximation of given function
x 0 0.01
, 5
..
:=
0 1 2 3 4 5
150
100
50
0
50
Zero order approx
Third order approx
Fifth order approx
Zero order approx
Third order approx
Fifth order approx
Errors gen due to Taylor-series approx
x- value
errors
as
function
of
x
err0 x
( )
err3 x
( )
err5 x
( )
x
Figure 2.2. Errors associated with the various Taylor series approximations
48 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
The various approximations generated by the above calculations and the associated errors are
compared in the following tables.
Table 2.1
h 1 5
..
:=
Various orders of approximation generated by Taylor series
approach versus true values of given function
x 0 1
, 5
..
:=
zeroth
order
first
order
second
order
third
order
fourth
order
fifth
order
True
Value
x
0
1
2
3
4
5
= ftaylor0 x
( )
1.25
1.25
1.25
1.25
1.25
1.25
=
ftaylor1 x
( )
1.25
1
0.75
0.5
0.25
0
=ftaylor2 x
( )
1.25
0.75
-0.25
-1.75
-3.75
-6.25
=
ftaylor3 x
( )
1.25
0.58
-1.61
-6.34
-14.63
-27.5
=ftaylor4 x
( )
1.25
0.43
-4.01
-18.49
-53.03
-121.25
=ftaylor5 x
( )
1.25
0.43
-4.01
-18.49
-53.03
-121.25
=f x
( )
1.25
0.43
-4.01
-18.49
-53.03
-121.25
=
h
1
2
3
4
5
=
Table 2.2
Errors associated with the different orders of approximation
zeroth
order
first
order
second
order
third
order
fourth
order
fifth
order
x
0
1
2
3
4
5
= err0 x
( )
0
-0.82
-5.26
-19.74
-54.28
-122.5
= err1 x
( )
0
-0.57
-4.76
-18.99
-53.28
-121.25
= err2 x
( )
0
-0.32
-3.76
-16.74
-49.28
-115
= err3 x
( )
0
-0.15
-2.4
-12.15
-38.4
-93.75
= err4 x
( )
0
0
0
0
0
0
= err5 x
( )
0
0
0
0
0
0
=
h
1
2
3
4
5
=
PROBLEMS
2.1. Using the Taylor series expansion for cos x, which is given as
f(x) = cos x = 1- x 2 / 2 + x 4 / 24 ,
determine the one-term, two-term and three-term approximations of f(x0 + h ) , where x0 = 0
Chapter 2: Introduction to Numerical Methods 49
rad and h = 0. 1, 0.2 ....1.0 rad , and compare these with the exact solution. Using Mathcad,
generate plots of the various Taylor series approximations and associated errors as functions of
the independent variable x.
2.2 Develop a Taylor series expansion of the following function:
f(x) = x 5 - 6 x 4 + 3x 2 + 9 .
Use x =3 as the base and h as the increment. Using Mathcad, evaluate the series for h= 0.1,
0.2....1.0, adding terms incrementally as in Problem 2.1. Compare the various Taylor series
approximations obtained with true values in a table. Generate plots of the approximations and
associated errors as functions of x .
2.3 Given the following function:
f(x) = x 3 - 3 x 2 + 5 x + 10 ,
determine f ( x0 + h ) with the help of a Taylor series expansion, where x 0 = 2 and h = 0.4.
Compare the true value of f ( 2.4 ) with estimates obtained by resorting to (a) one term only (b)
two terms (c) three terms and (d) four terms of the series.
2.4 Given the following function
f x
( ) 3 x
3
⋅ 6 x
2
⋅
− 15 x
⋅
+ 25
+
=
use a Taylor series expansion to determine the zeroth, first, second and third order
approximations of f(x0+h) where x 0 = 2 and h = 0.5. Compare these with the exact
solution.
2.5 By developing a Taylor series expansion for
f(x) = e x
about x = 0 , determine the fourth-order approximation of e 2.5 and compare it with the exact
solution.
2.6. By developing a Taylor series expansion for
f(x) = ln(2-x)
about x = 0, determine the fourth-order approximation of ln (0.5) and compare it with the exact
solution
50 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
2.7. By developing a Taylor series expansion for
f(x) = x3 e - 5x
about x = 1, determine the third-order approximation of f(1.2) and compare it with the exact
solution.
2.8. By developing a Taylor series expansion for
f(x) = e cos x
about x =0 , determine the fourth- order approximation of f (2π) and compare it with the exact
solution. .
2.9. By developing a Taylor series expansion for
f(x) = (x - 2) 1/2
about x = 2, determine the third-order approximation of f (2.2), that is, (0.2) 1/2 , and compare it
with the exact solution.
2.10. Given the function
f(x) = x2 - 5 x 0.5 + 6 ,
use a Taylor series expansion to determine the first, second , third and fourth order
approximations of f (2.5 ) by resorting to x 0 = 2 and h = 0.5 . Compare these with the exact
solution.
2.11. Given the function
f(x) = 6 x3 - 9 x2 +25 x + 40 ,
use a Taylor series expansion to determine the zeroth, first, second and third order
approximations of f (x0 + h ) where x 0 = 3 and h = 1 . Compare these with the exact solution.
2.12. Given the function
f(x) = 4 x4 - 7 x3 + 5 x2 - 6 x + 90
use a Taylor series expansion to determine the zeroth, first, second , third and fourth order
Chapter 2: Introduction to Numerical Methods 51
approximations of f (x0 + h ) ) where x 0 = 3 and h = 0.5 . Compare these with the exact
solution. Calculate errors abnd generate calculations to three decimal places.
2.13. Given the function
f(x) = 8 x3 - 10 x2 + 25 x + 45 ,
use a Taylor series expansion to determine the zeroth, first, second and third order
approximations of f (x0 + h ) where x 0 = 2 and h = 1 . Compare these with the exact solution.
2.14. Given the function
f(x) = 1 + x + x2 / 2! + x3 / 3! +x4 / 4!
use a Taylor series expansion to determine the zeroth, first, second , third and fourth order
approximations of f (x0 + h ) where x 0 = 0 and h = 0.5 . Compare these with the exact
solution. Generate answers correct to four decimal places.
2.15. Given the function
f(x) = x + x3 / 3 + 2 x5 / 15
use a Taylor series expansion to determine the zeroth, first, second , third and fourth order
approximations of f (x0 + h ) where x 0 = 0 and h = 0.8 . Compare these with the exact solution
by computing percentage errors. Generate answers correct to four decimal places.
2.16. Given the function
f(x) = sin (x)
use a Taylor series expansion to determine the fifth order approximation of f (x0 + h ) where x 0
= 0 and h = 0.2 radians . Compare your answer with the true value. Generate answers correct
to four decimal places.
2.17. Given the function
f(x) = 3 x2 - 6 x 0.5 + 9 ,
use a Taylor series expansion to determine the zeroth, first, second , third and fourth order
approximations of f (x0 + h ) whereo x 0 = 3 and h = 1 . Compare these with the exact
solution by computing percentage errors. Generate answers correct to four decimal places.
52 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
C H A P T E R 3
ROOTS OF EQUATIONS
3.1 INTRODUCTION
In many problems occurring in science and engineering, it is often necessary to find roots
or zeros of equations that are nonlinear. Nonlinear equations have no closed-form solutions
except in some very special cases, and thus, computer methods are indispensable in their
solution. Some examples of equations whose roots may need to be found are:
1 4 x
⋅
+ 16 x
2
⋅
− 3 x
3
⋅
+ 3 x
4
⋅
+ 0
= <-- a polynomial, a characteristic equation,
for instance
f x
( ) α
− 0
= <-- α is a number and f(x) is a function of x
tan α
( ) tanh 2 x
⋅
( )
= <-- a transcendental equation
3.2 METHODS AVAILABLE
There are several methods available for finding roots of equations. Some of these are:
(1) Direct Search, which is not a very efficient technique, (2) Bisection (3) False Position
(4) Newton-Raphson (5) Secant Method (6) Bairstow's Method, which is applicable only
to polynomials and (6) Successive Iteration or Fixed Point Iteration method . In this
chapter, however, only the Bisection, False Position, Newton-Raphson, Secant and
Successive Iteration methods will be addressed along with the functions used in Mathcad
to find roots.
3.3 BISECTION METHOD
This method can be resorted to when there is only one root occurring in a given range
of x. The method involves investigating a given range to seek a root and then bisecting
the region successively until a root is found. Other names for this technique are Interval
halving, Binary Chopping and Bolzano's Method.
Procedure for Finding Roots
1. Choose starting and end points xstart and xend
2. Compute: f(xstart) and f(xend)
3. Compute: f(xstart) times f(xend)
Chapter 3: Roots of Equations 53
4. If the above product is negative, then the root lies between xstart and xend. If this
product is positive, reselect xstart and xend.
5. If f(xtart)* f(xend) < 0, compute the mid-point of the xstart-xend
range. Call it "xmid1" and repeat above steps, i.e., compute
f xstart
( ) f xmid1
( )
⋅ and f xmid1
( ) f xend
( )
⋅
6. If f(xstart)*f(xmid1) < 0, the root lies between xstart and xmid1.
If (xmid1)*f(xend) < 0, then the root lies between xmid1 and xend.
7. Repeat the above procedure until convergence at a root value occurs.
Figure 3.1. Bisection Method
Computation of Error and Convergence Criterion
A convergence criterion has to be followed in order to determine if a root has indeed been
found. This is expressed in terms of the error Δ or the percentage relative error
Δ rel which are defined as
54 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Δ xmidi 1
+ xmidi
−
= (3.1)
(3.2)
Δrel
xmidi 1
+ xmidi
−
xmidi 1
+
100
⋅
= percent
where xmid i+1 and xmid i are the midpoints in the current and previous iterations. While,
in general, the relative error should not be greater than 5 %, an error of 0.01 % is the
largest that is tolerable for some classes of problems, that require immense precision.
The true error , Δ True , is an indicator of the real accuracy of a solution and can be
evaluated only if the true solution, x True , is known. It is defined as
ΔTrue
xTrue xmidi
−
xTrue
100
⋅
= (3.3)
Calculation of the true error clearly requires knowledge of the true solution, which, in general,
will not be known to us. Therefore, the quantity Δ rel may have to be mostly used to
determine the error associated with a solution process.
Advantages and Disadvantages of Bisection
While Bisection is a simple, robust technique for finding one root in a given interval, when
the root is known to exist and it works even for non-analytic functions, its convergence
process is generally slow, making it a somewhat inefficient procedure.
Sometimes, a singularity may be identified as if it were a root, since the method does not
distinguish between roots and singularities, at which the function would go to infinity.
Therefore, as the method proceeds, a check must be made to see if the absolute value of
[f(xend)-f(xstart)], in fact, converges to zero. If this quantity diverges, the method is chasing
a singularity rather than a root .
When there are multiple roots, Bisection is not a desirable technique to use, since the
function may not change signs at points on either side of the roots. Therefore, a graph of
the function must first be drawn before proceeding to do the calculations.
Example 3.1
Obtain a root of f(x) in the range of 4 < x < 20
f(x)= ( 750.5 / x ) [ 1 - exp( -0.15245x) ] - 40
Chapter 3: Roots of Equations 55
Let us generate a table for x between 4 and 20 and draw a graph using Mathcad to explore
where the root may lie.
f x
( )
750.5
x
1 e
0.15245
− x
⋅
−
( )
⋅ 40
−
:= x 4 8
, 20
..
:=
5 10 15 20
10
−
0
10
20
30
40
50
Graph of f(x) versus x
f x
( )
x
x
0
0
1
2
3
4
4
8
12
16
20
= f x
( )
0
0
1
2
3
4
45.6584
26.1051
12.5031
2.8146
-4.2539
=
The above table and graph suggest that the root lies between xstart=16 and xend= 20. In an
attempt to minimize the number of iterations needed, we will obtain a root value that is correct
only to two decimal places, in this case.
Iteration # 1: xstart 16
:= xend 20
:= xmid
xstart xend
+
2
:= xmid 18
=
f xstart
( ) f xmid
( )
⋅ 2.7773
−
= f xmid
( ) f xend
( )
⋅ 4.1976
=
The root must lie beteen above xstart and xmid. Thus the new xstart is 16 and the new xend is
18
Iteration # 2: xstart 16
:= xend 18
:= xmid
xstart xend
+
2
:= xmid 17
=
f xstart
( ) f xmid
( )
⋅ 2.366
= f xmid
( ) f xend
( )
⋅ 0.8295
−
=
The root must lie beteen above xmid and xend. Thus the new xstart is 17 and the new
xend is 18
Iteration # 3: xstart 17
:= xend 18
:= xmid
xstart xend
+
2
:= xmid 17.5
=
f xstart
( ) f xmid
( )
⋅ 0.0761
−
= f xmid
( ) f xend
( )
⋅ 0.0893
=
56 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
The root must lie beteen above xstart and xmid. Thus the new xstart is 17 and the new xend
is 17.5
Iteration # 4: xstart 17.
:= xend 17.5
:= xmid
xstart xend
+
2
:= xmid 17.25
=
f xstart
( ) f xmid
( )
⋅ 0.3115
= f xmid
( ) f xend
( )
⋅ 0.0335
−
=
The root must lie beteen above xmid and xend. Thus the new xstart is 17.25 and the new
xend is 17.5
Iteration # 5: xstart 17.25
:= xend 17.5
:= xmid
xstart xend
+
2
:= xmid 17.375
=
f xstart
( ) f xmid
( )
⋅ 0.0515
= f xmid
( ) f xend
( )
⋅ 0.0126
−
=
The root must lie beteen above xmid and xend. Thus the new xstart is 17.38 and the new xend is
17.5
Iteration # 6: xstart 17.38
:= xend 17.5
:= xmid
xstart xend
+
2
:= xmid 17.44
=
f xstart
( ) f xmid
( )
⋅ 2.5064 10
3
−
×
= f xmid
( ) f xend
( )
⋅ 1.7497
− 10
3
−
×
=
The root must lie beteen above xmid and xend. Thus the new xstart is 17.44 and the new
xend is 17.5
Iteration # 7: xstart 17.44
:= xend 17.5
:= xmid
xstart xend
+
2
:= xmid 17.47
=
f xstart
( ) f xmid
( )
⋅ 6.893
− 10
4
−
×
= f xmid
( ) f xend
( )
⋅ 3.2291 10
3
−
×
=
The root must lie beteen above xstart and xmid. Thus the new xstart is 17.44 and the new
xend is 17.47
Iteration # 8: xstart 17.44
:= xend 17.47
:= xmid
xstart xend
+
2
:= xmid 17.455
=
f xstart
( ) f xmid
( )
⋅ 1.5821
− 10
4
−
×
= f xmid
( ) f xend
( )
⋅ 2.9199 10
4
−
×
=
Chapter 3: Roots of Equations 57
The root must lie beteen above xstart and xmid. Thus the new xstart is 17.44 and the new
xend is 17.455
Iteration # 9: xstart 17.44
:= xend 17.455
:= xmid
xstart xend
+
2
:= xmid 17.447
=
f xstart
( ) f xmid
( )
⋅ 1.0756 10
4
−
×
= f xmid
( ) f xend
( )
⋅ 4.5564
− 10
5
−
×
=
a check to see if this is
small
f xstart
( ) 0.0193
= f xmid
( ) 5.5657 10
3
−
×
= <--
Since f(xmid) is a very small quantitity, it is reasonable to assume that the xmid obtained
in iteration # 9 is, in fact, the required root. The % error in this case is, then
error
17.447 17.455
−
17.447
100
⋅
:= error 0.0459
−
= (percent)
Thus, the solution which has been obtained after 9 iterations is : x = 17.447
3.4 THE REGULA FALSI OR THE FALSE POSITION METHOD
The False Position method is similar to the Bisection method in that the size of the interval
containing the root is reduced with every step of the iteration process until the root is found.
The main difference is that while the interval size in the Bisection method is reduced by
bisecting it in each step of the iteration , this reduction of interval size is achieved by a
linear interpolation fitting the two end points. While the Bisection method is reliable, it is
slower than the False Position method in achieving convergence.
The equation of a straight line connecting two points (xstart,ystart) and (xend, yend) is
y yend
yend ystart
−
xend xstart
−
x xend
−
( )
⋅
+
= (3.4)
58 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
f(xstart)
f(xend)
f(x)
x
xstart
xnew
Root
xend
(xstart, f(xstart))
(xend, f(xend))
Figure 3.2. Regula Falsi method
The procedure for finding roots then is as follows. ( See Figure 3.2 )
1. Choose the starting and ending points xstart and xend as in the Bisection
method.
2. Compute f(xstart) and f(xend). Make sure that f(xstart) times f(xend) is still
a negative product. If it is not, then there is no root between xstart and xend.
3. The new end point xnew is located by setting y = 0 in Equation 3.4 and solving for x.
xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
= (3.5)
4. If f(xstart)*f(xnew) < 0, the root lies between xstart and xnew. However, if f(xnew)*f(xend) <
0, the root lies between xnew and xend.
5. Repeat the above procedure until convergence takes place.
Chapter 3: Roots of Equations 59
A disadvantage of this method is that sometimes a root is approached from only one side and,
thus, one end of the interval does not change at all in successive iterations. This is called
stagnation of an end point. This is not desirable since it slows down the convergence process
especially when the initial interval is very large or when the function is highly nonlinear. Examples
3.2 and 3.3 show the occurrence of stagnation.
Example 3.2
Obtain the required root for the function of Example 3.1 by the False Position method
correct to four decimal places. The starting and ending points were 16 and 20 respectively.
f x
( )
750.5
x
1 e
0.15245
− x
⋅
−
( )
⋅ 40
−
:=
Iteration # 1: xstart 16
:= xend 20
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.8146
= yend 4.2539
−
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 17.5927
=
f xstart
( ) f xnew
( )
⋅ 0.73
−
= f xnew
( ) f xend
( )
⋅ 1.1033
=
The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new
xend is 17.5927
Iteration # 2: xstart 16
:= xend 17.5927
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.8146
= yend 0.2593
−
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 17.4584
=
f xstart
( ) f xnew
( )
⋅ 0.0404
−
= f xnew
( ) f xend
( )
⋅ 3.7171 10
3
−
×
=
The root must lie between above xstart and xnew. Thus the new xstart is 16 and the new
xend is 17.4584
Iteration # 3: xstart 16
:= xend 17.4584
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.8146
= yend 0.0144
−
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 17.451
=
f xstart
( ) f xnew
( )
⋅ 2.2312
− 10
3
−
×
= f xnew
( ) f xend
( )
⋅ 1.143 10
5
−
×
=
The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend
is 17.451
60 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
Iteration # 4: xstart 16
:= xend 17.451
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.8146
= yend 8.5304
− 10
4
−
×
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:=
xnew 17.4506
= f xstart
( ) f xnew
( )
⋅ 1.3196
− 10
4
−
×
= f xnew
( ) f xend
( )
⋅ 3.9995 10
8
−
×
=
The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend
is 17.4506
Iteration # 5: xstart 16
:= xend 17.4506
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.8146
= yend 1.1956
− 10
4
−
×
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:=
xnew 17.4505
= f xstart
( ) f xnew
( )
⋅ 1.8496
− 10
5
−
×
= f xnew
( ) f xend
( )
⋅ 7.8568 10
10
−
×
=
The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend
is 17.4505
Iteration # 6: xstart 16
:= xend 17.4505
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.8146
= yend 6.3811 10
5
−
×
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:=
xnew 17.4505
= f xstart
( ) f xnew
( )
⋅ 9.8712 10
6
−
×
= f xnew
( ) f xend
( )
⋅ 2.238 10
10
−
×
=
f xnew
( ) 3.5072 10
6
−
×
=
The above process indicates that in this case, the root is being approached only from the
side of the original starting point and therefore stagnation has occurred. Since the xnew
computed in the sixth iteration is the same as the one in the fifth, and f(xnew) is a very
small quantitity, it is reasonable to say that the xnew (=17.4505) computed above is, in
fact, the required root.
Example 3.3
Obtain a root of f(x) by the False Position method in the range of 0 < x < 10 correct to
three decimal places.
f x
( ) x
3
9 x
⋅
+ 200
−
:=
Iteration # 1: xstart 0
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
Chapter 3: Roots of Equations 61
ystart 200
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 1.8349
=
f xstart
( ) f xnew
( )
⋅ 3.5462 10
4
×
= f xnew
( ) f xend
( )
⋅ 1.578
− 10
5
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 1.835 and the new
xend is 10
Iteration # 2: xstart 1.835
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 177.3061
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 3.1914
=
f xstart
( ) f xnew
( )
⋅ 2.4605 10
4
×
= f xnew
( ) f xend
( )
⋅ 1.2351
− 10
5
×
=
The root must lie between above xnew and xend. Thus the new xstart is 3.191 and the new
xend is 10
Iteration # 3: xstart 3.191
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 138.7887
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 4.1096
=
f xstart
( ) f xnew
( )
⋅ 1.2992 10
4
×
= f xnew
( ) f xend
( )
⋅ 8.3312
− 10
4
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 4.11 and the new
xend is 10
Iteration # 4: xstart 4.11
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 93.5835
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 4.6704
=
f xstart
( ) f xnew
( )
⋅ 5.2493 10
3
×
= f xnew
( ) f xend
( )
⋅ 4.9922
− 10
4
×
=
The root must lie beteen above xnew and xstart. Thus the new xstart is 4.67 and the new
xend is 10
Iteration # 5: xstart 4.67
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
62 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
ystart 56.1224
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 4.9862
=
f xstart
( ) f xnew
( )
⋅ 1.7487 10
3
×
= f xnew
( ) f xend
( )
⋅ 2.7732
− 10
4
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 4.986 and the new
xend is 10
Iteration # 6: xstart 4.986
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 31.1731
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.1557
=
f xstart
( ) f xnew
( )
⋅ 516.0963
= f xnew
( ) f xend
( )
⋅ 1.4735
− 10
4
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.156 and the new
xend is 10
Iteration # 7: xstart 5.156
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 16.5272
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.2443
=
f xstart
( ) f xnew
( )
⋅ 141.6022
= f xnew
( ) f xend
( )
⋅ 7.6254
− 10
3
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.244 and the new
xend is 10
Iteration # 8: xstart 5.244
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 8.5964
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.2895
=
f xstart
( ) f xnew
( )
⋅ 37.8307
= f xnew
( ) f xend
( )
⋅ 3.9167
− 10
3
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.290 and the new
xend is 10
Iteration # 9: xstart 5.290
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
Chapter 3: Roots of Equations 63
ystart 4.3541
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3129
=
f xstart
( ) f xnew
( )
⋅ 9.6414
= f xnew
( ) f xend
( )
⋅ 1.9707
− 10
3
×
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.313 and the new
xend is 10
Iteration # 10: xstart 5.313
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 2.2078
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3246
=
f xstart
( ) f xnew
( )
⋅ 2.4707
= f xnew
( ) f xend
( )
⋅ 995.9944
−
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.325 and the new
xend is 10
Iteration # 11: xstart 5.325
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 1.0813
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3307
=
f xstart
( ) f xnew
( )
⋅ 0.5916
= f xnew
( ) f xend
( )
⋅ 486.9595
−
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.331 and the new xend
is 10
Iteration # 12: xstart 5.331
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 0.5163
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3337
=
f xstart
( ) f xnew
( )
⋅ 0.1348
= f xnew
( ) f xend
( )
⋅ 232.3231
−
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.334 and the new
xend is 10
Iteration # 13: xstart 5.334
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
64 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
ystart 0.2334
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3352
=
f xstart
( ) f xnew
( )
⋅ 0.0275
= f xnew
( ) f xend
( )
⋅ 104.9753
−
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.335 and the new
xend is 10
Iteration # 14: xstart 5.335
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 0.139
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3357
=
f xstart
( ) f xnew
( )
⋅ 9.7667 10
3
−
×
= f xnew
( ) f xend
( )
⋅ 62.5217
−
=
The root must lie beteen above xnew and xend. Thus the new xstart is 5.336 and the new
xend is 10
Iteration # 15: xstart 5.336
:= xend 10
:= ystart f xstart
( )
:= yend f xend
( )
:=
ystart 0.0446
−
= yend 890
= xnew xend
xend xstart
−
yend ystart
−
yend
⋅
−
:= xnew 5.3362
=
f xstart
( ) f xnew
( )
⋅ 1.0062 10
3
−
×
= f xnew
( ) f xend
( )
⋅ 20.0659
−
= f xnew
( ) 0.0225
−
=
The above process indicates that in this case, stagnation occurs as well, but the root is
being approached only from the side of the original ending point. Since the xnew computed
in the fifteenth iteration is about the same as the one in the fourteenth, it is reasonable to say
that the xnew ( = 5.336 ) computed above is, in fact, the required root.
3.5 NEWTON-RAPHSON METHOD
This is the most widely used iterative method for locating roots. In this method, an initial
approximation of the root must be assumed, and calculations are started with a "good
initial guess" . If this initial guess is not a good one, then divergence may occur.
By starting with an approximation of the root value , x i , and constructing a tangent to the
function curve at x i , an improved guess x i+1 can be determined as shown in Figure 3.3.
From Figure 3.3, the slope of the function f(x) at x i can be seen to be
Chapter 3: Roots of Equations 65
fprime xi
( )
f xi
( )
−
xi 1
+ xi
−
= (3.6)
which gives the new improved value of the guess as
xi 1
+ xi
f xi
( )
fprime xi
( )
−
= g xi
( )
= (3.7)
where fprime( x i ) is the slope of the function at x i
Figure 3.3. Newton-Raphson method
Procedure for Finding Roots
1. Make a good initial guess. Call it X Old.
2. Improve the guess using
XNew XOld
f XOld
( )
fprime XOld
( )
−
= g XOld
( )
= (3.8)
66 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
3. Keep improving the guess using Equation (3.8).
4. Solution is done when a new improved value X New is almost equal to the
previous value X Old
Advantages and Disadvantages of the Method
While the Newton-Raphson method is faster than the Bisection method, is applicable to the
complex domain as well and can be extended to simultaneous nonlinear equations, it may
not converge in some situations. The solution may oscillate about a local maximum or
minimum, and if an initial estimate is chosen such that the derivative becomes zero at some
point in the iteration process, then a division by zero takes place and convergence will never
occur. Although convergence will occur quite rapidly if the initial estimate is sufficiently
close to the root, it is possible for it to be be slow when it is far from the root. Also, if the
roots are complex, they will never be generated with real initial guesses.
A worthwhile feature of the Newton-Raphson method is that the numerical process will
correct itself automatically for minor errors. Thus, any errors that are made in computing the
next guess will simply generate a different point for drawing the tangent line and will not have
any effect on the final answer.
Convergence Criterion for the Newton-Raphson Method
It can be mathematically shown that in order for the Newton-Raphson method to converge
to a real root, the absolute value of the derivative of the g(xi) of Equation (3.7) must
always be less than 1 , that is,
g xi
( ) 1
<
This condition must be satisfied if convergence is to be attained. However, in some cases, it
may not hold for the initial guess.
Example 3.4
Using the Newton- Raphson method, solve : f(x)= x3 - 4.2 x -8.5 =0 for a real root between 2
and 3.
Let us first draw a graph of the function in the given range
f x
( ) x
3
4.2 x
⋅
− 8.5
−
:= x 2 2.1
, 3
..
:=
Chapter 3: Roots of Equations 67
2 2.2 2.4 2.6 2.8
10
−
5
−
0
5
10
f x
( )
x
The derivative of the given function is fprime x
( ) 3 x
2
⋅ 4.2
−
:= , and thus,
fdblprime x
( ) 6 x
⋅
:= , g x
( ) x
f x
( )
fprime x
( )
−
:= , gprime x
( ) 1
fprime x
( )
2
f x
( ) fdblprime x
( )
⋅
−
fprime x
( )
2
−
:=
where fdblprime(x) is the second derivative of f(x) and gprime(x) is the derivative of g(x). Start
with an initial estimate of 2.5
xold 2.5
:= xnew g xold
( )
:= xnew 2.732
= gprime xnew
( ) 0.0206
=
xold xnew
:= xnew g xold
( )
:= xnew 2.7091
= gprime xnew
( ) 2.1887 10
4
−
×
=
xold xnew
:= xnew g xold
( )
:= xnew 2.7088
= gprime xnew
( ) 2.3959 10
8
−
×
=
xold xnew
:= xnew g xold
( )
:= xnew 2.7088
= gprime xnew
( ) 0
=
Clearly, the root is the converged value 2.7088, and convergence has been established with the
absolute value of the slope of g(x) being less than 1 in all the iterations.
Example 3.5
Using the Newton- Raphson method, solve : f(x)= x3 +7x2+19x+13 = 0 for all roots, real as
well as complex.
Let us first draw a graph of the function
68 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
f x
( ) x
3
7 x
2
⋅
+ 19 x
⋅
+ 13
+
:=
which suggests that there is a real root between 0 and -2.5
x 5
− 4.999
−
, 0
..
:=
4
− 2
− 0
40
−
30
−
20
−
10
−
0
10
20
f x
( )
x
The derivative of the given function is fprime x
( ) 3 x
2
⋅ 14 x
⋅
+ 19
+
:= with
fdblprime x
( ) 6 x
⋅
:= , g x
( ) x
f x
( )
fprime x
( )
−
:= , gprime x
( ) 1
fprime x
( )
2
f x
( ) fdblprime x
( )
⋅
−
fprime x
( )
2
−
:=
where fdblprime(x) is the second derivative of f(x) and gprime(x) is the first derivative of g(x).
Let us start with an initial estimate of -2.5 in an attempt to find the real root.
xold 2.5
−
:= xnew g xold
( )
:= xnew 0.1818
−
= gprime xnew
( ) 0.0389
=
xold xnew
:= xnew g xold
( )
:= xnew 0.7721
−
= gprime xnew
( ) 0.095
=
xold xnew
:= xnew g xold
( )
:= xnew 0.9768
−
= gprime xnew
( ) 0.0164
=
xold xnew
:= xnew g xold
( )
:= xnew 0.9997
−
= gprime xnew
( ) 1.9933 10
4
−
×
=
Chapter 3: Roots of Equations 69
xold xnew
:= xnew g xold
( )
:= xnew 1
−
= gprime xnew
( ) 2.6521 10
8
−
×
=
xold xnew
:= xnew g xold
( )
:= xnew 1
−
= gprime xnew
( ) 0
=
From the above calculations, it is clear that the real root is the converged value of (-1).
Let us now determine the complex roots by starting with an initial estimate of (-4+i)
xold 4
− i
+
:= xnew g xold
( )
:= xnew 2.9024
− 1.122i
+
=
xold xnew
:= xnew g xold
( )
:= xnew 2.2579
− 2.5753i
+
=
xold xnew
:= xnew g xold
( )
:= xnew 2.636
− 1.9589i
+
=
xold xnew
:= xnew g xold
( )
:=
xnew 3.0346
− 1.9196i
+
=
xold xnew
:= xnew g xold
( )
:= xnew 2.9957
− 2.001i
+
=
xold xnew
:= xnew g xold
( )
:= xnew 3
− 2i
+
=
xold xnew
:= xnew g xold
( )
:= xnew 3
− 2i
+
= <-- Converged
Clearly, if we had started with an initial estimate of (-4-i ), we would have obtained the
complex conjugate of the above complex root, as demonstrated below. However, there is no
need to do this every time, since a complex root will always have a complex conjugate
associated with it.
xold 4
− i
−
:= xnew 3
− 2i
+
=
xnew g xold
( )
:=
xold xnew
:= xnew g xold
( )
:= xnew 2.2579
− 2.5753i
−
=
70 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
xold xnew
:= xnew g xold
( )
:= xnew 2.636
− 1.9589i
−
=
xold xnew
:= xnew g xold
( )
:= xnew 3.0346
− 1.9196i
−
=
xold xnew
:= xnew g xold
( )
:= xnew 2.9957
− 2.001i
−
=
xold xnew
:= xnew g xold
( )
:=
xnew 3
− 2i
−
=
xold xnew
:= xnew g xold
( )
:= xnew 3
− 2i
−
= <-- Converged
3.6 USE OF MATHCAD'S root AND polyroots FUNCTIONS
Use of root
The function root (f(z),z) returns the value of "z" at which the function f(z) goes to zero.
Here, both f(z) and z are to be scalar quantities. The procedure to be used will be clear
from the following example.
Let us find the root of the function in Example 3.4 which is
f x
( ) x
3
4.2 x
⋅
− 8.5
−
:=
A guess value for the root must be first defined :
x 2.5
:=
Type the following to define " a" as the root of the given function
a root f x
( ) x
,
( )
:=
Chapter 3: Roots of Equations 71
Type " a= " to see the root computed.
a 2.7088
=
Use of polyroots
The function polyroots is a function in Mathcad which will return all roots of a polynomial at
the same time, be they real or complex. It does not require a guess value. polyroots (v)
returns all roots of an nth degree polynomial whose coefficients are given in the vector "v"
with (n+1) components. By choosing "matrix" from the "insert" menu, type in a vector "v"
as shown , beginning with the constant term, making sure that you insert all coefficients
even if they are zero. Then, polyroots(v) returns all roots at once. The following steps will
find the root of the polynomial of Example 3.4.
f x
( ) x
3
4.2 x
⋅
− 8.5
−
:= <-- Given polynomial
This is a vector of the coefficients of the polynomial whose
roots are to be found. Include all coefficients, even zeros.
Begin with the constant term.
<--
v
8.5
−
4.2
−
0
1
⎛
⎜
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎟
⎠
:=
polyroots v
( )
1.3544
− 1.1417i
−
1.3544
− 1.1417i
+
2.7088
⎛
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
= <-- Returns all roots at the same time.
3.7 SECANT METHOD
The Secant method is very similar to the Newton-Raphson method. The one difference is
that while the derivative fprime(x) is evaluated analytically in the Newton-Raphson method, it
is determined numerically in the Secant method .
From Figure 3.4, it is clear that an approximation for the slope of the given function f(x)
at x i can be written as
fprime xi
( ) =
f xi 1
−
( ) f xi
( )
−
( )
−
xi xi 1
−
−
(3.9)
72 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14
AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14

Weitere Àhnliche Inhalte

Ähnlich wie AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14

Katsuhiko Ogata _ Modern Control Engineering 5th Edition.pdf
Katsuhiko Ogata _ Modern Control Engineering 5th Edition.pdfKatsuhiko Ogata _ Modern Control Engineering 5th Edition.pdf
Katsuhiko Ogata _ Modern Control Engineering 5th Edition.pdftaha717855
 
Engineering mathematics.pdf
Engineering mathematics.pdfEngineering mathematics.pdf
Engineering mathematics.pdfEr. Rahul Jarariya
 
Modern-Control-Engineering-Fifth-Edition.pdf
Modern-Control-Engineering-Fifth-Edition.pdfModern-Control-Engineering-Fifth-Edition.pdf
Modern-Control-Engineering-Fifth-Edition.pdfMohamedHesham949112
 
M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17Piyush Pant
 
System%20 modelling%20and%20simulation
System%20 modelling%20and%20simulationSystem%20 modelling%20and%20simulation
System%20 modelling%20and%20simulationVivek Maurya
 
ANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptx
ANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptxANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptx
ANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptxSomu Gupta
 
Seminar report of mems
Seminar report of memsSeminar report of mems
Seminar report of memsGovind kumawat
 
kinematics of 8-axis robot for material handling applications
kinematics of 8-axis robot for material handling applicationskinematics of 8-axis robot for material handling applications
kinematics of 8-axis robot for material handling applicationsjani parth
 
Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)
Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)
Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)Jose Katab
 
final report
final reportfinal report
final reportNsaroj kumar
 
Design and Control of SR Drive System using ANFIS
Design and Control of SR Drive System using ANFISDesign and Control of SR Drive System using ANFIS
Design and Control of SR Drive System using ANFISAsoka Technologies
 
Study On Speed Sensorless SVM-DTC System Of PMSM
Study On Speed Sensorless SVM-DTC System Of PMSMStudy On Speed Sensorless SVM-DTC System Of PMSM
Study On Speed Sensorless SVM-DTC System Of PMSMAsoka Technologies
 
seven cylinder engine
seven cylinder engine seven cylinder engine
seven cylinder engine Nilesh Thorwe
 
Identification of parameters of an induction motor from field solution 9 11 n...
Identification of parameters of an induction motor from field solution 9 11 n...Identification of parameters of an induction motor from field solution 9 11 n...
Identification of parameters of an induction motor from field solution 9 11 n...Valentino Selayan
 
RETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURING
RETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURINGRETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURING
RETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURINGJyothiPrasadBM
 

Ähnlich wie AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14 (20)

Katsuhiko Ogata _ Modern Control Engineering 5th Edition.pdf
Katsuhiko Ogata _ Modern Control Engineering 5th Edition.pdfKatsuhiko Ogata _ Modern Control Engineering 5th Edition.pdf
Katsuhiko Ogata _ Modern Control Engineering 5th Edition.pdf
 
Engineering mathematics.pdf
Engineering mathematics.pdfEngineering mathematics.pdf
Engineering mathematics.pdf
 
Modern-Control-Engineering-Fifth-Edition.pdf
Modern-Control-Engineering-Fifth-Edition.pdfModern-Control-Engineering-Fifth-Edition.pdf
Modern-Control-Engineering-Fifth-Edition.pdf
 
M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17
 
R18 b.tech.ece syllabus1
R18 b.tech.ece syllabus1R18 b.tech.ece syllabus1
R18 b.tech.ece syllabus1
 
R18 b.tech.ece syllabus1
R18 b.tech.ece syllabus1R18 b.tech.ece syllabus1
R18 b.tech.ece syllabus1
 
System%20 modelling%20and%20simulation
System%20 modelling%20and%20simulationSystem%20 modelling%20and%20simulation
System%20 modelling%20and%20simulation
 
ANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptx
ANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptxANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptx
ANALYSIS AND DESIGN OF MULTIPHASE INDUCTION MACHINE.pptx
 
Seminar report of mems
Seminar report of memsSeminar report of mems
Seminar report of mems
 
kinematics of 8-axis robot for material handling applications
kinematics of 8-axis robot for material handling applicationskinematics of 8-axis robot for material handling applications
kinematics of 8-axis robot for material handling applications
 
Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)
Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)
Ajit Kumar Fundamentals Of Quantum Mechanics Cambridge University Press (2018)
 
Cek fe primer
Cek fe primerCek fe primer
Cek fe primer
 
final report
final reportfinal report
final report
 
Design and Control of SR Drive System using ANFIS
Design and Control of SR Drive System using ANFISDesign and Control of SR Drive System using ANFIS
Design and Control of SR Drive System using ANFIS
 
Study On Speed Sensorless SVM-DTC System Of PMSM
Study On Speed Sensorless SVM-DTC System Of PMSMStudy On Speed Sensorless SVM-DTC System Of PMSM
Study On Speed Sensorless SVM-DTC System Of PMSM
 
seven cylinder engine
seven cylinder engine seven cylinder engine
seven cylinder engine
 
Identification of parameters of an induction motor from field solution 9 11 n...
Identification of parameters of an induction motor from field solution 9 11 n...Identification of parameters of an induction motor from field solution 9 11 n...
Identification of parameters of an induction motor from field solution 9 11 n...
 
RETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURING
RETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURINGRETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURING
RETROFITMENT OF LASER CLADDING WITH CNC MACHINES FOR HYBRID LAYER MANUFACTURING
 
QRM Project
QRM ProjectQRM Project
QRM Project
 
MasterThesis
MasterThesisMasterThesis
MasterThesis
 

Mehr von Heather Strinden

53 Best Technical Report Example RedlineSP
53 Best Technical Report Example RedlineSP53 Best Technical Report Example RedlineSP
53 Best Technical Report Example RedlineSPHeather Strinden
 
Empathy Answer - PHDessay.Com. Online assignment writing service.
Empathy Answer - PHDessay.Com. Online assignment writing service.Empathy Answer - PHDessay.Com. Online assignment writing service.
Empathy Answer - PHDessay.Com. Online assignment writing service.Heather Strinden
 
Argumentative Essay Topics Dealing With Children - 10
Argumentative Essay Topics Dealing With Children - 10Argumentative Essay Topics Dealing With Children - 10
Argumentative Essay Topics Dealing With Children - 10Heather Strinden
 
TEEL Paragraph Sentence Starters Word Mat
TEEL Paragraph Sentence Starters Word MatTEEL Paragraph Sentence Starters Word Mat
TEEL Paragraph Sentence Starters Word MatHeather Strinden
 
Can Money Buy Happiness Essay - The Writing Center.
Can Money Buy Happiness Essay - The Writing Center.Can Money Buy Happiness Essay - The Writing Center.
Can Money Buy Happiness Essay - The Writing Center.Heather Strinden
 
College Essay Essentials A Step-By-Step Guide To Writ
College Essay Essentials A Step-By-Step Guide To WritCollege Essay Essentials A Step-By-Step Guide To Writ
College Essay Essentials A Step-By-Step Guide To WritHeather Strinden
 
How To Write A Presentation Us. Online assignment writing service.
How To Write A Presentation  Us. Online assignment writing service.How To Write A Presentation  Us. Online assignment writing service.
How To Write A Presentation Us. Online assignment writing service.Heather Strinden
 
Narrative Essay Writing PPT. Online assignment writing service.
Narrative Essay Writing  PPT. Online assignment writing service.Narrative Essay Writing  PPT. Online assignment writing service.
Narrative Essay Writing PPT. Online assignment writing service.Heather Strinden
 
Expository Story. Exposition In A Story Why Background Infor
Expository Story. Exposition In A Story Why Background InforExpository Story. Exposition In A Story Why Background Infor
Expository Story. Exposition In A Story Why Background InforHeather Strinden
 
How To Make Fun Cursive N. Online assignment writing service.
How To Make Fun Cursive N. Online assignment writing service.How To Make Fun Cursive N. Online assignment writing service.
How To Make Fun Cursive N. Online assignment writing service.Heather Strinden
 
All You Need To Know About Sociology Essay Writing Ser
All You Need To Know About Sociology Essay Writing SerAll You Need To Know About Sociology Essay Writing Ser
All You Need To Know About Sociology Essay Writing SerHeather Strinden
 
Annotating Musical Theatre Plots On Narrative Structure And Emotional Content
Annotating Musical Theatre Plots On Narrative Structure And Emotional ContentAnnotating Musical Theatre Plots On Narrative Structure And Emotional Content
Annotating Musical Theatre Plots On Narrative Structure And Emotional ContentHeather Strinden
 
Aristotle S Topics And Informal Reasoning
Aristotle S Topics And Informal ReasoningAristotle S Topics And Informal Reasoning
Aristotle S Topics And Informal ReasoningHeather Strinden
 
Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...
Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...
Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...Heather Strinden
 
3 Th Stage 2Nd Course
3 Th Stage 2Nd Course3 Th Stage 2Nd Course
3 Th Stage 2Nd CourseHeather Strinden
 
A LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MINING
A LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MININGA LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MINING
A LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MININGHeather Strinden
 
5 Important Deep Learning Research Papers You Must Read In 2020
5 Important Deep Learning Research Papers You Must Read In 20205 Important Deep Learning Research Papers You Must Read In 2020
5 Important Deep Learning Research Papers You Must Read In 2020Heather Strinden
 
Arabic Writing Challenges Faced By Students In Collegiate 1 Of Al
Arabic Writing Challenges Faced By Students In Collegiate 1 Of AlArabic Writing Challenges Faced By Students In Collegiate 1 Of Al
Arabic Writing Challenges Faced By Students In Collegiate 1 Of AlHeather Strinden
 
An Inquiry-Based Case Study For Conservation Biology
An Inquiry-Based Case Study For Conservation BiologyAn Inquiry-Based Case Study For Conservation Biology
An Inquiry-Based Case Study For Conservation BiologyHeather Strinden
 
An Introduction To Environmental Auditing
An Introduction To Environmental AuditingAn Introduction To Environmental Auditing
An Introduction To Environmental AuditingHeather Strinden
 

Mehr von Heather Strinden (20)

53 Best Technical Report Example RedlineSP
53 Best Technical Report Example RedlineSP53 Best Technical Report Example RedlineSP
53 Best Technical Report Example RedlineSP
 
Empathy Answer - PHDessay.Com. Online assignment writing service.
Empathy Answer - PHDessay.Com. Online assignment writing service.Empathy Answer - PHDessay.Com. Online assignment writing service.
Empathy Answer - PHDessay.Com. Online assignment writing service.
 
Argumentative Essay Topics Dealing With Children - 10
Argumentative Essay Topics Dealing With Children - 10Argumentative Essay Topics Dealing With Children - 10
Argumentative Essay Topics Dealing With Children - 10
 
TEEL Paragraph Sentence Starters Word Mat
TEEL Paragraph Sentence Starters Word MatTEEL Paragraph Sentence Starters Word Mat
TEEL Paragraph Sentence Starters Word Mat
 
Can Money Buy Happiness Essay - The Writing Center.
Can Money Buy Happiness Essay - The Writing Center.Can Money Buy Happiness Essay - The Writing Center.
Can Money Buy Happiness Essay - The Writing Center.
 
College Essay Essentials A Step-By-Step Guide To Writ
College Essay Essentials A Step-By-Step Guide To WritCollege Essay Essentials A Step-By-Step Guide To Writ
College Essay Essentials A Step-By-Step Guide To Writ
 
How To Write A Presentation Us. Online assignment writing service.
How To Write A Presentation  Us. Online assignment writing service.How To Write A Presentation  Us. Online assignment writing service.
How To Write A Presentation Us. Online assignment writing service.
 
Narrative Essay Writing PPT. Online assignment writing service.
Narrative Essay Writing  PPT. Online assignment writing service.Narrative Essay Writing  PPT. Online assignment writing service.
Narrative Essay Writing PPT. Online assignment writing service.
 
Expository Story. Exposition In A Story Why Background Infor
Expository Story. Exposition In A Story Why Background InforExpository Story. Exposition In A Story Why Background Infor
Expository Story. Exposition In A Story Why Background Infor
 
How To Make Fun Cursive N. Online assignment writing service.
How To Make Fun Cursive N. Online assignment writing service.How To Make Fun Cursive N. Online assignment writing service.
How To Make Fun Cursive N. Online assignment writing service.
 
All You Need To Know About Sociology Essay Writing Ser
All You Need To Know About Sociology Essay Writing SerAll You Need To Know About Sociology Essay Writing Ser
All You Need To Know About Sociology Essay Writing Ser
 
Annotating Musical Theatre Plots On Narrative Structure And Emotional Content
Annotating Musical Theatre Plots On Narrative Structure And Emotional ContentAnnotating Musical Theatre Plots On Narrative Structure And Emotional Content
Annotating Musical Theatre Plots On Narrative Structure And Emotional Content
 
Aristotle S Topics And Informal Reasoning
Aristotle S Topics And Informal ReasoningAristotle S Topics And Informal Reasoning
Aristotle S Topics And Informal Reasoning
 
Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...
Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...
Activity-Based Rail Freight Costing A Model For Calculating Transport Costs I...
 
3 Th Stage 2Nd Course
3 Th Stage 2Nd Course3 Th Stage 2Nd Course
3 Th Stage 2Nd Course
 
A LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MINING
A LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MININGA LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MINING
A LITERATURE REVIEW ON PHISHING EMAIL DETECTION USING DATA MINING
 
5 Important Deep Learning Research Papers You Must Read In 2020
5 Important Deep Learning Research Papers You Must Read In 20205 Important Deep Learning Research Papers You Must Read In 2020
5 Important Deep Learning Research Papers You Must Read In 2020
 
Arabic Writing Challenges Faced By Students In Collegiate 1 Of Al
Arabic Writing Challenges Faced By Students In Collegiate 1 Of AlArabic Writing Challenges Faced By Students In Collegiate 1 Of Al
Arabic Writing Challenges Faced By Students In Collegiate 1 Of Al
 
An Inquiry-Based Case Study For Conservation Biology
An Inquiry-Based Case Study For Conservation BiologyAn Inquiry-Based Case Study For Conservation Biology
An Inquiry-Based Case Study For Conservation Biology
 
An Introduction To Environmental Auditing
An Introduction To Environmental AuditingAn Introduction To Environmental Auditing
An Introduction To Environmental Auditing
 

KĂŒrzlich hochgeladen

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

KĂŒrzlich hochgeladen (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
CĂłdigo Creativo y Arte de Software | Unidad 1
CĂłdigo Creativo y Arte de Software | Unidad 1CĂłdigo Creativo y Arte de Software | Unidad 1
CĂłdigo Creativo y Arte de Software | Unidad 1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 

AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14

  • 1. AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD Mathcad Release 14 Khyruddin Akbar Ansari, Ph.D., P.E. Professor of Mechanical Engineering School of Engineering and Applied Science Gonzaga University Spokane, Washington
  • 2. Copyright 2007 Khyruddin Akbar Ansari. All rights reserved No part of this book may be used or reproduced or distributed in any form , or by any means or stored in a database or retrieval system, without the prior written permission of the author . Mathcad screenshots are reprinted by permission of Parametric Technology Corporation (PTC). Mathcad is a registered trademark of PTC, 140 Kendrick Street, Needham, MA 02494. All rights reserved
  • 3. Dedicated to my dear wife, Fatima
  • 4. ABOUT THE AUTHOR Khyruddin Akbar Ansari, who has been a professor of mechanical engineering at Gonzaga University in Spokane, Washington, since 1986, received his bachelor’s degree in electrical engineering from Osmania University, Hyderabad, India in 1964, his master’s degree in mechanical engineering from the University of California at Berkeley in 1965 and his Ph.D. degree in engineering mechanics from the University of Texas at Arlington in 1972. He did his doctoral thesis work in the area of nonlinear vibrations of rotating blades under the guidance of the late Professor Nils O. Myklestad. Professor Ansari has many years of varied industrial , teaching and research experience, having been associated in the past with such organizations as Bell Helicopter, Westinghouse Electric , Bell Aerospace, Brown and Root, King Fahd’s University of Petroleum and Minerals and Battelle Pacific Northwest Laboratories . At Gonzaga University, Professor Ansari is currently involved in the teaching of courses in the areas ofengineeringmechanics,numerical methods,advancedengineeringmathematics,vibrations, system dynamics and controls , and machine design. His research, which has been varied, has resulted in several published articles and contributions to books including chapters in the Encyclopedia of Fluid Mechanics and Developments in Offshore Engineering. Professor Ansari is a member of the American Society of Mechanical Engineers and the American Society for Engineering Education. He is also a registered professional engineer.
  • 5. TABLE OF CONTENTS Preface v 1. Basics of Mathcad. 1 1.1 Introduction 1 1.2 The Mathcad Screen 1 1.3 Exact Answers 3 1.4 Variables, Functions and Live math. 3 1.5 Feedback 4 1.6 Graphics 5 1.7 Graphing of Functions and Plotting of Data 5 1.8 Animations 7 1.9 The Mathcad Tutorials 7 1.10 Advantages of Mathcad 7 1.11 Computations in Mathcad 10 1.12 The Mathcad Window, Toolbars and Palettes 13 1.13 Mathcad Regions 15 1.14 Entering Math and Text 16 1.15 Mathcad Worksheets,Templates and Styles 17 1.16 Defining Variables 18 1.17 Defining Functions in Mathcad 19 1.18 Building and Editing Mathematical Expressions 21 1.19 Defining Range Variables 23 1.20 Defining Vectors and Matrices 24 1.21 Creating Graphs 28 1.22 Formatting Math, Text and Results 35 1.23 Using Units 39 2. Introduction to Numerical Methods. 43 2.1 The Use of Numerical Methods in Science and Engineering 43 2.2 Comparison of Numerical Methods with Analytical Methods 43 2.3 Sources of Numerical Errors and their Computation 44 2.4 Taylor Series Expansion 44 Problems 49 3. Roots of Equations. 53 3.1 Introduction 53 3.2 Methods Available 53 3.3 Bisection Method 53 3.4. The Regula Falsi or the False Position Method 58 3.5 Newton-Raphson Method 65 3.6 Use of Mathcad’s root and polyroots Functions 71 Table of Contents: i
  • 6. 3.7 Secant Method 72 3.8. Method of Successive Substitution 78 3.9 Multiple Roots and Difficulties in Computation 80 3.10. Solution of Systems of Nonlinear Equations 84 3.11 Solving Systems of Equations using Mathcad's Given and Find Functions 86 3.12 Applications in Root-Finding 87 3.12.1 Maximum Design Load for a Column 87 3.12.2 Natural frequencies of Vibration of a Uniform Beam 89 3.12.3 Solving the Characteristic Equation in Control Systems Engineering 91 3.12.4 Horizontal Tension in a Uniform Cable 93 Problems 96 4. Matrices and Linear Algebra. 103 4.1 Basic Matrix Operations 103 4.2 Use of Mathcad in Performing Matrix Operations 105 4.3 Solution of Linear Algebraic Equations by Using the Inverse 108 4.4 Solution of Linear Algebraic Equations by Cramer’s Rule 110 4.5 Solution of Linear Algebraic Equations Using the Function lsolve 112 4.6 The Eigenvalue Problem 114 4.7 Solving the Eigenvalue Problem with Mathcad 116 4.8 Application of the Eigenvalue Problem to Vibration Engineering 117 4.9 Application of the Eigenvalue Problem to Stress Analysis- Determination of Principal Stresses and Principal Directions 125 4.10 Repeated Roots in the Determinantal Equation 128 4.11 Solution of Nonlinear Simultaneous Equations 131 Problems 134 5. Numerical Interpolation. 141 5.1 Linear Interpolation 141 5.2 The Method of Undetermined Coefficients 141 5.3 The Gregory-Newton Interpolating Polynomial 144 5.4 Interpolation Using Finite Differences 149 5.5 Newton’s Method Utilizing Finite Differences 151 5.6 The Lagrange Interpolating Polynomial 155 5.7 Interpolation Using Linear, Quadratic and Cubic Splines 158 5.8 Interpolation with Mathcad 159 5.9 Applications in Numerical Interpolation 168 5.9.1 Stress-Strain data for Titanium 168 5.9.2 Notch Sensitivity of Aluminum 169 5.9.3 Speech Interference Level 172 5.9.4 Load-Deflection Data for Elastomeric Mounts 175 Problems 177 ii AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 7. 6. Curve-Fitting. 183 6.1 The Need to Fit a Function to Measured Data 183 6.2 The Method of Least Squares. 184 6.3 Straight Line Regression 185 6.4 Curve-Fitting with a Quadratic Function 188 6.5 Curve-Fit with a Power Function 191 6.6 Curve-Fitting with an Exponential Function 194 6.7 Curve-Fitting with a Linear Combination of Known Functions 199 6.8 Curve-Fitting with Polynomials. 203 6.9 Use of Mathcad's Regression Functions for Curve-Fitting 207 6.9.1 Linear Regression with Mathcad 207 6.9.2 Nonlinear Regression with Mathcad 209 6.9.3 Use of the Function linfit 211 6.9.4 Use of the Function genfit 213 6.9.5 Use of the Mathcad Functions logfit, lnfit, pwrfit and expfit 215 6.9.6 More Examples with Mathcad 220 6.10 Applications in Curve-Fitting 236 6.10.1 Fatigue Failure Curve for Loading in the Finite Life Range 236 6.10.2 Temperature Response of an Object Placed in a Hot Stream of Air 239 6.10.3 The Effect of Operating Temperature on the Strength of a Mechanical Element 242 6.10.4 Drop-Testing of Packaged Articles 245 Problems 248 7. Numerical Differentiation 255 7.1 Introduction to Numerical Differentiation and the Use of the Mathcad Derivative Operators 255 7.2 Method of Finite Differences 255 7.3 Interpolating Polynomial Method 259 7.4 Applications in Numerical Differentiation 262 7.4.1 Determination of Velocities and Accelerations from Given Displacement Data 262 7.4.2 Determination of Shock Absorber Parameters, and Damper and Spring Restoring Forces from Given Vehicle Displacement Data 266 Problems 271 8. Numerical Integration 277 8.1 Introduction to Numerical Integration and the Use of the Mathcad Integral Operator 277 8.2 The Interpolating Polynomial Method 279 8.3 Trapezoidal Rule 280 8.4 Simpson’s Rules 283 Table of Contents: iii
  • 8. 8.4.1 Simpson’s One-Third Rule 283 8.4.2 Simpson’s Three-Eighth Rule 286 8.4.3 Limitations of Simpson’s Rules 287 8.5 Romberg Integration 288 8.6 Applications in Numerical Integration 301 8.6.1 Centroid of a Rod Bent into the Shape of A Parabola 301 8.6.2 Moment of Inertia of a Beam of Semi-Elliptic Cross Section 302 8.6.3 Launch of a Projectile 303 8.6.4 Large Oscillations of a Simple Pendulum 304 Problems 306 9. Numerical Solution of Ordinary Differential Equations. 311 9.1 Introduction 311 9.2 Taylor Series Method 312 9.3 Euler’s Method 317 9.4 Modified Euler’s Method 323 9.5 Runge- Kutta Methods 329 9.5.1 Fourth-Order Runge-Kutta Method 329 9.5.2 Mathcad Solutions to a First-Order Differential Equation 335 9.6 Systems of Ordinary Differential Equations 341 9.7 Solution of Higher-Order Ordinary Differential Equations 349 9.8 Boundary-Value Problems and the Shooting Method 358 9.9 Applications in Numerical Solution of Ordinary Differential Equations 363 9.9.1 Response of an Electric R-L Circuit to a Unit-Step Voltage Input 363 9.9.2 Deflection Curve of a Cantilevered Beam with a Uniformly Distributed Load 364 9.9.3 Temperature Response of a Solid Steel Ball Placed in a Hot Stream of Air 366 9.9.4 Nonlinear Vibration of a Simple Pendulum 367 9.9.5 Transient Vibration of a Spring-Mass-Damper System Excited by a Pulse Function 370 9.9.6 Nonlinear Vibration of a Damped System with a Hardening Spring 373 9.9.7 Temperature Distribution in the Wall of a Pipe Carrying a Hot Fluid 378 9.9.8 Response of an R-L Circuit with a Nonlinear Resistor 382 9.9.9 The Effect of Damping on the Step Response of a Second-Order Control System 384 Problems 386 Bibliography 399 Index 401 iv AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 9. PREFACE This book, which is designed to be used in a first numerical methods course in a computer science, mathematics, science , engineering or engineering technology curriculum, has been developed from notes that I generated over several years in the process of teaching a one- semester / three-credit sophomore level course in computer methods at Gonzaga University. It should also provide a reliable source of reference material to practicing engineers and scientists and in other junior and senior-level courses such as machine design, vibrations, system dynamics and controls, where Mathcad can be effectively utilized as a software tool in problem solving. A principal goal of this book , then, is to furnish the background needed to create Mathcad documents for the generation of solutions to a variety of problems. Specific applications involving root-finding, interpolation, curve-fitting, matrices, derivatives, integrals and differential equations are discussed and the broad applicability of Mathcad demonstrated. The material contained herein should be easily grasped by students with a background in calculus, elementary differential equations and some linear algebra, and when utilized in a mathematics, science, engineering, computer science or engineering technology course sequence, it should give a good basic coverage of numerical methods while simultaneously demonstrating the general applicability of Mathcad to problem- solving and solution documentation. The first chapter discusses Mathcad basics while the second gives a general introduction to numerical methods in science and engineering and presents the computation of numerical errors along with the Taylor series as a basis of approximation in numerical analysis. Chapter 3 offers a coverage of the popular methods of finding roots of equations such as Bisection, Regula-Falsi, Newton-Raphson, Secant and Iteration . Solutions to systems of nonlinear algebraic equations obtained by the iteration method are also presented. The applicability of root-finding to practical problems such as those that occur in column design, vibration analysis and control systems engineering is demonstrated. In the fourth chapter, matrices and linear algebra are dealt with along with the solution of eigenvalue problems. Applications to the field of vibration engineering and stress analysis are also discussed. Chapters 5 and 6 focus on numerical interpolation and curve- fitting respectively. The common techniques of interpolation and the functions generally resorted to for curve-fitting of data are covered quite thoroughly. The applicability of these to the analysis of scientific and engineering data such as stress-strain, load-deflection and fatigue failure is presented. Chapters 7 and 8 address numerical differentiation and integration. The concept of finite differences is introduced and the common methods of differentiation and integration , such as the interpolating polynomial method, trapezoidal and Simpson’s rules and Romberg integration are covered. Applications of numerical differentiation and integration such as determination of velocities and accelerations from given displacement data and computation of the moment of inertia of a cross section are included. The last chapter, which is the ninth one, deals with coverage of numericalsolutionofordinarydifferentialequations,andalthough it does not discuss each and every technique that is available, it does focus on the popular ones such as Taylor series method, Euler, modified Euler and Runge-Kutta methods. A variety of practical applications of numerical procedures are included in this chapter, ranging from the response of an electric circuit to an input Preface: v
  • 10. voltage to the effect of damping on the response of a control system. Partial differential equations is a topic that is typically dealt with in detail only in graduate level courses and , therefore, I did not think it very appropriate to introduce it in this book which is really aimed at the needs of undergraduate students. Mathcad documents are generated and examples showing the applicability and use of Mathcad are presented throughout the book. Wherever appropriate, the use of Mathcad functions offering shortcuts and alternatives to otherwise long and tedious numerical solutions is also demonstrated. At the end of every chapter is included a set of problems to be solved covering the material presented. A solutions manual that provides solutions to these exercises can be made available to instructors. Although Mathcad is a very powerful and versatile tool that combines text, graphics and equations in a single worksheet, several figures and sketches in the book had to be done using AutoCad. The help provided by Carlos G. Alfaro earlier in generating these figures and Ryan Lambert later in making some additions and modifications to them is gratefully acknowledged. I am also thankful to those of my students who have so kindly made useful suggestions and pointed out errors and mistakes in the manuscript. Their input and feedback have certainly been helpful. Last but not least, I am indebted to my wife, Fatima , for her patience, support and understanding during the preparation of this book. Without her encouragement, its completion would still be wishful thinking. Users of this book are welcome to e-mail any comments and suggestions to me at ansari@gonzaga.edu , and, of course, I will be pleased to address these in subsequent versions / editions. Khyruddin . Akbar Ansari October 2007 vi: AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 11. C H A P T E R 1 BASICS OF MATHCAD 1.1 INTRODUCTION Mathcad 14 is the first global release of Mathcad presented by Parametric Technology Corporation (PTC) with many significant enhancements since it acquired Mathsoft in April 2006. This is a very powerful software that offers a wide variety of tools in the solution of problems requiring the use of numerical analysis. New ways of using Mathcad are constantly being found leading to overwhelming possibilities. The sections that follow give an overview of the features in Mathcad 14 and will help the novice to get introduced to its problem-solving capabilities. Mathcad 14 has a number of improvements and added capabilities designed to increase the productivity of the user as well as Web connectivity. There is a wealth of information that can be found by clicking on "Help" and going to "Tutorials" , where you can get an overview and a quick tour of Mathcad , see the new features available in Mathcad 14, learn the fundamental skills for working in Mathcad, and obtain on-line help if needed. By clicking on "Help", the Mathcad Quicksheets can be accessed, which are ready-made recipes for performing a variety of tasks in Mathcad. E-books and Reference Tables, user-contributed files, samples, animations and graphs along with other example files for using and extending Mathcad can also be accessed. By choosing "User Forums" under the "Help" menu, questions can be posted for other Mathcad users. The Mathcad web site can always be accessed for updates, technical support information and user files , and Mathcad documents can now be saved on the Web or in Microsoft Word using Rich Text Format (RTF). 1.2 THE MATHCAD SCREEN Mathcad has a full screen numerical and symbolic calculator, which is essentially a blank workspace that you see when you open up a new Mathcad document. To use Mathcad's calculating capabilities, type the expression you want to evaluate and then type an equals sign to get the result: 435 57 24 + 437.375 = As shown in Figure 1.1. the palette buttons open up palettes that include a host of math operations . An expression such as the following can be assembled quite easily. sin π 8 ⎛ ⎜ ⎝ ⎞ ⎟ ⎠ ln 76.5 ( ) e 95.2 ⋅ 1.952 10 40 × = Chapter 1: Basics of Mathcad 1
  • 12. Figure 1.1 The Math palettes 2 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 13. Matrix arithmetic, calculus operations such as differentiation and integration, and essentially all of the mathematical operations normally required in engineering and scientific analysis can be easily done in Mathcad. Some examples are given below. 2 7 x e 2x sin 4 x ⋅ ( ) ⋅ ⌠ ⎼ ⌡ d 2.641 10 5 × = 7 9i + 13 7i − 0.128 0.761i + = 5 4 7 2 8 3 7 9 6 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ 1 − 0.168 − 0.312 − 0.352 0.072 − 0.152 8 10 3 − × 0.304 0.136 0.256 − ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ = 1.3 EXACT ANSWERS If exact answers are needed in terms of fractions and radicals instead of decimals, the "symbolic equals sign" (-->) on the fourth math palette can be used to obtain exact answers. Some examples are given below. 546 59 17 + 9341 17 → sin π 16 ⎛ ⎜ ⎝ ⎞ ⎟ ⎠ ln 75.6 ( ) e 90.5 ⋅ 9.0751625112586372168e37 → 5 4 9 2 8 3 3 9 5 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ 1 − 13 7 61 7 60 7 − 1 7 − 2 7 − 3 7 6 7 − 33 7 − 32 7 ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ → 2 7 x e 2 x ⋅ sin 4 x ⋅ ( ) ⋅ ⌠ ⎼ ⌡ d cos 8 ( ) e 4 ⋅ 5 cos 28 ( ) e 14 ⋅ 5 − e 4 sin 8 ( ) ⋅ 10 − e 14 sin 28 ( ) ⋅ 10 + → 1.4 VARIABLES, FUNCTIONS AND LIVE MATH When there is a need to evaluate an expression for several different inputs, the desired variables and functions can be defined and calculated like built-in constants and functions. This computational feature in Mathcad is called live math. Chapter 1: Basics of Mathcad 3
  • 14. For example, if the area of a circle for various values of the radius is to be calculated, define a radius variable r and give it a value. r 8 := The := symbol can be inserted by typing a colon. Evaluate the area as π r 2 ⋅ 201.062 = The numerical value of r can now be changed to some other number . Click anywhere outside the definition to recalculate the area . . This is live math . If this area computation is to be usable in other parts of the worksheet, an area function must be defined. area r ( ) π r 2 ⋅ := Use this function as needed to calculate an area . Length units for the radius can also be assigned as shown.. area 60 cm ⋅ ( ) 1.131 m 2 = Live math works for symbolic answers as well. Put in a function , obtain the derivative of the function, and then change the function to some other function. Click outside the definition to see how Mathcad redoes the derivative symbolically. 1.5 FEEDBACK There is continuous feedback in Mathcad. As you edit math expressions, the status line will provide advice and information . When Mathcad cannot understand something, it will color the expression red. Clicking on this red expression will give an error message indicating what is wrong. To see an example, click on the expression below. p q + = p In the above, variables p and q were not defined. Therefore, Mathcad tells us so. Also, Mathcad calculates from top to bottom and left to right. p 5 := q 9 := <--This works ---> p q + 14 = 4 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 15. F 4 ( ) = F <-This does not work F x ( ) x 2 4 − := 1.6 GRAPHICS It has been demonstrated that Mathcad can be used as a calculator and as an equation solver. It can also be used as a versatile visualization tool that supports a full set of plot types, an animation facility, as well as simple image processing. 1.7 GRAPHING OF FUNCTIONS AND PLOTTING OF DATA To create a plot in Mathcad, type the expression you would like to plot, say t 9 . Then click the graphing button on your palette bar (See Figure 1.2 ) to bring up the graphing palette and click the upper left button for an XY plot. Click outside the graph or press [Enter] to see the result: 4 − 2 − 0 2 4 1 − 10 5 × 5 − 10 4 × 0 5 10 4 × 1 10 5 × t 9 t Parametric plots can also be done easily . . 1 − 0.5 − 0 0.5 1 1 − 0.5 − 0 0.5 1 sin 5 t ⋅ ( ) cos 7 t ⋅ ( ) Chapter 1: Basics of Mathcad 5
  • 16. Figure 1.2 The graph palette 6 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 17. . . . and like all Mathcad calculations, plots are also live, which means that changes can be easily made. 1.8 ANIMATIONS Mathcad can create and play short animation clips by using the built-in variable FRAME and the Animation dialog box. Choose Animation, and then Record from the Tools menu to bring up this dialog box Plots as well as numerical results can be animated, and the animation played back at different speeds. 1.9 THE MATHCAD TUTURIALS The Mathcad tutorials offer a step-by-step guide to building and editing expressions, creating and formatting graphs, using Mathcad's wordprocessing capability to enter and format text, working with units and utilizing Mathcad's built-in functions and operators. For a Mathcad novice, this is a good place to begin. The Mathcad tutorials can be accessed as indicated in Figure 1.3 by choosing Help and then Tutorials . 1.10 ADVANTAGES OF MATHCAD Mathcad offers a great way to work with equations, numbers, text, and graphs. Unlike other programs, Mathcad uses the language of mathematics and does mathematics in a very natural way. It works like a scratchpad and pencil combination . Mathcad's on-screen interface is a blank worksheet on which equations, graph data or functions can be entered and combined with text -- anywhere on the page. In Mathcad, an equation looks exactly as in a textbook : x b − b 2 4 a ⋅ c ⋅ − + 2 a ⋅ = Mathcad's equations and graphs are live, which means that any data, variable, or equation can be changed with Mathcad doing an instant recalculation and redrawing of the graphs. Mathcad can solve a wide range of problems, numerically as well as symbolically, and equations and data can be evaluated with 2D and 3D plots. Mathcad Quicksheets are full-featured worksheets that offer ready-made Mathcad templates that can be customized to perform a wide range of mathematical tasks from solving equations to graphing and calculus. They also demonstrate how some of Mathcad's special features like programming and animation can be used. Choose Help and then QuickSheets to use this capability. Chapter 1: Basics of Mathcad 7
  • 18. Figure 1.3 Accessing the Mathcad tutorials 8 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 19. Mathcad's Electronic Books have a wealth of mathematical knowledge and reference material -- all live - which can be dragged and dropped into your worksheets. In order to do this, choose Help and then E-books . Mathcad has proven to be an extremely remarkable , effective and powerful tool for the solution of problems. A wide range of problems can indeed be explored, formulated, analyzed and optimized, after which the best solution can be documented and presented. By choosing Help and then User Forums, users can connect with and share their work with colleagues and other professionals around the world , and collaboration is easy . A host of forums can be accessed as shown in Figure 1.4. Figure 1.4 Accessing the Mathcad Collaboratory Chapter 1: Basics of Mathcad 9
  • 20. 1.11 COMPUTATIONS IN MATHCAD Figure 1.5 The Insert/ Function buttons in Mathcad 10 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 21. Several mathcad palettes can be found on the palette strip at the top of the window that give access to Mathcad's mathematical operators. A click in your worksheet will place a red crosshair cursor. Math operators can now be placed in the worksheet via these palettes. To access Mathcad's built-in functions, go to the Insert menu as shown in Figure 1.5, and select Function , or click on the Insert Function button on the toolbar . EXAMPLES In the following examples, the number of decimal places required may be put in by choosing Result from the Format menu and then selecting Number Format. The red crosshair Use the Arithmetic Palette (See Figure 1.1) , and type = to obtain the answer. The basic operations are +, -, *, and / which are available on the keyboard . 2.645 10 8 ⋅ 30007 5 5 6 + 1.0426928428 10 7 − × = <-- <- Examples of built-in functions (See Figure 1.5) log 1768.985 ( ) sin 4 79 π ⋅ ⎛ ⎜ ⎝ ⎞ ⎟ ⎠ ⋅ 0.514 = 14.95 5.7i ( ) + [ ] 3 e 6 5i − + 1.999 10 3 × 4.024i 10 3 × + = <-- Complex numbers. Use of units- Choose Unit from the Insert menu (See Figure 1.5) <--- . 7600 km ⋅ 1 hr ⋅ 2.11 10 3 × m s 1 − ⋅ = Use of := by typing a colon character or using the Arithmetic Palette a 8 := a 3 a 4 + 513.414 = <---- f x ( ) sin x ( ) a x 6 + := f 37 ( ) 0.045 − = <-- Use of a defined function Chapter 1: Basics of Mathcad 11
  • 22. Use of the range operator in the Arithmetic Palette. You can also use a semicolon (;). This will evaluate any function of z for z values from zero to 1 in increments of 0.2 z 0 .2 , 1 .. := <-- z 0 0.2 0.4 0.6 0.8 1 = f z ( ) 0 0.025 0.048 0.07 0.088 0.103 = cos f z ( ) ( ) z ⋅ 0 0.2 0.4 0.599 0.797 0.995 = <-- Create these tables by typing z=, f(z)=, etc. x 0 0.2 , 20 .. := <-- Define a range of values for the plot. 0 5 10 15 20 0.2 − 0.1 − 0 0.1 0.2 f x ( ) cos x ( ) f x ( ) x Use the X-Y Plot button in the Graph Palette, and type expressions to be plotted in the middle placeholders on the x and y axes. Several expressions separated by a comma (,) can be entered in these placeholders. <-- 0 100 n 1 n! cos 2 n ⋅ ( ) ⋅ ∑ = 2.28758499 − = Use the Calculus Palette (See Figure 1.1) to do sums, derivatives and integrals. Click in your worksheet to position the red crosshair, click on the proper button in the palette, then fill in each placeholder as appropriate . <-- 0 25 x 1 1 x 3 e x ⋅ + ⌠ ⎼ ⎼ ⎼ ⌡ d 0.842 = x 5 := x e x sin x ( ) ⋅ ( ) d d 100.218 − = 12 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 23. Matrices can be entered using the Vector and Matrix palette or by going to the Insert menu and choosing Matrix . A 3 1 1 7 5 10 1 6 2 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ := <-- A 1 − 0.427 0.034 − 0.043 − 0.034 0.043 − 0.197 0.316 − 0.145 0.068 − ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ = <-- Type A ^-1= to obtain the inverse A 117 − = <-- Use the Vector and Matrix Palette to obtain the determinant. t 2.5 := root t 4 cos 3 t ⋅ ( ) − t , ( ) 0.502 = <-- Find the root of an expression using the root function, starting with the guess of t =2.5 1.12 THE MATHCAD WINDOW, TOOLBARS AND PALETTES The Mathcad Window and the Main Menu This does math, graphics and symbolic algebra besides handling the editing and management of a worksheet. The array of computational and formatting capabilities available can be seen by clicking on each of the menus. The Math Toolbar This is below the main menu. It opens up palettes of math operators as described below. Chapter 1: Basics of Mathcad 13
  • 24. Calculator toolbar Boolean toolbar Graph toolbar Programming toolbar Matrix toolbar Greek toolbar Evaluation toolbar Symbolic toolbar Calculus toolbar Just click on one of these as appropriate and start inserting math symbols into the worksheet. The Standard Toolbar This provides shortcuts for many common tasks from opening and saving files, cutting and deleting to spell checking and bringing up lists of built-in functions and units. Hover over each button to see tooltips with a brief description. The Formatting Toolbar This formats your text and math at the click of a button. In case the Format Bar does not show, go to the View Menu, select Toolbars and then Formatting. The Resources Window and E- books If you seek examples, want information that can be utilized in your Mathcad worksheets or wish to access web information from within Mathcad, go to the Help menu, and then open Tutorials, QuickSheets , Reference Tables or E-books. Tutorials includes Getting Started Primers, Migration Guide and Features In-Depth, while Quicksheets are live examples showing the use of Mathcad functions, graphs and programming features. Information on physical constants, chemical and physical data and mathematical formulas in Mathcad format can be found in Reference tables . Mathcad E-books can be accessed by opening E-books. These E-books have the advantage that all equations are live in them and you can change the values of variables, constants etc. to test and evaluate different results. A number of Mathcad E-books and articles are also available in the Resources section on http://www.ptc.com/go/mathsoft/mathcad/. 14 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 25. Controlling Calculation and The Status Line The calculation mode, whether manual or automatic, is a property saved in your worksheet and template files. Mathcad starts in the automatic mode and all calculations and results are updated automatically. The word " Auto " can be seen in the message line at the bottom of the Mathcad window. This line provides status alerts, tips, keyboard shortcuts, and other helpful information along with the calculation status of the worksheet . Here, "auto" refers to the automatic mode , in which Mathcad automatically recalculates any math expressions when changes in the worksheet are made. When "WAIT" appears on the status line, the cursor changes to a flashing lightbulb, indicating that Mathcad is still completing computations. Besides giving the page number of the current worksheet, the message line will also indicate whether the Caps Lock or the Num Lock key is depressed on your keyboard. In manual mode, Mathcad does not compute or show results until recalculation is specifically requested. However, while in manual mode, Mathcad does keep track of pending computations . Once a change is made that requires recalculation, the word " Calc " appears on the status line to indicate to the user that the results being displayed are not correct and that recalculation is necessary to ensure accuracy. The screen can then be updated by going to the Tools menu and choosing Calculate and then Calculate Now . Alternatively, click = on the Standard toolbar or press [F9]. To force Mathcad to recalculate all equations in the worksheet, go to the Tools menu and choose Calculate and then Calculate Worksheet . 1.13 MATHCAD REGIONS Mathcad allows you to enter equations, text and graphs as separate objects anywhere in the worksheet and each equation, text paragraph or plot is considered a region. A region can be selected by clicking in math or text in your worksheet, after which it is indicated by a thin rectangle around it. Moving the cursor to one of the edges of the region, will change it to a small hand with which the region can be moved to anywhere in the worksheet. While clicking in the math region will bring blue selecting lines under the material selected, clicking in a text region will bring black boxes to each corner and the middle of each line. With these boxes text regions can be resized as needed. To add a border around a region or regions, select the region(s), then right-click and choose Properties from the menu. Then click on the Display tab and check the box next to " Show Border ". A math region looks like: A text region looks like: x 1535.56 := What is shown on the left was created by typing x:1535.56 Chapter 1: Basics of Mathcad 15
  • 26. Moving Regions in the Worksheet This can be accomplished by clicking in a region and drag-selecting it to put it in a dashed selection box and then moving the cursor to the edge where it shows up as a small black hand. Now, use the mouse to move the region as necessary by holding down the left mouse button and dragging it. Once the regions are positioned in the desired manner, the mouse button may be released . Then, an empty part of the screen may be clicked on to deselect the regions. Alternatively, choose Regions from the View menu, which will highlight the boundaries of the region against a contrasting background. Cut and Paste can also be used to move regions. Once regions are inserted in the worksheet, they can be aligned horizontally or vertically by going to the Format menu and choosing Align Regions. How Mathcad Reads Your Document Mathcad reads your document from left to right and top to bottom . For example, if the value of a function , ln(y) is desired for y= 67, either of the following setups will work. (a) y 67 := ln y ( ) 4.205 = (b) y 67 := ln y ( ) 4.205 = Deleting Selected Regions Selected regions in dashed line boxes can be deleted by choosing Cut from the Edit menu. Copying and Pasting Selected Regions Selected regions can also be copied and put into any place within a document or into another document by choosing the Copy and Paste commands from the Edit menu . 1.14 ENTERING MATH AND TEXT Entering Math Math can be entered by clicking the mouse in a blank space to see a red crosshair cursor. Type 1+ which will get you 16 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 27. on the screen. The little black box delimited by blue editing lines that you see is called a placeholder . Continue typing. Type 6 in the placeholder and press the equals key (=) to see the result. 1 6 + 7 = The Arithmetic Palette can be seen by clicking on the Math Palette. This is shown below Math Palette button Operation Keystroke Button Addition + Subtraction - Multiplication * Division / Powers ^ Entering Text A text region can be created by clicking in a blank space to see the red crosshair cursor. Then choose Text Region from the Insert menu or type the double quote (") . The crosshair transforms to an insertion point with a black text box around it. 1.15 MATHCAD WORKSHEETS, TEMPLATES AND STYLES Creating and Using Templates Mathcad styles and templates are similar to those of any word-processing software. When you create a new worksheet in Mathcad, you can start with Mathcad's default choices, or you Chapter 1: Basics of Mathcad 17
  • 28. can use a template containing customized formats. Several predefined templates are available each with a variety of styles, and if necessary, new templates can also be created. Any Mathcad worksheet can be saved as a new template. To create a new worksheet based on a template, choose File/New , and then select a template from the list, or browse to your own template directory. In the placeholders, substitute your own text or bitmaps in any of the placeholders, or use the built-in styles. You can also revise them if needed. When you create a worksheet based on a template, all of the formatting information, and any math, text and image regions are copied into the new worksheet. By creating a new template or revising another template , a customized format can be generated. Text styles and number formats can be created, number formats, fonts and sizes can be set, bitmaps can be added , and also, page numbers, filenames and dates can be inserted . Thus, by using templates, you maintain consistency across multiple worksheets through definition of math styles, text styles, printing margins, numerical result formats, units etc. To save a template, choose Save As from the File menu and use the file extension .mct. The settings, styles and bitmaps saved will be available for the next file you may want to create, leading to greater consistency in your files. Using Styles The use of Text Styles allows you to create a consistent appearance in your worksheets. Styles in each template are available by choosing Style from the Format menu. Any specific style with a defined font, size, etc. can be applied to a text region. To create or modify a style, again choose Style from the Format menu . To save your styles for use in new files, you must make a template file. Math Styles can be used to assign specific fonts, font sizes etc. to mathematical expressions. There are predefined ones but additional styles can be defined and applied. This can be accomplished by going to the Format menu and choosing Equation. 1.16 DEFINING VARIABLES There are times when the value of a number may need to be changed several times in a document . Such a number is termed a variable . Let Apples be, then, a variable . Type Apples:50 to see on the screen Apples 50 := By doing the above, we have given the value of 50 to the variable Apples . Similarly, another variable Unitprice can be defined 18 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 29. Unitprice 0.35 := A third variable can also be defined as Totprice Apples Unitprice ⋅ := Type Totprice= to see on the screen Totprice 17.5 = Now, if new values need to be given to Apples and to Unitprice, change the numbers above as necessary and the result which is Totprice will also change accordingly as shown below. Apples 75 := Unitprice 0.40 := Totprice Apples Unitprice ⋅ := Totprice 30 = 1.17 DEFINING FUNCTIONS IN MATHCAD The value of a function depends on the values assigned to its arguments. For example, to define a function f(x), type f(x):x^7 to see on the screen f x ( ) x 7 := Putting in a numerical value of 6 as the argument of f(x) will give Chapter 1: Basics of Mathcad 19
  • 30. f 6 ( ) 2.799 10 5 × = This can also be accomplished by doing x 6 := f x ( ) 2.799 10 5 × = If a range of values for the argument is given x 1 6 .. := f(x) will yield a table of numbers as shown below x 1 2 3 4 5 6 = f x ( ) 1 128 3 2.187·10 4 1.638·10 4 7.813·10 5 2.799·10 = In addition to defining a customized function, Mathcad's library of built-in functions can also be utilized. To do this, select Function from the Insert menu, or click on the function button on the toolbar The Insert Function dialog box, shown below, will allow insertion of a function name directly into the placeholder Built-in functions can also be inserted directly from the keyboard. Some examples are given below. Trigonometry and Logarithms ln 56 ( ) 4.025 = cos 50 deg ⋅ ( ) 0.455 2 ⋅ = asinh 0.95 ( ) 0.846 = 20 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 31. Matrix Functions identity 6 ( ) 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ = cols identity 6 ( ) ( ) 6 = 1.18 BUILDING AND EDITING MATHEMATICAL EXPRESSIONS Building Mathematical Expressions In Mathcad, various parts of an expression are assembled by observing the rules of precedence and some additional procedures that enable entering denominators, exponents and expressions inside of radicals. The following examples will illustrate the process. Example 1 To create Chapter 1: Basics of Mathcad 21
  • 32. f x ( ) x 6 + ( ) x 3 5 − ( ) ⋅ := Type f(x):x+6[Spacebar]*(x^3[Spacebar]-5) Example 2 To create f x ( ) x 765 x 6 4 − ( ) ⋅ + := Type f(x):x+765*(x^6-4) The exponent operator is called a sticky operator because unless you get out by pressing [Spacebar] , your keystrokes will "stick" to the exponent . This stickiness applies to exponents, square roots, subscripts, and division. Example 3 To create the expression x 7 675 + 780 Type x^7[Spacebar] <-- Puts x 7 in blue editing lines +675[Spacebar] <-- Puts the whole equation in the editing lines /780[Enter] <-- Expression is complete Example 4 To create 22 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 33. x 7 675 780 + do the same as above but without pressing the spacebar after +675 Example 5 To create x 17 t 7 450 type x^17/t^7[Spacebar][Spacebar][Spacebar]/450 Editing Expressions The equation editor functions very much like a text editor and goes from left to right. Most problems dealing with editing equations stem from working with operators. Although Mathcad automatically inserts parentheses wherever necessary, the Mathcad user must put in parentheses himself in accordance with his own judgement to give clarity to expressions . When expressions become complicated, it is definitely preferable to work with smaller and more manageable subexpressions within them. The reader is referred to Chapter 4 of the Mathcad 14 User's Guide for a detailed discussion on Editing Expressions. This can be accessed by choosing Tutorials from the Help menu. 1.19 DEFINING RANGE VARIABLES To assign a range of values to a variable x going from 0 to 30, say, with an increment of 3, type x:0,3;30 The result on the screen will be x 0 3 , 30 .. := To evaluate a function f(x) for x= 0 to 7 with an increment of 1, type x:0;7 f(x):x^5[Spacebar]-6*x^3[Spacebar]+9 Chapter 1: Basics of Mathcad 23
  • 34. to see on the screen x 0 7 .. := f x ( ) x 5 6 x 3 ⋅ − 9 + := Now, typing x= and f(x)= will give the following output table on the screen x 0 1 2 3 4 5 6 7 = f x ( ) 9 4 -7 90 649 3 2.384·10 3 6.489·10 4 1.476·10 = If the range is to have increments other than 1, which is the default value, the next value in the range must be entered. The following will provide a range of x values going from 2 to 4 with increments of 0.5 and the corresponding f(x) values. x 2 2.5 , 4 .. := x 2 2.5 3 3.5 4 = f x ( ) -7 12.906 90 276.969 649 = 1.20 DEFINING VECTORS AND MATRICES To create a vector or a matrix in Mathcad, the dimensions of the array must be chosen and the placeholders must be filled in. 24 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 35. Figure 1.6 Inserting matrices in Mathcad Chapter 1: Basics of Mathcad 25
  • 36. To create a vector V , click in a blank space, Choose Matrix from the Insert menu (See Figure 1.6 ) or click on the button inside the Vector and Matrix Palette . Then, fill in the appropriate number of rows and columns, click on Insert and finally fill in the placeholders with given values. To move from placeholder to placeholder inside the vector, use [Tab] or click on the appropriate placeholder to select it V 7 8 9 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ := To access a particular element of a vector, use the subscript operator , which can be created by typing a left square bracket ( [ ), or by using the Xn button in the Matrix Palette . In Mathcad , by default the first element has the index 0. Type V[0= to see on the screen V0 7 = The next two elements will have indices 1 and 2 Thus typing V[1= and V[2= will produce on the screen V1 8 = V2 9 = In order to obtain all the elements of the vector at the same time, the index can be defined as a range variable as shown below:: i 0 2 .. := giving Vi 7 8 9 = <--- Type V[i= The elements of a vector can also be used as the arguments of a function as shown below. Define a function f(x) as. f x ( ) sin 2 x ⋅ ( ) cos 3 x ⋅ ( ) + := Let a vector V be a three-element vector as given below 26 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 37. v 1.3 2.6 − 7.9 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ := Then, typing i:0;2 and then f(v[i)= will show the following on the screen i 0 2 .. := f vi ( ) -0.21 0.937 0.046 = The Vector and Matrix Palette contains most of the common matrix and vector operators. These are listed below. Operation Keystroke Palette Button Display Dot product [Shift]8 v w ⋅ Displays like scalar multiplication. Cross product [Ctrl]8 v w × Determinant | M Column [Ctrl]6 M 2 〈 âŒȘ Returns the 2nd column of M. There is also a wide range of built-in functions in Mathcad that return information about the size of an array and its elements. For a given matrix [M], various pieces of information can be generated as shown below. M 9 4 12 10 5 13 11 7 14 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ := Chapter 1: Basics of Mathcad 27
  • 38. Number of columns: cols M ( ) 3 = Number of rows: rows M ( ) 3 = Largest value in matrix: max M ( ) 14 = Determinant of matrix: M 3 = Eigenvalues of a matrix: eigenvals M ( ) 28.768 0.176 − 0.592 − ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ = 1.21 CREATING GRAPHS To create an x-y plot, choose Graph/ X-Y Plot from the Insert Menu as shown in Figure 1.7. Press [Enter] and fill in the placeholders on the x and y axes. Alternatively, type an expression depending on one variable such as: sin(x) + cos (3x) and click on the X-Y Plot button on the Graph toolbar . The resulting plot will be x 10 − 9.9 − , 10 .. := 10 − 5 − 0 5 10 2 − 1 − 1 2 sin x ( ) cos 3 x ⋅ ( ) + x 28 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 39. Figure 1.7 Creating graphs in Mathcad X-Y Plot Button Chapter 1: Basics of Mathcad 29
  • 40. Using Range Variables to Plot a Function The range of values being plotted on the x-axis must, in general, be specified. If this range is not prescibed by you, Mathcad will choose a default range for the dependent variable. For example, let us plot f x ( ) x 3 8 x 2 ⋅ + 9 x ⋅ + 14 + := The graph of this function over the range x= 0 to x= 6 can be accomplished as follows. x 0 1 , 6 .. := f x ( ) x 3 8 x 2 ⋅ + 9 x ⋅ + 14 + := Now create the plot by clicking in the worksheet window. Type @ to create the x-y plot, type x in the middle placeholder on the horizontal axis and type f(x) in the middle placeholder on the vertical axis. Press [Enter] . The following graph should then appear on the screen. 0 2 4 6 0 200 400 600 f x ( ) x The plot generated above does not seem to be very smooth. In order to obtain a smoother trace, change the definition of x to x 0 0.1 , 6 .. := . The smaller step enables Mathcad to calculate more points. This will make the plot a lot smoother (see graph below ) because now there are more points or dots being connected together. Formatting of an x-y plot can be accomplished as follows. Double-click on it or choose Graph from the Format menu to open up a dialog box. This dialog box will allow several options in terms of grid lines, legends, trace types, markers, colors, axis limits etc. 30 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 41. x 0 0.1 , 6 .. := 0 2 4 6 200 400 600 f x ( ) x Plotting a Vector of Data Points Let us say that we need to plot a vector of data points called Temp , which is the rising outside temperature on different days of a week in a summer month. This vector which will have 7 rows and 1 column can be created using the Matrix command on the Insert menu. Temp 78 82 84 86 88 90 92 ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ := This data can be graphed by making the horizontal axis an index variable or a vector with the same number of elements as the vector Temp . Define the index i as: i 0 6 .. := Create your plot by typing [@] and typing in Temp[i Chapter 1: Basics of Mathcad 31
  • 42. In the placeholder on the y axis, and i in the placeholder on the x axis. The resulting plot should be 0 2 4 6 75 80 85 90 95 Tempi i Notice here that box symbols have been used on a dashed line. Alternatively, two vectors of equal size can be plotted against each other. Thus, the second vector which will be called day is defined as day 1 2 3 4 5 6 7 ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ := Temp 78 82 84 86 88 90 92 ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ = Now create the plot by typing @ , as was done previously, and type day in the placeholder on the x-axis and Temp in the placeholder on the y-axis The resulting plot should look like this 32 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 43. 0 5 10 70 85 100 Note that the symbol type used here is O's , and the grid lines have been turned off on both axes. Plotting a Function of Vector Elements Sometimes, a function may need to be plotted over points that are not evenly spaced . As an example, let us define a function f x ( ) 3 x 3 ⋅ 5 x 2 ⋅ + 9 x ⋅ + 12 + := to be plotted over the range x as shown: -2.0, 0,3.50,10, 15. In order to do this, x has to be defined as a vector of the given numbers in the prescribed range. This can be done using the Matrices dialog box with the placeholders properly filled in as shown. x 2.0 − 0 3.5 10 15 ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠ := The index variable must be defined as i 0 4 .. := Now, type @ and fill in the middle placeholders on the x and y axes with xi and f xi ( ). The resulting graph should be Chapter 1: Basics of Mathcad 33
  • 44. 5 − 0 5 10 15 5 − 10 3 × 5 10 3 × 1 10 4 × 1.5 10 4 × f xi ( ) xi When plotting a function of a range variable , notice that the horizontal axis can be any set of prescribed numbers and does not have to be in even increments Plotting Several Functions on One Graph Plotting multiple functions over a single domain on a single graph can be done by typing these functions on the y- axis one after the other but separated by commas. For example, the following should illustrate how the two functions sin(x) and cos(2x) can be plotted on the same graph. x 0 0.1 , 6 .. := 0 2 4 6 1 − 0.5 − 0.5 1 sin x ( ) cos 2x ( ) x 34 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 45. 1.22 FORMATTING MATH, TEXT AND RESULTS Using the Format Bar in the Mathcad window, the appearance of the text as well as the math can be altered quite easily, and different fonts, sizes and styles can be readily selected. If the Format Bar is hidden, ensure that the Formatting bar on the View/Toolbars menu is checked. Formatting Text Using the drop-down lists in the Format Bar, different fonts as well as point sizes can be selected . Appropriate buttons must be clicked to generate special effects like boldface, italics, etc. Several options become available upon choosing Text from the Format menu . (See Figure 1.8). Text Styles and Templates Text styles provide consistency in the appearance of worksheets and enable the application of text formatting to the text regions. Available text styles depend on the template used to create a worksheet. To examine the different templates and text styles provided in Mathcad, choose New from the File menu and modify them or create new ones. Formatting Math In Mathcad different font tags can be applied to variables and to constants. To make changes in the font, click on a variable or constant in a math region and use the Format Bar. Alternatively, you can choose Equation from the Format menu. Highlighting of equations can also be done in Mathcad. To do this, click on an equation and choose Properties/Highlight Region from the Format menu in the main worksheet window. Below is shown an example of a highlighted equation. S 1 n i ai xi ⋅ ( ) ∑ = = In Mathcad, you can specify how answers can be displayed in terms of the desired decimal places, precision etc. Also, fonts and their sizes can be controlled and highlighting of equations can be done as desired. Chapter 1: Basics of Mathcad 35
  • 46. Figure 1.8 Formatting text in Mathcad Formatting Results and Graphs To control the format of a result, double-click on the result , or click on the result and choose Result from the Format menu . In the Number Format dialog box that shows up, change the Exponential Threshold , and Number of decimal places as necessary and click on OK . This will set the format only for this particular result. (See Figure 1.9 ). However, if this needs to be done for the entire worksheet, click on a blank part of the worksheet, and do the above . 36 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 47. Figure 1.9 Formatting results in Mathcad Chapter 1: Basics of Mathcad 37
  • 48. The reformatting of graphs can be easily done using a dialog box generated by double- clicking on the plot, or by going to Insert/Graph/X-Y Plot and clicking on the Traces tab shown in Figure 1.10. Under the " Legend label " column, type the desired name of the trace . Symbols, line types, colors, trace types, etc. can all be controlled by clicking on the appropriate options. Finally, preview the changes and click OK to finalize them . An example is shown at the end of this section. Figure 1.10 Formatting graphs in Mathcad 38 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 49. f x ( ) sin x ( ) := g x ( ) cos 3 x ⋅ ( ) := h x ( ) f x ( ) g x ( ) + := x 10 − 9.9 − , 10 .. := 10 − 5 − 0 5 10 2 − 1 − 0 1 2 sin(x) cos(3x) sin(x)+cos(3x) Graphing Functions and labelling Plots x- values y-values f x ( ) g x ( ) h x ( ) x 1.23 USING UNITS Although units are not required to be put into Mathcad equations, a great feature within Mathcad is its ability to track standard units during calculations and to automatically perform conversions. The program will also flag incorrect and inconsistent dimensional calculations, and mixing and matching of units can be done as desired.The default system in Mathcad is the SI unit system To define a variable in terms of the built-in unit kilometers , for example, just multiply the given number by km. Type R:4*km to see on the screen R 4 km ⋅ := Chapter 1: Basics of Mathcad 39
  • 50. Figure 1.11 Inserting units in Mathcad 40 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 51. The equation for a circular area of radius R now will automatically generate the result in terms of the appropriate units A π R 2 ⋅ := A 5.027 10 7 × m 2 = Note that the above result is automatically shown in terms of the base units of the default unit system, which, in this case, is SI. To change this result to feet , for example, click in the name of the unit that you want to replace, then drag-select it and type in the new desired unit in its place. Finally click outside the equation to see the new result. Alternatively, click in the placeholder next to the unit name , go to Insert/Unit (See Figure 1.11) , click on the appropriate Dimension name, then double-click on the unit name desired , and finally click outside the equation to see the desired result. R 1.312 10 4 × ft ⋅ = To see a list of buit-in units in Mathcad, go to the Insert menu . The following equivalents can be easily generated using the procedures described above. Work 14000. J ⋅ := Work 1.4 10 4 × m 2 kg s 2 − ⋅ ⋅ = Work 13.269 BTU ⋅ = Power 2000 kW ⋅ := Power 2.682 10 3 × hp ⋅ = Force 1500lbf := Force 6.672 10 3 × N ⋅ = A calculation involving mixing of units is shown below. Although each term in the calculation is expressed in a different unit of length, the result is calculated in the base SI unit for length, namely, meters 6 ft ⋅ 30 in ⋅ + 1.4 m ⋅ + 0.8 yd ⋅ + 4.722 m = The following calculation, obviously, cannot be completed and Mathcad indicates the same. 7 ft ⋅ 6 sec ⋅ + = 6 sec ⋅ Click on the expression to see the error message,which is: This value has units: Time, but must have units: Length Chapter 1: Basics of Mathcad 41
  • 52. To change the unit system of the worksheet from SI to U.S. units, select Worksheet Options from the Tools menu. Then, click the Unit System tab, and select U.S. This option gives you results in "English System" measures. In the following calculation, a mass is multiplied by an acceleration to give force in proper units. The result should be in Newtons or an equivalent force unit. mass 5 kg ⋅ := acc 20 m sec 2 ⋅ := Force mass acc ⋅ := Force 100 m kg s 2 − ⋅ ⋅ = To display units, choose Result from the Format menu. Then, go to Unit Display and check Format Units and Simplify units when possible, and results will display as shown below. g 9.807 s 2 − ⋅ m ⋅ := 60 N ⋅ 20 ⋅ m ⋅ 1.2 10 3 × J = 8 kg ⋅ 6 ⋅ m sec 2 ⋅ 48 N = 42 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 53. C H A P T E R 2 INTRODUCTION TO NUMERICAL METHODS 2.1 THE USE OF NUMERICAL METHODS IN SCIENCE AND ENGINEERING Analysis of problems in engineering and the physical sciences typically involves four steps as follows. (1) Development of a suitable mathematical model that realistically represents a given physical system. (2) Derivation of the system governing equations using physical laws such as Newton's laws of motion, conservation of energy, the laws governing electrical circuits etc. (3) Solution of the governing equations, and (4) Interpretation of the results. Because real world problems are generally quite complex with the generation of closed-form analytical solutions becoming impossible in many situations, there exists, most definitely, a need for the proper utilization of computer-based techniques in the solution of practical problems. The advancement of computer technology has made the effective use of numerical methods and computer-based techniques very feasible, and thus, solutions can now be obtained much faster than ever before and with much better than acceptable accuracy. However, there are advantages as well as disadvantages associated with any numerical procedure that is resorted to , and these must be kept in mind when using it. 2.2 COMPARISON OF NUMERICAL METHODS WITH ANALYTICAL METHODS While an analytical solution will be exact if it exists, a numerical method , on the other hand, will generally require iterations to generate a solution, which is only an approximation and which certainly cannot be considered exact by any means. A disadvantage associated with analytical solution techniques is that they are generally applicable only to very special cases of problems. Numerical solutions, on the contrary, will solve complex situations as well. While numerical techniques have several advantages including easy programming on a computer and the convenience with which they handle complex problems, the initial estimate of the solution along with the many number of iterations that are sometimes required to generate a solution can be looked upon as disadvantages. Chapter 2: Introduction to Numerical Methods 43
  • 54. 2.3 SOURCES OF NUMERICAL ERRORS AND THEIR COMPUTATION It is indeed possible for miscalculations to creep into a numerical solution because of various sources of error. These include inaccurate mathematical modeling, wrong programming, wrong input, rounding off of numbers and truncation of an infinite series. Round-off error is the general name given to inaccuracies that affect the calculation scene when a finite number of digits are assigned to represent an actual number. In a long sequence of calculations, this round-off error can accumulate, then propagate through the process of calculation and finally grow very rapidly to a significant number. A truncation error results when an infinite series is approximated by a finite number of terms, and, typically, upper bounds are placed on the size of this error. The true error is defined as the difference between the computed value and the true value of a number. ETrue XComp XTrue − = (2.1) while the relative true error is the error relative to the true value (2.2) er XComp XTrue − XTrue = Expressed as a percentage, the relative true error is written as er XComp XTrue − XTrue 100 ⋅ = (%) (2.3) 2.4 TAYLOR SERIES EXPANSION The Taylor series is considered as a basis of approximation in numerical analysis. If the value of a function of x is provided at " x 0", then the Taylor series provides a means of evaluating the function at " x 0 + h", where " x 0" is the starting value of the independent variable and " h " is the difference between the starting value and the new value at which the function is to be approximated f x0 h + ( ) f x0 ( ) h x f x0 ( ) ⎡ ⎣ ⎀ ⎊ d d ⎡ ⎱ ⎣ ⎀ ⎄ ⎊ ⋅ + h 2 2! 2 x f x0 ( ) d d 2 ⋅ + h 3 3! 3 x f x0 ( ) d d 3 ⋅ + ..................... + = (2.4) This equation can be used for generating various orders of approximations as shown below. The order of approximation is defined by the highest derivative included in the series. For example, If only terms up to the second derivative are retained in the series, the result is a second order approximation. 44 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 55. First order approximation: f x0 h + ( ) f x0 ( ) h x f x0 ( ) d d ⋅ + = (2.5) Second order approximation: f x0 h + ( ) f x0 ( ) h x f x0 ( ) d d ⋅ 2 x f x0 ( ) d d 2 ⋅ + = (2.6) Third order approximation: f x0 h + ( ) f x0 ( ) h x f x0 ( ) d d ⋅ + h 2 2! 2 x f x0 ( ) d d 2 ⋅ + h 3 3! 3 x f x0 ( ) d d 3 ⋅ + ........................... + = (2.7) It is to noted that the significance of the higher order terms in the Taylor series increases with the nonlinearity of the function involved as well as the difference between the " starting x" value and the "x" value at which the function is to be approximated. Thus , the fewer the terms that are included in the series, the larger will be the error associated with the computation of the function value. If the function is linear , however, only terms up to the first derivative term need to be included. Example 2.1 Using the Taylor series expansion for f(x) = - 0.15 x4 - 0.17 x 3 - 0.25 x 2 -0.25 x + 1.25 determine the zeroth, first, second, third, fourth and fifth order approximations of f(x0 + h ) where x0 = 0 and h = 1,2, 3, 4,5 and compare these with the exact solutions. h=1.0: Put in the function and generate its derivatives: f x ( ) 0.15 − x 4 ⋅ 0.17 x 3 ⋅ − 0.25 x 2 ⋅ − 0.25x − 1.25 + := x0 0 := h 1. := fprime x ( ) 0.60 − x 3 ⋅ 0.51 x 2 ⋅ − 0.50 x ⋅ − 0.25 − := <--Generate derivatives f2prime x ( ) 1.8 − x 2 ⋅ 1.02 x ⋅ − 0.50 − := f3prime x ( ) 3.6 − x ⋅ 1.02 − := f4prime x ( ) 3.6 − := f5prime x ( ) 0. := Chapter 2: Introduction to Numerical Methods 45
  • 56. term1 f x0 ( ) := term2 h fprime x0 ( ) ⋅ := term3 h 2 2 f2prime x0 ( ) ⋅ := term4 h 3 6 f3prime x0 ( ) ⋅ := term5 h 4 24 f4prime x0 ( ) ⋅ := term6 h 5 120 f5prime x0 ( ) ⋅ := ftaylor0 term1 := <---- one-term or zero-order approximation ftaylor1 term1 term2 + := <---- first order approximation with two terms ftaylor2 term1 term2 + term3 + := <---second order approximation with 3 terms ftaylor3 term1 term2 + term3 + term4 + := <---third order approximation with 4 terms ftaylor4 term1 term2 + term3 + term4 + term5 + := <---fourth order approximation with 5 terms fifth order approximation with 6 terms ftaylor5 term1 term2 + term3 + term4 + term5 + term6 + := <----- x x0 h + := x 1 = These are the zero- fifth order approximations of the given function f(x) using the Taylor series. ftaylor0 1.25 = ftaylor1 1 = ftaylor2 0.75 = <-- ftaylor3 0.58 = ftaylor4 0.43 = ftaylor5 0.43 = f 1 ( ) 0.43 = <---EXACT ANSWER USING FUNCTION GIVEN. err0 f x ( ) ftaylor0 − := err0 0.82 − = err1 f x ( ) ftaylor1 − := err1 0.57 − = err2 f x ( ) ftaylor2 − := err2 0.32 − = These are errors ( differences between exact values and approximations ) for the above zero - fifth order approximations. <-- err3 f x ( ) ftaylor3 − := err3 0.15 − = err4 f x ( ) ftaylor4 − := err4 0 = err5 f x ( ) ftaylor5 − := err5 0 = Similarly, by using h= 2, 3, 4, 5 , the zeroth- fifth order approximations for f(2), f(3), f(4), f(5) and the associated errors can be determined. These are given in Tables 2.1 and 2.2 Plots of the various Taylor series approximations of the given function and associated errors are generated below and are presented in Figs. 2.1 and 2.2 46 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 57. x0 0 := x 0 0.01 , 5 .. := ftaylor0 x ( ) f x0 ( ) := <-- zeroth-order approximation ftaylor1 x ( ) ftaylor0 x ( ) x x0 − ( ) fprime x0 ( ) ⋅ + := <---first-order approximation ftaylor2 x ( ) ftaylor1 x ( ) x x0 − ( ) 2 2 f2prime x0 ( ) ⋅ + := <--second-order approximation ftaylor3 x ( ) ftaylor2 x ( ) x x0 − ( ) 3 6 f3prime x0 ( ) ⋅ + := <---third-order approximation ftaylor4 x ( ) ftaylor3 x ( ) x x0 − ( ) 4 24 f4prime x0 ( ) ⋅ + := <---fourth-order approximation ftaylor5 x ( ) ftaylor4 x ( ) x x0 − ( ) 5 120 f5prime x0 ( ) ⋅ + := <---fifth- order approximation Errors generated with the various approximations are as follows Zero order approximation: err0 x ( ) f x ( ) ftaylor0 x ( ) − := First order approximation: err1 x ( ) f x ( ) ftaylor1 x ( ) − := Second order approximation: err2 x ( ) f x ( ) ftaylor2 x ( ) − := Third order approximation: err3 x ( ) f x ( ) ftaylor3 x ( ) − := Fourth order approximation: err4 x ( ) f x ( ) ftaylor4 x ( ) − := Fifth order approximation: err5 x ( ) f x ( ) ftaylor5 x ( ) − := The various approximations generated by the above calculations and the associated errors are compared in the Table 2.1. Chapter 2: Introduction to Numerical Methods 47
  • 58. 0 1 2 3 4 5 150 100 50 0 50 Zeroth order approx Third order approx Fifth order approx/ given function Zeroth order approx Third order approx Fifth order approx/ given function Taylor series approx of given function x- value Function approximated by Taylor series ftaylor0 x ( ) ftaylor3 x ( ) ftaylor5 x ( ) x Figure 2.1. Taylor series approximation of given function x 0 0.01 , 5 .. := 0 1 2 3 4 5 150 100 50 0 50 Zero order approx Third order approx Fifth order approx Zero order approx Third order approx Fifth order approx Errors gen due to Taylor-series approx x- value errors as function of x err0 x ( ) err3 x ( ) err5 x ( ) x Figure 2.2. Errors associated with the various Taylor series approximations 48 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 59. The various approximations generated by the above calculations and the associated errors are compared in the following tables. Table 2.1 h 1 5 .. := Various orders of approximation generated by Taylor series approach versus true values of given function x 0 1 , 5 .. := zeroth order first order second order third order fourth order fifth order True Value x 0 1 2 3 4 5 = ftaylor0 x ( ) 1.25 1.25 1.25 1.25 1.25 1.25 = ftaylor1 x ( ) 1.25 1 0.75 0.5 0.25 0 =ftaylor2 x ( ) 1.25 0.75 -0.25 -1.75 -3.75 -6.25 = ftaylor3 x ( ) 1.25 0.58 -1.61 -6.34 -14.63 -27.5 =ftaylor4 x ( ) 1.25 0.43 -4.01 -18.49 -53.03 -121.25 =ftaylor5 x ( ) 1.25 0.43 -4.01 -18.49 -53.03 -121.25 =f x ( ) 1.25 0.43 -4.01 -18.49 -53.03 -121.25 = h 1 2 3 4 5 = Table 2.2 Errors associated with the different orders of approximation zeroth order first order second order third order fourth order fifth order x 0 1 2 3 4 5 = err0 x ( ) 0 -0.82 -5.26 -19.74 -54.28 -122.5 = err1 x ( ) 0 -0.57 -4.76 -18.99 -53.28 -121.25 = err2 x ( ) 0 -0.32 -3.76 -16.74 -49.28 -115 = err3 x ( ) 0 -0.15 -2.4 -12.15 -38.4 -93.75 = err4 x ( ) 0 0 0 0 0 0 = err5 x ( ) 0 0 0 0 0 0 = h 1 2 3 4 5 = PROBLEMS 2.1. Using the Taylor series expansion for cos x, which is given as f(x) = cos x = 1- x 2 / 2 + x 4 / 24 , determine the one-term, two-term and three-term approximations of f(x0 + h ) , where x0 = 0 Chapter 2: Introduction to Numerical Methods 49
  • 60. rad and h = 0. 1, 0.2 ....1.0 rad , and compare these with the exact solution. Using Mathcad, generate plots of the various Taylor series approximations and associated errors as functions of the independent variable x. 2.2 Develop a Taylor series expansion of the following function: f(x) = x 5 - 6 x 4 + 3x 2 + 9 . Use x =3 as the base and h as the increment. Using Mathcad, evaluate the series for h= 0.1, 0.2....1.0, adding terms incrementally as in Problem 2.1. Compare the various Taylor series approximations obtained with true values in a table. Generate plots of the approximations and associated errors as functions of x . 2.3 Given the following function: f(x) = x 3 - 3 x 2 + 5 x + 10 , determine f ( x0 + h ) with the help of a Taylor series expansion, where x 0 = 2 and h = 0.4. Compare the true value of f ( 2.4 ) with estimates obtained by resorting to (a) one term only (b) two terms (c) three terms and (d) four terms of the series. 2.4 Given the following function f x ( ) 3 x 3 ⋅ 6 x 2 ⋅ − 15 x ⋅ + 25 + = use a Taylor series expansion to determine the zeroth, first, second and third order approximations of f(x0+h) where x 0 = 2 and h = 0.5. Compare these with the exact solution. 2.5 By developing a Taylor series expansion for f(x) = e x about x = 0 , determine the fourth-order approximation of e 2.5 and compare it with the exact solution. 2.6. By developing a Taylor series expansion for f(x) = ln(2-x) about x = 0, determine the fourth-order approximation of ln (0.5) and compare it with the exact solution 50 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 61. 2.7. By developing a Taylor series expansion for f(x) = x3 e - 5x about x = 1, determine the third-order approximation of f(1.2) and compare it with the exact solution. 2.8. By developing a Taylor series expansion for f(x) = e cos x about x =0 , determine the fourth- order approximation of f (2π) and compare it with the exact solution. . 2.9. By developing a Taylor series expansion for f(x) = (x - 2) 1/2 about x = 2, determine the third-order approximation of f (2.2), that is, (0.2) 1/2 , and compare it with the exact solution. 2.10. Given the function f(x) = x2 - 5 x 0.5 + 6 , use a Taylor series expansion to determine the first, second , third and fourth order approximations of f (2.5 ) by resorting to x 0 = 2 and h = 0.5 . Compare these with the exact solution. 2.11. Given the function f(x) = 6 x3 - 9 x2 +25 x + 40 , use a Taylor series expansion to determine the zeroth, first, second and third order approximations of f (x0 + h ) where x 0 = 3 and h = 1 . Compare these with the exact solution. 2.12. Given the function f(x) = 4 x4 - 7 x3 + 5 x2 - 6 x + 90 use a Taylor series expansion to determine the zeroth, first, second , third and fourth order Chapter 2: Introduction to Numerical Methods 51
  • 62. approximations of f (x0 + h ) ) where x 0 = 3 and h = 0.5 . Compare these with the exact solution. Calculate errors abnd generate calculations to three decimal places. 2.13. Given the function f(x) = 8 x3 - 10 x2 + 25 x + 45 , use a Taylor series expansion to determine the zeroth, first, second and third order approximations of f (x0 + h ) where x 0 = 2 and h = 1 . Compare these with the exact solution. 2.14. Given the function f(x) = 1 + x + x2 / 2! + x3 / 3! +x4 / 4! use a Taylor series expansion to determine the zeroth, first, second , third and fourth order approximations of f (x0 + h ) where x 0 = 0 and h = 0.5 . Compare these with the exact solution. Generate answers correct to four decimal places. 2.15. Given the function f(x) = x + x3 / 3 + 2 x5 / 15 use a Taylor series expansion to determine the zeroth, first, second , third and fourth order approximations of f (x0 + h ) where x 0 = 0 and h = 0.8 . Compare these with the exact solution by computing percentage errors. Generate answers correct to four decimal places. 2.16. Given the function f(x) = sin (x) use a Taylor series expansion to determine the fifth order approximation of f (x0 + h ) where x 0 = 0 and h = 0.2 radians . Compare your answer with the true value. Generate answers correct to four decimal places. 2.17. Given the function f(x) = 3 x2 - 6 x 0.5 + 9 , use a Taylor series expansion to determine the zeroth, first, second , third and fourth order approximations of f (x0 + h ) whereo x 0 = 3 and h = 1 . Compare these with the exact solution by computing percentage errors. Generate answers correct to four decimal places. 52 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 63. C H A P T E R 3 ROOTS OF EQUATIONS 3.1 INTRODUCTION In many problems occurring in science and engineering, it is often necessary to find roots or zeros of equations that are nonlinear. Nonlinear equations have no closed-form solutions except in some very special cases, and thus, computer methods are indispensable in their solution. Some examples of equations whose roots may need to be found are: 1 4 x ⋅ + 16 x 2 ⋅ − 3 x 3 ⋅ + 3 x 4 ⋅ + 0 = <-- a polynomial, a characteristic equation, for instance f x ( ) α − 0 = <-- α is a number and f(x) is a function of x tan α ( ) tanh 2 x ⋅ ( ) = <-- a transcendental equation 3.2 METHODS AVAILABLE There are several methods available for finding roots of equations. Some of these are: (1) Direct Search, which is not a very efficient technique, (2) Bisection (3) False Position (4) Newton-Raphson (5) Secant Method (6) Bairstow's Method, which is applicable only to polynomials and (6) Successive Iteration or Fixed Point Iteration method . In this chapter, however, only the Bisection, False Position, Newton-Raphson, Secant and Successive Iteration methods will be addressed along with the functions used in Mathcad to find roots. 3.3 BISECTION METHOD This method can be resorted to when there is only one root occurring in a given range of x. The method involves investigating a given range to seek a root and then bisecting the region successively until a root is found. Other names for this technique are Interval halving, Binary Chopping and Bolzano's Method. Procedure for Finding Roots 1. Choose starting and end points xstart and xend 2. Compute: f(xstart) and f(xend) 3. Compute: f(xstart) times f(xend) Chapter 3: Roots of Equations 53
  • 64. 4. If the above product is negative, then the root lies between xstart and xend. If this product is positive, reselect xstart and xend. 5. If f(xtart)* f(xend) < 0, compute the mid-point of the xstart-xend range. Call it "xmid1" and repeat above steps, i.e., compute f xstart ( ) f xmid1 ( ) ⋅ and f xmid1 ( ) f xend ( ) ⋅ 6. If f(xstart)*f(xmid1) < 0, the root lies between xstart and xmid1. If (xmid1)*f(xend) < 0, then the root lies between xmid1 and xend. 7. Repeat the above procedure until convergence at a root value occurs. Figure 3.1. Bisection Method Computation of Error and Convergence Criterion A convergence criterion has to be followed in order to determine if a root has indeed been found. This is expressed in terms of the error Δ or the percentage relative error Δ rel which are defined as 54 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 65. Δ xmidi 1 + xmidi − = (3.1) (3.2) Δrel xmidi 1 + xmidi − xmidi 1 + 100 ⋅ = percent where xmid i+1 and xmid i are the midpoints in the current and previous iterations. While, in general, the relative error should not be greater than 5 %, an error of 0.01 % is the largest that is tolerable for some classes of problems, that require immense precision. The true error , Δ True , is an indicator of the real accuracy of a solution and can be evaluated only if the true solution, x True , is known. It is defined as ΔTrue xTrue xmidi − xTrue 100 ⋅ = (3.3) Calculation of the true error clearly requires knowledge of the true solution, which, in general, will not be known to us. Therefore, the quantity Δ rel may have to be mostly used to determine the error associated with a solution process. Advantages and Disadvantages of Bisection While Bisection is a simple, robust technique for finding one root in a given interval, when the root is known to exist and it works even for non-analytic functions, its convergence process is generally slow, making it a somewhat inefficient procedure. Sometimes, a singularity may be identified as if it were a root, since the method does not distinguish between roots and singularities, at which the function would go to infinity. Therefore, as the method proceeds, a check must be made to see if the absolute value of [f(xend)-f(xstart)], in fact, converges to zero. If this quantity diverges, the method is chasing a singularity rather than a root . When there are multiple roots, Bisection is not a desirable technique to use, since the function may not change signs at points on either side of the roots. Therefore, a graph of the function must first be drawn before proceeding to do the calculations. Example 3.1 Obtain a root of f(x) in the range of 4 < x < 20 f(x)= ( 750.5 / x ) [ 1 - exp( -0.15245x) ] - 40 Chapter 3: Roots of Equations 55
  • 66. Let us generate a table for x between 4 and 20 and draw a graph using Mathcad to explore where the root may lie. f x ( ) 750.5 x 1 e 0.15245 − x ⋅ − ( ) ⋅ 40 − := x 4 8 , 20 .. := 5 10 15 20 10 − 0 10 20 30 40 50 Graph of f(x) versus x f x ( ) x x 0 0 1 2 3 4 4 8 12 16 20 = f x ( ) 0 0 1 2 3 4 45.6584 26.1051 12.5031 2.8146 -4.2539 = The above table and graph suggest that the root lies between xstart=16 and xend= 20. In an attempt to minimize the number of iterations needed, we will obtain a root value that is correct only to two decimal places, in this case. Iteration # 1: xstart 16 := xend 20 := xmid xstart xend + 2 := xmid 18 = f xstart ( ) f xmid ( ) ⋅ 2.7773 − = f xmid ( ) f xend ( ) ⋅ 4.1976 = The root must lie beteen above xstart and xmid. Thus the new xstart is 16 and the new xend is 18 Iteration # 2: xstart 16 := xend 18 := xmid xstart xend + 2 := xmid 17 = f xstart ( ) f xmid ( ) ⋅ 2.366 = f xmid ( ) f xend ( ) ⋅ 0.8295 − = The root must lie beteen above xmid and xend. Thus the new xstart is 17 and the new xend is 18 Iteration # 3: xstart 17 := xend 18 := xmid xstart xend + 2 := xmid 17.5 = f xstart ( ) f xmid ( ) ⋅ 0.0761 − = f xmid ( ) f xend ( ) ⋅ 0.0893 = 56 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 67. The root must lie beteen above xstart and xmid. Thus the new xstart is 17 and the new xend is 17.5 Iteration # 4: xstart 17. := xend 17.5 := xmid xstart xend + 2 := xmid 17.25 = f xstart ( ) f xmid ( ) ⋅ 0.3115 = f xmid ( ) f xend ( ) ⋅ 0.0335 − = The root must lie beteen above xmid and xend. Thus the new xstart is 17.25 and the new xend is 17.5 Iteration # 5: xstart 17.25 := xend 17.5 := xmid xstart xend + 2 := xmid 17.375 = f xstart ( ) f xmid ( ) ⋅ 0.0515 = f xmid ( ) f xend ( ) ⋅ 0.0126 − = The root must lie beteen above xmid and xend. Thus the new xstart is 17.38 and the new xend is 17.5 Iteration # 6: xstart 17.38 := xend 17.5 := xmid xstart xend + 2 := xmid 17.44 = f xstart ( ) f xmid ( ) ⋅ 2.5064 10 3 − × = f xmid ( ) f xend ( ) ⋅ 1.7497 − 10 3 − × = The root must lie beteen above xmid and xend. Thus the new xstart is 17.44 and the new xend is 17.5 Iteration # 7: xstart 17.44 := xend 17.5 := xmid xstart xend + 2 := xmid 17.47 = f xstart ( ) f xmid ( ) ⋅ 6.893 − 10 4 − × = f xmid ( ) f xend ( ) ⋅ 3.2291 10 3 − × = The root must lie beteen above xstart and xmid. Thus the new xstart is 17.44 and the new xend is 17.47 Iteration # 8: xstart 17.44 := xend 17.47 := xmid xstart xend + 2 := xmid 17.455 = f xstart ( ) f xmid ( ) ⋅ 1.5821 − 10 4 − × = f xmid ( ) f xend ( ) ⋅ 2.9199 10 4 − × = Chapter 3: Roots of Equations 57
  • 68. The root must lie beteen above xstart and xmid. Thus the new xstart is 17.44 and the new xend is 17.455 Iteration # 9: xstart 17.44 := xend 17.455 := xmid xstart xend + 2 := xmid 17.447 = f xstart ( ) f xmid ( ) ⋅ 1.0756 10 4 − × = f xmid ( ) f xend ( ) ⋅ 4.5564 − 10 5 − × = a check to see if this is small f xstart ( ) 0.0193 = f xmid ( ) 5.5657 10 3 − × = <-- Since f(xmid) is a very small quantitity, it is reasonable to assume that the xmid obtained in iteration # 9 is, in fact, the required root. The % error in this case is, then error 17.447 17.455 − 17.447 100 ⋅ := error 0.0459 − = (percent) Thus, the solution which has been obtained after 9 iterations is : x = 17.447 3.4 THE REGULA FALSI OR THE FALSE POSITION METHOD The False Position method is similar to the Bisection method in that the size of the interval containing the root is reduced with every step of the iteration process until the root is found. The main difference is that while the interval size in the Bisection method is reduced by bisecting it in each step of the iteration , this reduction of interval size is achieved by a linear interpolation fitting the two end points. While the Bisection method is reliable, it is slower than the False Position method in achieving convergence. The equation of a straight line connecting two points (xstart,ystart) and (xend, yend) is y yend yend ystart − xend xstart − x xend − ( ) ⋅ + = (3.4) 58 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 69. f(xstart) f(xend) f(x) x xstart xnew Root xend (xstart, f(xstart)) (xend, f(xend)) Figure 3.2. Regula Falsi method The procedure for finding roots then is as follows. ( See Figure 3.2 ) 1. Choose the starting and ending points xstart and xend as in the Bisection method. 2. Compute f(xstart) and f(xend). Make sure that f(xstart) times f(xend) is still a negative product. If it is not, then there is no root between xstart and xend. 3. The new end point xnew is located by setting y = 0 in Equation 3.4 and solving for x. xnew xend xend xstart − yend ystart − yend ⋅ − = (3.5) 4. If f(xstart)*f(xnew) < 0, the root lies between xstart and xnew. However, if f(xnew)*f(xend) < 0, the root lies between xnew and xend. 5. Repeat the above procedure until convergence takes place. Chapter 3: Roots of Equations 59
  • 70. A disadvantage of this method is that sometimes a root is approached from only one side and, thus, one end of the interval does not change at all in successive iterations. This is called stagnation of an end point. This is not desirable since it slows down the convergence process especially when the initial interval is very large or when the function is highly nonlinear. Examples 3.2 and 3.3 show the occurrence of stagnation. Example 3.2 Obtain the required root for the function of Example 3.1 by the False Position method correct to four decimal places. The starting and ending points were 16 and 20 respectively. f x ( ) 750.5 x 1 e 0.15245 − x ⋅ − ( ) ⋅ 40 − := Iteration # 1: xstart 16 := xend 20 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.8146 = yend 4.2539 − = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 17.5927 = f xstart ( ) f xnew ( ) ⋅ 0.73 − = f xnew ( ) f xend ( ) ⋅ 1.1033 = The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend is 17.5927 Iteration # 2: xstart 16 := xend 17.5927 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.8146 = yend 0.2593 − = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 17.4584 = f xstart ( ) f xnew ( ) ⋅ 0.0404 − = f xnew ( ) f xend ( ) ⋅ 3.7171 10 3 − × = The root must lie between above xstart and xnew. Thus the new xstart is 16 and the new xend is 17.4584 Iteration # 3: xstart 16 := xend 17.4584 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.8146 = yend 0.0144 − = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 17.451 = f xstart ( ) f xnew ( ) ⋅ 2.2312 − 10 3 − × = f xnew ( ) f xend ( ) ⋅ 1.143 10 5 − × = The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend is 17.451 60 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 71. Iteration # 4: xstart 16 := xend 17.451 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.8146 = yend 8.5304 − 10 4 − × = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 17.4506 = f xstart ( ) f xnew ( ) ⋅ 1.3196 − 10 4 − × = f xnew ( ) f xend ( ) ⋅ 3.9995 10 8 − × = The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend is 17.4506 Iteration # 5: xstart 16 := xend 17.4506 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.8146 = yend 1.1956 − 10 4 − × = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 17.4505 = f xstart ( ) f xnew ( ) ⋅ 1.8496 − 10 5 − × = f xnew ( ) f xend ( ) ⋅ 7.8568 10 10 − × = The root must lie beteen above xstart and xnew. Thus the new xstart is 16 and the new xend is 17.4505 Iteration # 6: xstart 16 := xend 17.4505 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.8146 = yend 6.3811 10 5 − × = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 17.4505 = f xstart ( ) f xnew ( ) ⋅ 9.8712 10 6 − × = f xnew ( ) f xend ( ) ⋅ 2.238 10 10 − × = f xnew ( ) 3.5072 10 6 − × = The above process indicates that in this case, the root is being approached only from the side of the original starting point and therefore stagnation has occurred. Since the xnew computed in the sixth iteration is the same as the one in the fifth, and f(xnew) is a very small quantitity, it is reasonable to say that the xnew (=17.4505) computed above is, in fact, the required root. Example 3.3 Obtain a root of f(x) by the False Position method in the range of 0 < x < 10 correct to three decimal places. f x ( ) x 3 9 x ⋅ + 200 − := Iteration # 1: xstart 0 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := Chapter 3: Roots of Equations 61
  • 72. ystart 200 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 1.8349 = f xstart ( ) f xnew ( ) ⋅ 3.5462 10 4 × = f xnew ( ) f xend ( ) ⋅ 1.578 − 10 5 × = The root must lie beteen above xnew and xend. Thus the new xstart is 1.835 and the new xend is 10 Iteration # 2: xstart 1.835 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 177.3061 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 3.1914 = f xstart ( ) f xnew ( ) ⋅ 2.4605 10 4 × = f xnew ( ) f xend ( ) ⋅ 1.2351 − 10 5 × = The root must lie between above xnew and xend. Thus the new xstart is 3.191 and the new xend is 10 Iteration # 3: xstart 3.191 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 138.7887 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 4.1096 = f xstart ( ) f xnew ( ) ⋅ 1.2992 10 4 × = f xnew ( ) f xend ( ) ⋅ 8.3312 − 10 4 × = The root must lie beteen above xnew and xend. Thus the new xstart is 4.11 and the new xend is 10 Iteration # 4: xstart 4.11 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 93.5835 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 4.6704 = f xstart ( ) f xnew ( ) ⋅ 5.2493 10 3 × = f xnew ( ) f xend ( ) ⋅ 4.9922 − 10 4 × = The root must lie beteen above xnew and xstart. Thus the new xstart is 4.67 and the new xend is 10 Iteration # 5: xstart 4.67 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := 62 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 73. ystart 56.1224 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 4.9862 = f xstart ( ) f xnew ( ) ⋅ 1.7487 10 3 × = f xnew ( ) f xend ( ) ⋅ 2.7732 − 10 4 × = The root must lie beteen above xnew and xend. Thus the new xstart is 4.986 and the new xend is 10 Iteration # 6: xstart 4.986 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 31.1731 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.1557 = f xstart ( ) f xnew ( ) ⋅ 516.0963 = f xnew ( ) f xend ( ) ⋅ 1.4735 − 10 4 × = The root must lie beteen above xnew and xend. Thus the new xstart is 5.156 and the new xend is 10 Iteration # 7: xstart 5.156 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 16.5272 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.2443 = f xstart ( ) f xnew ( ) ⋅ 141.6022 = f xnew ( ) f xend ( ) ⋅ 7.6254 − 10 3 × = The root must lie beteen above xnew and xend. Thus the new xstart is 5.244 and the new xend is 10 Iteration # 8: xstart 5.244 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 8.5964 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.2895 = f xstart ( ) f xnew ( ) ⋅ 37.8307 = f xnew ( ) f xend ( ) ⋅ 3.9167 − 10 3 × = The root must lie beteen above xnew and xend. Thus the new xstart is 5.290 and the new xend is 10 Iteration # 9: xstart 5.290 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := Chapter 3: Roots of Equations 63
  • 74. ystart 4.3541 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3129 = f xstart ( ) f xnew ( ) ⋅ 9.6414 = f xnew ( ) f xend ( ) ⋅ 1.9707 − 10 3 × = The root must lie beteen above xnew and xend. Thus the new xstart is 5.313 and the new xend is 10 Iteration # 10: xstart 5.313 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 2.2078 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3246 = f xstart ( ) f xnew ( ) ⋅ 2.4707 = f xnew ( ) f xend ( ) ⋅ 995.9944 − = The root must lie beteen above xnew and xend. Thus the new xstart is 5.325 and the new xend is 10 Iteration # 11: xstart 5.325 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 1.0813 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3307 = f xstart ( ) f xnew ( ) ⋅ 0.5916 = f xnew ( ) f xend ( ) ⋅ 486.9595 − = The root must lie beteen above xnew and xend. Thus the new xstart is 5.331 and the new xend is 10 Iteration # 12: xstart 5.331 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 0.5163 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3337 = f xstart ( ) f xnew ( ) ⋅ 0.1348 = f xnew ( ) f xend ( ) ⋅ 232.3231 − = The root must lie beteen above xnew and xend. Thus the new xstart is 5.334 and the new xend is 10 Iteration # 13: xstart 5.334 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := 64 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 75. ystart 0.2334 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3352 = f xstart ( ) f xnew ( ) ⋅ 0.0275 = f xnew ( ) f xend ( ) ⋅ 104.9753 − = The root must lie beteen above xnew and xend. Thus the new xstart is 5.335 and the new xend is 10 Iteration # 14: xstart 5.335 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 0.139 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3357 = f xstart ( ) f xnew ( ) ⋅ 9.7667 10 3 − × = f xnew ( ) f xend ( ) ⋅ 62.5217 − = The root must lie beteen above xnew and xend. Thus the new xstart is 5.336 and the new xend is 10 Iteration # 15: xstart 5.336 := xend 10 := ystart f xstart ( ) := yend f xend ( ) := ystart 0.0446 − = yend 890 = xnew xend xend xstart − yend ystart − yend ⋅ − := xnew 5.3362 = f xstart ( ) f xnew ( ) ⋅ 1.0062 10 3 − × = f xnew ( ) f xend ( ) ⋅ 20.0659 − = f xnew ( ) 0.0225 − = The above process indicates that in this case, stagnation occurs as well, but the root is being approached only from the side of the original ending point. Since the xnew computed in the fifteenth iteration is about the same as the one in the fourteenth, it is reasonable to say that the xnew ( = 5.336 ) computed above is, in fact, the required root. 3.5 NEWTON-RAPHSON METHOD This is the most widely used iterative method for locating roots. In this method, an initial approximation of the root must be assumed, and calculations are started with a "good initial guess" . If this initial guess is not a good one, then divergence may occur. By starting with an approximation of the root value , x i , and constructing a tangent to the function curve at x i , an improved guess x i+1 can be determined as shown in Figure 3.3. From Figure 3.3, the slope of the function f(x) at x i can be seen to be Chapter 3: Roots of Equations 65
  • 76. fprime xi ( ) f xi ( ) − xi 1 + xi − = (3.6) which gives the new improved value of the guess as xi 1 + xi f xi ( ) fprime xi ( ) − = g xi ( ) = (3.7) where fprime( x i ) is the slope of the function at x i Figure 3.3. Newton-Raphson method Procedure for Finding Roots 1. Make a good initial guess. Call it X Old. 2. Improve the guess using XNew XOld f XOld ( ) fprime XOld ( ) − = g XOld ( ) = (3.8) 66 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 77. 3. Keep improving the guess using Equation (3.8). 4. Solution is done when a new improved value X New is almost equal to the previous value X Old Advantages and Disadvantages of the Method While the Newton-Raphson method is faster than the Bisection method, is applicable to the complex domain as well and can be extended to simultaneous nonlinear equations, it may not converge in some situations. The solution may oscillate about a local maximum or minimum, and if an initial estimate is chosen such that the derivative becomes zero at some point in the iteration process, then a division by zero takes place and convergence will never occur. Although convergence will occur quite rapidly if the initial estimate is sufficiently close to the root, it is possible for it to be be slow when it is far from the root. Also, if the roots are complex, they will never be generated with real initial guesses. A worthwhile feature of the Newton-Raphson method is that the numerical process will correct itself automatically for minor errors. Thus, any errors that are made in computing the next guess will simply generate a different point for drawing the tangent line and will not have any effect on the final answer. Convergence Criterion for the Newton-Raphson Method It can be mathematically shown that in order for the Newton-Raphson method to converge to a real root, the absolute value of the derivative of the g(xi) of Equation (3.7) must always be less than 1 , that is, g xi ( ) 1 < This condition must be satisfied if convergence is to be attained. However, in some cases, it may not hold for the initial guess. Example 3.4 Using the Newton- Raphson method, solve : f(x)= x3 - 4.2 x -8.5 =0 for a real root between 2 and 3. Let us first draw a graph of the function in the given range f x ( ) x 3 4.2 x ⋅ − 8.5 − := x 2 2.1 , 3 .. := Chapter 3: Roots of Equations 67
  • 78. 2 2.2 2.4 2.6 2.8 10 − 5 − 0 5 10 f x ( ) x The derivative of the given function is fprime x ( ) 3 x 2 ⋅ 4.2 − := , and thus, fdblprime x ( ) 6 x ⋅ := , g x ( ) x f x ( ) fprime x ( ) − := , gprime x ( ) 1 fprime x ( ) 2 f x ( ) fdblprime x ( ) ⋅ − fprime x ( ) 2 − := where fdblprime(x) is the second derivative of f(x) and gprime(x) is the derivative of g(x). Start with an initial estimate of 2.5 xold 2.5 := xnew g xold ( ) := xnew 2.732 = gprime xnew ( ) 0.0206 = xold xnew := xnew g xold ( ) := xnew 2.7091 = gprime xnew ( ) 2.1887 10 4 − × = xold xnew := xnew g xold ( ) := xnew 2.7088 = gprime xnew ( ) 2.3959 10 8 − × = xold xnew := xnew g xold ( ) := xnew 2.7088 = gprime xnew ( ) 0 = Clearly, the root is the converged value 2.7088, and convergence has been established with the absolute value of the slope of g(x) being less than 1 in all the iterations. Example 3.5 Using the Newton- Raphson method, solve : f(x)= x3 +7x2+19x+13 = 0 for all roots, real as well as complex. Let us first draw a graph of the function 68 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 79. f x ( ) x 3 7 x 2 ⋅ + 19 x ⋅ + 13 + := which suggests that there is a real root between 0 and -2.5 x 5 − 4.999 − , 0 .. := 4 − 2 − 0 40 − 30 − 20 − 10 − 0 10 20 f x ( ) x The derivative of the given function is fprime x ( ) 3 x 2 ⋅ 14 x ⋅ + 19 + := with fdblprime x ( ) 6 x ⋅ := , g x ( ) x f x ( ) fprime x ( ) − := , gprime x ( ) 1 fprime x ( ) 2 f x ( ) fdblprime x ( ) ⋅ − fprime x ( ) 2 − := where fdblprime(x) is the second derivative of f(x) and gprime(x) is the first derivative of g(x). Let us start with an initial estimate of -2.5 in an attempt to find the real root. xold 2.5 − := xnew g xold ( ) := xnew 0.1818 − = gprime xnew ( ) 0.0389 = xold xnew := xnew g xold ( ) := xnew 0.7721 − = gprime xnew ( ) 0.095 = xold xnew := xnew g xold ( ) := xnew 0.9768 − = gprime xnew ( ) 0.0164 = xold xnew := xnew g xold ( ) := xnew 0.9997 − = gprime xnew ( ) 1.9933 10 4 − × = Chapter 3: Roots of Equations 69
  • 80. xold xnew := xnew g xold ( ) := xnew 1 − = gprime xnew ( ) 2.6521 10 8 − × = xold xnew := xnew g xold ( ) := xnew 1 − = gprime xnew ( ) 0 = From the above calculations, it is clear that the real root is the converged value of (-1). Let us now determine the complex roots by starting with an initial estimate of (-4+i) xold 4 − i + := xnew g xold ( ) := xnew 2.9024 − 1.122i + = xold xnew := xnew g xold ( ) := xnew 2.2579 − 2.5753i + = xold xnew := xnew g xold ( ) := xnew 2.636 − 1.9589i + = xold xnew := xnew g xold ( ) := xnew 3.0346 − 1.9196i + = xold xnew := xnew g xold ( ) := xnew 2.9957 − 2.001i + = xold xnew := xnew g xold ( ) := xnew 3 − 2i + = xold xnew := xnew g xold ( ) := xnew 3 − 2i + = <-- Converged Clearly, if we had started with an initial estimate of (-4-i ), we would have obtained the complex conjugate of the above complex root, as demonstrated below. However, there is no need to do this every time, since a complex root will always have a complex conjugate associated with it. xold 4 − i − := xnew 3 − 2i + = xnew g xold ( ) := xold xnew := xnew g xold ( ) := xnew 2.2579 − 2.5753i − = 70 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD
  • 81. xold xnew := xnew g xold ( ) := xnew 2.636 − 1.9589i − = xold xnew := xnew g xold ( ) := xnew 3.0346 − 1.9196i − = xold xnew := xnew g xold ( ) := xnew 2.9957 − 2.001i − = xold xnew := xnew g xold ( ) := xnew 3 − 2i − = xold xnew := xnew g xold ( ) := xnew 3 − 2i − = <-- Converged 3.6 USE OF MATHCAD'S root AND polyroots FUNCTIONS Use of root The function root (f(z),z) returns the value of "z" at which the function f(z) goes to zero. Here, both f(z) and z are to be scalar quantities. The procedure to be used will be clear from the following example. Let us find the root of the function in Example 3.4 which is f x ( ) x 3 4.2 x ⋅ − 8.5 − := A guess value for the root must be first defined : x 2.5 := Type the following to define " a" as the root of the given function a root f x ( ) x , ( ) := Chapter 3: Roots of Equations 71
  • 82. Type " a= " to see the root computed. a 2.7088 = Use of polyroots The function polyroots is a function in Mathcad which will return all roots of a polynomial at the same time, be they real or complex. It does not require a guess value. polyroots (v) returns all roots of an nth degree polynomial whose coefficients are given in the vector "v" with (n+1) components. By choosing "matrix" from the "insert" menu, type in a vector "v" as shown , beginning with the constant term, making sure that you insert all coefficients even if they are zero. Then, polyroots(v) returns all roots at once. The following steps will find the root of the polynomial of Example 3.4. f x ( ) x 3 4.2 x ⋅ − 8.5 − := <-- Given polynomial This is a vector of the coefficients of the polynomial whose roots are to be found. Include all coefficients, even zeros. Begin with the constant term. <-- v 8.5 − 4.2 − 0 1 ⎛ ⎜ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎟ ⎠ := polyroots v ( ) 1.3544 − 1.1417i − 1.3544 − 1.1417i + 2.7088 ⎛ ⎜ ⎜ ⎜ ⎝ ⎞ ⎟ ⎟ ⎟ ⎠ = <-- Returns all roots at the same time. 3.7 SECANT METHOD The Secant method is very similar to the Newton-Raphson method. The one difference is that while the derivative fprime(x) is evaluated analytically in the Newton-Raphson method, it is determined numerically in the Secant method . From Figure 3.4, it is clear that an approximation for the slope of the given function f(x) at x i can be written as fprime xi ( ) = f xi 1 − ( ) f xi ( ) − ( ) − xi xi 1 − − (3.9) 72 AN INTRODUCTION TO NUMERICAL METHODS USING MATHCAD