0% found this document useful (0 votes)
151 views

Introduction To Numerical Methods Prof

This document introduces numerical methods and provides reasons for engineers to study them. It describes that numerical methods allow problems to be solved using arithmetic operations on computers. Studying numerical methods increases an engineer's ability to customize existing programs and efficiently use computers. It also covers key areas of numerical methods like solving equations, systems of equations, optimization, curve fitting, integration, differentiation, and differential equations. Finally, it discusses mathematical modeling and problem solving.

Uploaded by

Matthew Aquino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views

Introduction To Numerical Methods Prof

This document introduces numerical methods and provides reasons for engineers to study them. It describes that numerical methods allow problems to be solved using arithmetic operations on computers. Studying numerical methods increases an engineer's ability to customize existing programs and efficiently use computers. It also covers key areas of numerical methods like solving equations, systems of equations, optimization, curve fitting, integration, differentiation, and differential equations. Finally, it discusses mathematical modeling and problem solving.

Uploaded by

Matthew Aquino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

INTRODUCTION TO NUMERICAL METHODS REASONS WHY AN ENGINEER SHOULD STUDY

NUMERICAL METHODS:
Numerical methods are techniques by which
mathematical problems are formulated so that they can • Numerical methods are extremely powerful problem-
be solved with arithmetic operations, however, they solving tools.
involve large numbers of tedious arithmetic
• In the field, there are occasions which an engineer will
calculations.
use an available prepackaged or “canned” computer
With the availability of fast, digital computers, programs that involve numerical methods. However,
numerical methods of solving engineering problems not all problems can be solved by these “canned”
became more popular. programs. Studying numerical methods can increase the
capabilities of these “canned” programs by customizing
In pre-computer era, engineers solved it according to the specifications of the problem.
problems in the following manner:
• Numerical methods are an efficient vehicle for
• Solutions were derived for some problems using learning to use computers.
analytical, or exact methods.
• Numerical methods provide a vehicle for you to
• Graphical solutions were used to characterize the reinforce your understanding of mathematics.
behavior of systems.
SUBJECT AREAS ARE COVERED IN THE STUDY OF
• Calculators and slide rules were used to implement
NUMERICAL METHOD
numerical methods manually.
1. Roots of equations – these problems are concerned
With this, significant amount of energy were with the value of a variable or a parameter that satisfies
expended on the solution technique itself, rather than a single nonlinear equation. These problems are
on the problem definition and interpretation. especially valuable in engineering design contexts
With fast and efficient computers, numerical where it is often impossible to explicitly solve design
methods can be implemented and solutions obtained equations for parameters.
within a short span of time.

2. Systems of linear algebraic equations – these


problems are similar in spirit to roots of equations in
the sense that they are concerned with values that
satisfy equations. However, in contrast to satisfying a
single equation, a set of values is sought that
simultaneously satisfies a set of linear algebraic
equations.

NUMERICAL METHODS by PMSJR Page 1


3. Optimization – these problems involve determining a
value or values of an independent variable that
correspond to a “best” or optimal value of a function.
Thus, optimization involves identifying maxima and
minima.

MATHEMATICAL MODELING AND ENGINEERING


PROBLEM SOLVING

4. Curve fitting – the techniques developed for this A mathematical model can be broadly defined
purpose can be divided into two general categories: as the formulation or equation that expresses the
regression and interpolation. Regression is employed essential features of a physical system or process in
where there is a significant degree of error associated mathematical terms. In a very general sense, it can be
with the data, and the strategy is to derive a single represented as a functional relationship of the form:
curve that represents the general trend. Interpolation is
used when the objective is to determine intermediate
values between relatively error-free data, and the
strategy is to fit a curve directly through the data points
and use the curve to predict the intermediate values.

Where:

Dependent variable is a characteristic that usually


reflects the behavior or state of the system;

Independent variables are usually dimensions, such as


space and time, along which the system’s behavior is
being determined;
5. Integration and differentiation - numerical
integration is the determination of area under the Parameters are reflective of the system’s properties or
curve, while differentiation is finding the slope of the composition; and
curve at various points.
Forcing functions are external influences acting upon
the system.

The actual mathematical expression of the


Equation can range from simple algebraic relationship
to large complicated sets of differential equations.

6. Ordinary and partial differential equations – many Mathematical models of the physical world are
physical laws are couched in terms of the rate of change characterized by the following:
of the quantity rather than the quantity itself. If the
quantity is one-dimensional, an ordinary differential • It describes a natural process or system in
equation arises; a partial differential equation is mathematical terms.
obtained when the quantity is multidimensional.

NUMERICAL METHODS by PMSJR Page 2


• It represents an idealization and simplification of Example 5 :
reality.
A farmer is looking to divide to plant different cultures.
• It yields reproducible results and consequently can be Traditionally, corn fields returned $ 3.50 $ per square
used for predictive purposes. metre. Oat fields returned $ 2.75 per square
metre.Orchards produced revenues of $ 4.50 per square
Example 1: metre. The farmer has a land of 1 million square
Marc wishes to invest in a stock with a 10% return metres. In order to feed his farm animals, the cultivator
annually. How much money will he have at the end of must dedicate a minimum of 300 000 square metres to
the year? the culture of corn and oats (together). However, since
corn is more susceptible to long periods of drought, he
Solution: does not want this culture to occupy more than 200 000
square metres. Lastly, he would like to allot the same
Marc’s initial investment is unknown. Let us define:
amount of space to oats and orchards. Which
x: the amount that Marc invests in this share expression correctly represents the revenues of the
farmer? Model all constraints that the farmer must
The amount accumulated at the end of the year will be respect.

𝒙 + (𝟏𝟎%)𝒙 = 𝒙 + 𝟎. 𝟏𝒙 = 𝟏. 𝟏𝒙 Solution

Example 2: 𝒙: 𝒕𝒉𝒆 𝒔𝒖𝒓𝒇𝒂𝒄𝒆 𝒂𝒍𝒍𝒐𝒕𝒆𝒅 𝒕𝒐 𝒄𝒐𝒓𝒏 (𝒎𝟐 )

A carpenter produces and sells his own furniture. Pine 𝒚: 𝒕𝒉𝒆 𝒔𝒖𝒓𝒇𝒂𝒄𝒆 𝒂𝒍𝒍𝒐𝒕𝒆𝒅 𝒕𝒐 𝒐𝒂𝒕𝒔 (𝒎𝟐 )
tables are sold for 650 $, cherry tables for 750 $ and
maple tables for 850 $. What is the carpenter’s annual 𝒛: 𝒕𝒉𝒆 𝒔𝒖𝒓𝒇𝒂𝒄𝒆 𝒂𝒍𝒍𝒐𝒕𝒆𝒅 𝒕𝒐 𝒂𝒑𝒑𝒍𝒆 (𝒎𝟐 )
revenue?
𝑹𝒆𝒗𝒆𝒏𝒖𝒆𝒔 = 𝟑. 𝟓𝟎𝒙 + 𝟐. 𝟕𝟓𝒚 + 𝟒. 𝟓𝟎𝒛
Solution:
Four constraints are forced on the farmer:
The annual revenue of the carpenter can only be
1. "The farmer has a land of 1 million square metres"
obtained if the amount of tables sold of each type is
known. Variables must therefore replace these 𝒙 + 𝒚 + 𝒛 ≤ 𝟏, 𝟎𝟎𝟎, 𝟎𝟎𝟎
quantities, all unknownfor the moment. Let us define:
2. "The farmer must dedicate a minimum of 300 000
x :the number of pine tables sold during the year square metres to corn and oats"

y :the number of cherry tables sold during the year 𝒙 + 𝒚 ≥ 𝟑𝟎𝟎, 𝟎𝟎𝟎

z :the number of maple tables sold during the year 3. "Since corn is more susceptible to long periods of
drought, he does not want this culture to occupy more
Each pine table produces a revenue of 650 $. If x pine than 200 000 square metres"
tables are sold, a revenue of 650 times x will be
obtained. The same argument applies to the other 𝒙 ≤ 𝟐𝟎𝟎, 𝟎𝟎𝟎
types of tables. Consequently,
4. "He would like to allot the same space to oats and
𝑻𝒐𝒕𝒂𝒍 𝑹𝒆𝒗𝒆𝒏𝒖𝒆 = 𝟔𝟓𝟎𝒙 + 𝟕𝟓𝟎𝒚 + 𝟖𝟓𝟎𝒛 orchards "

𝒚=𝒛

NUMERICAL METHODS by PMSJR Page 3


PROGRAMMING AND SOFTWARE arrows represent the sequence in which the operations
are implemented.
Computer programs are set of instructions that direct
the computer to perform a certain task. Computer
programming can be narrowed down into the following
topics:

• Simple information representation (constants,


variables, and type declarations)

• Advanced information representation (data structure,


arrays, and records)

• Mathematical formulas (assignment, priority rules,


and intrinsic functions)

• Input and output

• Logical representation (sequence, selection, and


repetition)

• Modular programming (functions and subroutines)

In the early days of computers, programmers


usually did not pay much attention to whether their
programs were clear and easy to understand. Today, it
is recognized that there are many benefits in writing
organized, well-structured code. Thus, structured
programming came into place.

Structured programming is a set of rules that


prescribe good style habits for the programmer. A key
idea behind structured programming is that any
numerical algorithm can be composed using the control
structures.

FUNDAMENTAL CONTROL STRUCTURES:

Sequence, Selection, and

Repetition.

To demonstrate the idea of structured


programming, flowcharts and pseudocodes are used.

FLOWCHART

A flowchart is a visual or graphical


representation of an algorithm. The flowchart employs
a series of blocks and arrows, each of which represents
a particular operation or step in the algorithm. The

NUMERICAL METHODS by PMSJR Page 4


PSEUDOCODE

Another approach used to express algorithms is


called the pseudocode. This technique uses code-like
statements in place of the graphical symbols of
flowcharts.

As stated before, structured programming


requires effective use of the following control
structures:

• SEQUENCE - The sequence structure expresses the If there are multiple alternatives, the following selection
trivial idea that unless you direct it otherwise, the structures can be used.
computer code is to be implemented one instruction at
a time.

• SELECTION - The selection structure provides a means


to split the program’s flow into branches based on the
outcome of a logical condition. • REPETITION - Repetition provides a means to
implement instructions repeatedly. The resulting
constructs are called loops. There are two types of
loops, depending on how they are terminated. The first
one is called a decision loop because it terminates
based on the result of a logical condition. The second
one is called a count-controlled loop performs a
specified number of repetitions or iterations.

NUMERICAL METHODS by PMSJR Page 5


• Development, as well as maintenance and
modification of the program is facilitated.

• Increases the ease with which a program can be


debugged and tested.

SAMPLE PROBLEM

Develop a pseudocode for a computer program


that will compute for the roots of a quadratic equation
𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄 = 𝟎. The algorithm is as follows:

1. Prompts the user for coefficients a, b and c.


2. Implements the quadratic formula, guarding against
all eventualities.
3. Displays the solution.
4. Allows the user the option to return to step 1 and
repeat the process.

Aside from structured programming, modular


programming is also being practiced in the
development of computer programs. Modular
programming refers to the practice of dividing the
computer program into modules, called procedures,
designed to specifically perform a certain task.

There are two types of procedures commonly


employed:

• Functions – which return a single result;

• Subroutines – which return several results.

Modular programming has a number of advantages:

• The use of small, self-contained units makes the


underlying logic easier to device and to understand for
both the developer and the user.

NUMERICAL METHODS by PMSJR Page 6


NUMERICAL METHODS by PMSJR Page 7
APPROXIMATIONS AND ROUND-OFF ERRORS Illustration of Accuracy an Precision

This section covers basic topics related to the


identification, quantification, and minimization of these
errors.

TWO MAJOR FORMS OF ERRORS

Round-off errors - due to the fact that computers can


represent only quantities with a finite number of digits;

Truncation error - the discrepancy introduced by the


fact that numerical methods may employ
approximations to represent exact mathematical
operations and quantities.

Whenever numbers are employed in


computations, there should be an assurance that it can
Inaccuracy (also called bias) is defined as the
be used with confidence. The concept of significant
figure, or digit, has been developed to formally systematic deviation from the true value.
designate the reliability of a numerical value. The Imprecision (also called uncertainty) refers to
significant digits correspond to the number of certain the magnitude of the scatter of the measurements or
digits plus one estimated digit. computed values.
The concept of significant figures has two important Numerical methods should ensure that there is
implications for the study of numerical methods: no bias nor uncertainty with the results for it to be
• Numerical methods yield approximate results. considered a valid solution.
Therefore, there should a criteria to specify the Numerical errors arise from the use of
confidence in the approximate result. approximations to represent exact mathematical
operations and quantities. These include round-off and
• Computers can only represent finite number of digits
for a given number. Quantities such as e, π, and √7 has truncation errors. For both types, the following
infinite number of significant digits. Therefore, the relationships hold true:
computer will omit most of these significant digits 𝑻𝒓𝒖𝒆 𝑽𝒂𝒍𝒖𝒆 = 𝑨𝒑𝒑𝒓𝒐𝒙𝒊𝒎𝒂𝒕𝒆 𝑽𝒂𝒍𝒖𝒆 + 𝑬𝒓𝒓𝒐𝒓
which will result in round-off errors.
Thus, error is defined as the discrepancy
𝒆 = 𝟐. 𝟕𝟏𝟖𝟐𝟖𝟏𝟖𝟐𝟖 … … … between the true and approximated values, or
𝝅 = 𝟑. 𝟏𝟒𝟏𝟓𝟗𝟐𝟔𝟓𝟒 … … …
√𝟕 = 𝟐. 𝟔𝟒𝟓𝟕𝟓𝟏𝟑𝟏𝟏 … … … 𝑬𝒕 = 𝑻𝒓𝒖𝒆 − 𝑨𝒑𝒑𝒓𝒐𝒙𝒊𝒎𝒂𝒕𝒆

where Et is called the true or exact error.


The errors associated with both calculations
and measurements can be characterized with regard Errors are normalize to take into account the
to their accuracy and precision. scale or magnitude of the problem being considered.
Thus, the true fractional relative error as a percentage
Accuracy refers to how closely a computed or is given as
measured value agrees with the true value.
𝑬𝒕
Precision refers to how closely individual 𝒆𝒕 = 𝒙 𝟏𝟎𝟎%
𝑻𝒓𝒖𝒆 𝑽𝒂𝒍𝒖𝒆
computed or measured values agree with each other.

NUMERICAL METHODS by PMSJR Page 8


SAMPLE PROBLEM: 𝒆𝒔 = (𝟎. 𝟓 𝒙 𝟏𝟎𝟐−𝒏 )%

The measured values of a bridge and a river where n is the number of significant figures (at
are 9999 cm and 9 cm, respectively. If the true values least).
are 10000 cm and 10 cm respectively, compute the true
error and the true percent relative error for each case. SAMPLE PROBLEM NO. 1:

The Taylor series expansion for ex is

𝒙
𝒙𝟐 𝒙𝟑 𝒙𝒏
𝒆 = 𝟏 + 𝒙 + + + ⋯.+
𝟐! 𝟑! 𝒏!
Using this expansion, determine the value of e0.5
correct to three significant figures.

True Value

𝒆𝟎.𝟓 = 𝟏. 𝟔𝟒𝟖𝟕𝟐𝟏𝟐𝟕𝟏

In most cases, the true value will never be n Result et ea


known, unless there is an analytic solution to the 1
problem. An alternative for this is to normalize the error
2
using the best available estimate of the true value, that
is 3

𝑨𝒑𝒑𝒓𝒐𝒙𝒊𝒎𝒂𝒕𝒆 𝑬𝒓𝒓𝒐𝒓 4
𝒆𝒂 = 𝒙𝟏𝟎𝟎%
𝑨𝒑𝒑𝒓𝒐𝒙𝒊𝒎𝒂𝒕𝒆 𝑽𝒂𝒍𝒖𝒆 5
One of the challenges of numerical methods is 6
to determine error estimates in the absence of
knowledge regarding the true value. That is why SAMPLE PROBLEM NO. 2
numerical methods employ different ways of
The derivative of a function f(x) at a value of x can be
determining the approximate error depending on the
approximately calculated by:
algorithms used.
𝒇(𝒙 + 𝒉) − 𝒇(𝒙)
Errors can be positive or negative, however, 𝒇(𝒙) =
𝒉
signs of the error may not play a role in the
computation. Therefore it is often useful to employ the 𝑰𝒇 𝒇’(𝟐)𝒇𝒐𝒓𝒇(𝒙) = 𝟕𝒆𝟎.𝟓𝒙 𝒂𝒏𝒅 𝒉 = 𝟎. 𝟑, 𝒇𝒊𝒏𝒅
absolute values of the errors and compare it with a
a.) Approximate Value of f’(2)
certain tolerance, or
b.) True Value of f’(2)
|𝒆𝒂 | < 𝒆𝒔 c.) True Error

If this relationship holds, the results are


assumed to be within the pre-specified acceptable level
es. It is also convenient to relate these errors to the
number of significant figures in the approximation.
Thus, it can be shown that

NUMERICAL METHODS by PMSJR Page 9

You might also like