0% found this document useful (0 votes)
33 views225 pages

Numerical Methods Interpolation and Regression Notes

The document discusses the Direct Method of Interpolation, which involves using polynomials to estimate values of 'y' at given 'x' points based on provided data points. It includes examples of linear, quadratic, and cubic interpolation methods applied to the upward velocity of a rocket over time, demonstrating how to calculate the velocity at specific time intervals. Additionally, it compares the results of different polynomial orders and provides resources for further study on numerical methods in engineering.

Uploaded by

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

Numerical Methods Interpolation and Regression Notes

The document discusses the Direct Method of Interpolation, which involves using polynomials to estimate values of 'y' at given 'x' points based on provided data points. It includes examples of linear, quadratic, and cubic interpolation methods applied to the upward velocity of a rocket over time, demonstrating how to calculate the velocity at specific time intervals. Additionally, it compares the results of different polynomial orders and provides resources for further study on numerical methods in engineering.

Uploaded by

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

Direct Method of

Interpolation

Major: All Engineering Majors

Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

http://numericalmethods.eng.usf.edu 1
Direct Method of
Interpolation

http://numericalmethods.eng.usf.edu
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the value of ‘y’ at a
value of ‘x’ that is not given.

Figure 1 Interpolation of discrete.


3 http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:
Evaluate
Differentiate, and
Integrate

4 http://numericalmethods.eng.usf.edu
Direct Method
Given ‘n+1’ data points (x0,y0), (x1,y1),………….. (xn,yn),
pass a polynomial of order ‘n’ through the data as given
below:

y = a0 + a1 x + .................... + an x . n

where a0, a1,………………. an are real constants.


 Set up ‘n+1’ equations to find ‘n+1’ constants.

 To find the value ‘y’ at a given value of ‘x’, simply


substitute the value of ‘x’ in the above polynomial.

5 http://numericalmethods.eng.usf.edu
Example 1
The upward velocity of a rocket is given as a
function of time in Table 1.
Find the velocity at t=16 seconds using the
direct method for linear interpolation.
Table 1 Velocity as a function
of time.

t , (s ) v(t ), (m/s )

0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure 2 Velocity vs. time data for the
rocket example
6 http://numericalmethods.eng.usf.edu
Linear Interpolation
v(t ) = a0 + a1t y

v(15) = a 0 + a1 (15) = 362.78 (x1 , y1 )

v(20 ) = a 0 + a1 (20 ) = 517.35 (x0 , y0 )


f1 ( x )

Solving the above two equations gives, x

a0 = −100.93 a1 = 30.914 Figure 3 Linear interpolation.

Hence
v(t ) = −100.93 + 30.914t , 15 ≤ t ≤ 20.
v(16 ) = −100.93 + 30.914(16) = 393.7 m/s

7 http://numericalmethods.eng.usf.edu
Example 2
The upward velocity of a rocket is given as a
function of time in Table 2.
Find the velocity at t=16 seconds using the
direct method for quadratic interpolation.
Table 2 Velocity as a function
of time.

t , (s ) v(t ), (m/s )

0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure 5 Velocity vs. time data for the
rocket example
8 http://numericalmethods.eng.usf.edu
Quadratic Interpolation
y

v(t ) = a0 + a1t + a2t 2 (x1 , y1 )


v(10) = a0 + a1 (10) + a2 (10) = 227.04
2 ( x2 , y 2 )

v(15) = a0 + a1 (15) + a2 (15) = 362.78


2

f 2 (x )
v(20) = a0 + a1 (20) + a2 (20) = 517.35
2
( x0 , y 0 )
x

Figure 6 Quadratic interpolation.

Solving the above three equations gives


a0 = 12.05 a1 = 17.733 a2 = 0.3766
9 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (cont.)
550
517.35

v(t ) = 12.05 + 17.733t + 0.3766t , 10 ≤ t ≤ 20


500
2
450

ys

v(16 ) = 12.05 + 17.733(16 ) + 0.3766(16 )


400
2 f ( range)

(
f x desired ) 350

= 392.19 m/s 300

250

227.04 200
10 12 14 16 18 20
10 x s , range , x desired 20

The absolute relative approximate error ∈a obtained between


the results from the first and second order polynomial is
392.19 − 393.70
∈a = ×100
392.19
= 0.38410%
10 http://numericalmethods.eng.usf.edu
Example 3
The upward velocity of a rocket is given as a
function of time in Table 3.
Find the velocity at t=16 seconds using the
direct method for cubic interpolation.
Table 3 Velocity as a function
of time.

t , (s ) v(t ), (m/s )

0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure 6 Velocity vs. time data for the
rocket example
11 http://numericalmethods.eng.usf.edu
Cubic Interpolation
y

(x3 , y3 )
v(t ) = a0 + a1t + a2t + a3t
2 3

(x1 , y1 )
v(10) = 227.04 = a0 + a1 (10) + a2 (10) + a3 (10)
2 3

f 3 (x )
( x2 , y 2 )
v(15) = 362.78 = a0 + a1 (15) + a2 (15) + a3 (15)
2 3
(x0 , y0 )

v(20) = 517.35 = a0 + a1 (20) + a2 (20) + a3 (20)


2 3 x

Figure 7 Cubic interpolation.


v(22.5) = 602.97 = a0 + a1 (22.5) + a2 (22.5) + a3 (22.5)
2 3

a0 = −4.2540 a1 = 21.266 a2 = 0.13204 a3 = 0.0054347

12 http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
v(t ) = −4.2540 + 21.266t + 0.13204t 2 + 0.0054347t 3 , 10 ≤ t ≤ 22.5
v(16 ) = −4.2540 + 21.266(16 ) + 0.13204(16 ) + 0.0054347(16 )
2 3

= 392.06 m/s
700

The absolute percentage relative


602.97

approximate error ∈a between


600

ys 500 second and third order polynomial is


f ( range)

(
f x desired )

392.06 − 392.19
400

300
∈a = × 100
392.06
227.04 200
10
10
12 14 16 18
x s , range , x desired
20 22 24
22.5
= 0.033269%

13 http://numericalmethods.eng.usf.edu
Comparison Table

Table 4 Comparison of different orders of the polynomial.


Order of
1 2 3
Polynomial
v(t = 16 ) m/s 393.7 392.19 392.06
Absolute Relative
---------- 0.38410 % 0.033269 %
Approximate Error

14 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to t=16s ?
v(t ) = −4.3810 + 21.289t + 0.13064t 2 + 0.0054606t 3 , 10 ≤ t ≤ 22.5
16
s(16 ) − s(11) = ∫ v(t )dt
11

( )
16
= ∫ − 4.2540 + 21.266t + 0.13204t 2 + 0.0054347t 3 dt
11
16
 t2 t3 t4 
= − 4.2540t + 21.266 + 0.13204 + 0.0054347 
 2 3 4 11
= 1605 m

15 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
ν (t ) = −4.2540 + 21.266t + 0.13204 2 + 0.0054347t 3 ,10 ≤ t ≤ 22.5

a(t ) = v(t )
d
dt
=
d
dt
(
− 4.2540 + 21.266t + 0.13204t 2 + 0.0054347t 3 )
= 21.289 + 0.26130t + 0.016382t 2 , 10 ≤ t ≤ 22.5

a (16 ) = 21.266 + 0.26408(16 ) + 0.016304(16)


2

= 29.665 m/s 2

16 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/direct_met
hod.html
THE END

http://numericalmethods.eng.usf.edu
Lagrangian Interpolation

Major: All Engineering Majors

Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

http://numericalmethods.eng.usf.edu 1
Lagrange Method of
Interpolation

http://numericalmethods.eng.usf.edu
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the
value of ‘y’ at a value of ‘x’ that is not given.

3 http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

4 http://numericalmethods.eng.usf.edu
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
n
f n ( x) = ∑ Li ( x) f ( xi )
i =0

where ‘ n ’ in f n (x) stands for the n th order polynomial that approximates the function y = f (x)

given at (n + 1) data points as (x0 , y 0 ), (x1 , y1 ),......, (x n −1 , y n −1 ), (x n , y n ) , and


n x − xj
Li ( x) = ∏
j =0 xi − x j
j ≠i

Li (x) is a weighting function that includes a product of (n − 1) terms with terms of j = i


omitted.

5 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Lagrangian method for linear interpolation.
Table Velocity as a
function of time
t (s) v(t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Figure. Velocity vs. time data


6 for the rocket example http://numericalmethods.eng.usf.edu
Linear Interpolation
550
517.35

1
v(t ) = ∑ Li (t )v(ti ) 500
i =0

= L0 (t )v(t 0 ) + L1 (t )v(t1 )
ys

f ( range)
450
(
f x desired )

t 0 = 15,ν (t 0 ) = 362.78 400

t1 = 20,ν (t1 ) = 517.35 362.78 350


10 12 14 16 18 20 22 24
x s − 10 x s , range , x desired x s + 10
0 1

7 http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)
1 t −tj t − t1
L0 (t ) = ∏ =
j =0 t0 − t j t 0 − t1
j ≠0

1 t −tj t − t0
L1 (t ) = ∏ =
j =0 t1 − t j t1 − t 0
j ≠1

t − t1 t − t0 t − 20 t − 15
v(t ) = v(t 0 ) + v(t1 ) = (362.78) + (517.35)
t 0 − t1 t1 − t 0 15 − 20 20 − 15
16 − 20 16 − 15
v(16) = (362.78) + (517.35)
15 − 20 20 − 15
= 0.8(362.78) + 0.2(517.35)

= 393.7 m/s.

8 http://numericalmethods.eng.usf.edu
Quadratic Interpolation
For the second order polynomial interpolation (also called quadratic interpolation), we
choos e the veloc ity given by
2
v (t ) = ∑ Li ( t ) v(t i )
i =0

= L0 (t )v (t 0 ) + L1 (t ) v( t1 ) + L2 (t ) v( t 2 )

9 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Lagrangian method for quadratic interpolation.
Table Velocity as a
function of time
t (s) v(t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Figure. Velocity vs. time data


10 for the rocket example http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
t 0 = 10, v(t 0 ) = 227.04
550
517.35

t1 = 15, v(t1 ) = 362.78 500

t 2 = 20, v(t 2 ) = 517.35 450

ys
400
f ( range)
2 t −tj  t − t1  t − t 2 
L0 (t ) = ∏ =    (
f x desired ) 350
j =0 t0 − t j t −
 0 1  0 2 
t t − t
j ≠0
300
2 t −t j  t − t0  t − t 2 
L1 (t ) = ∏ =   
j =0 t1 − t j  t1 − t 0  t1 − t 2  250
j ≠1

2 t −tj  t − t 0  t − t1  227.04 200


L2 (t ) = ∏ =    10 12 14 16 18 20

j =0 t2 − t j −
 2 0  2 1 
t t t − t 10 x s , range , x desired 20
j ≠2

11 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
 t − t1  t − t2   t − t0  t − t 2   t − t0  t − t1 
v(t ) =   v(t0 ) +   v(t1 ) +   v(t 2 )
 t0 − t1  t0 − t 2   t1 − t0  t1 − t 2   t 2 − t0  t 2 − t1 
 16 − 15  16 − 20   16 − 10  16 − 20   16 − 10  16 − 15 
v(16) =    (227 . 04 ) +    (362 . 78 ) +   (517.35)
 10 − 15  10 − 20   15 − 10  15 − 20   20 − 10  20 − 15 
= (− 0.08)(227.04) + (0.96)(362.78) + (0.12)(527.35)
= 392.19 m/s
The absolute relative approximate error ∈a obtained between the
results from the first and second order polynomial is

392.19 − 393.70
∈a = ×100
392.19
= 0.38410%
12 http://numericalmethods.eng.usf.edu
Cubic Interpolation
For the third order polynomial (also called cubic interpolation), we choose the velocity given by
3
v (t ) = ∑ Li ( t ) v(t i )
i =0

= L0 (t ) v( t 0 ) + L1 ( t ) v(t 1 ) + L2 ( t ) v(t 2 ) + L3 ( t ) v(t 3 )


700
602.97

600

ys 500

f ( range)

(
f x desired )
400

300

227.04 200
10 12 14 16 18 20 22 24
10 x s , range , x desired 22.5

13 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Lagrangian method for cubic interpolation.
Table Velocity as a
function of time
t (s) v(t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Figure. Velocity vs. time data


14 for the rocket example http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
t o = 10, v (t o ) = 227.04 t1 = 15, v (t1 ) = 362.78

t 2 = 20, v (t 2 ) = 517.35 t 3 = 22.5, v (t 3 ) = 602.97

700
3 t −tj  t − t 1  t − t 2  t − t 3  602.97

L0 (t ) = ∏ =     ;
j =0 t0 − t j  t 0 − t 1  t 0 − t 2  t 0 − t 3  600
j ≠0

3 t −t j  t − t0  t − t 2  t − t 3 
L1 (t ) = ∏ =    
ys 500

j =0 t1 − t j  t1 − t 0  t1 − t 2  t1 − t 3  f ( range)

j ≠1 (
f x desired )
400

3 t −tj  t − t 0  t − t1  t − t 3 
L2 (t ) = ∏ =     ;
t2 − t j  t 2 − t 0  t 2 − t 1  t 2 − t 3 
300
j =0
j ≠2

t −tj  t − t 0  t − t1  t − t 2 
227.04 200
3
L3 ( t ) = ∏
10 12 14 16 18 20 22 24
=     10 x s , range , x desired 22.5

j =0 t3 − t j − t t −
 3 0  3 1  3 2 
t t t − t
j ≠3

15 http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
 t − t1  t − t 2  t − t3   t − t0  t − t 2  t − t3 
v(t ) =    v(t1 ) +    v(t 2 )
 t 0 − t1  t 0 − t 2  t 0 − t 3   t1 − t 0  t1 − t 2  t1 − t 3 
 t − t0  t − t1  t − t3   t − t1  t − t1  t − t 2 
+    v(t 2 ) +    v(t3 )
− t −
 2 0  2 1  2 3 
t t t t − t t − t t −
 3 1  3 1  3 2 
t t − t
 16 − 15  16 − 20  16 − 22.5   16 − 10  16 − 20  16 − 22.5 
v(16) =    (227.04 ) +    (362.78)
 10 − 15  10 − 20  10 − 22.5   15 − 10  15 − 20  15 − 22.5 
 16 − 10  16 − 15  16 − 22.5   16 − 10  16 − 15  16 − 20 
+   (517.35) +    (602.97 )
 20 − 10  20 − 15  20 − 22 . 5   22 .5 − 10  22 .5 − 15  22. 5 − 20 
= (− 0.0416 )(227.04 ) + (0.832 )(362.78) + (0.312 )(517.35) + (− 0.1024 )(602.97 )
= 392.06 m/s
The absolute relative approximate error ∈a obtained between the
results from the first and second order polynomial is
392.06 − 392.19
∈a = ×100
392.06
= 0.033269%
16 http://numericalmethods.eng.usf.edu
Comparison Table

Order of
1 2 3
Polynomial
v(t=16) m/s 393.69 392.19 392.06
Absolute Relative
-------- 0.38410% 0.033269%
Approximate Error

17 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to
t=16s ?
v(t ) = (t 3 − 57.5t 2 + 1087.5t − 6750)(−0.36326) + (t 3 − 52.5t 2 + 875t − 4500)(1.9348)
+ (t 3 − 47.5t 2 + 712.5t − 3375)(−4.1388) + (t 3 − 45t 2 + 650t − 3000)(2.5727)
v (t ) = −4.245 + 21.265t + 0.13195t 2 + 0.00544t 3 , 10 ≤ t ≤ 22.5
16

s(16) − s (11) = ∫ v( t ) dt
11

16

≈ ∫ ( −4.245 + 21.265t + 0.13195t 2 + 0.00544t 3 ) dt


11

t2 t3 t 4 16
= [ −4.245t + 21.265 + 0.13195 + 0.00544 ]11
2 3 4

= 1605 m
18 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that

v(t ) = −4.245 + 21.265t + 0.13195t 2 + 0.00544t 3 , 10 ≤ t ≤ 22.5

a (t ) = v (t ) = (− 4.245 + 21.265t + 0.13195t + 0.00544t 3 )


d d 2 ,

dt dt

= 21.265 + 0.26390t + 0.01632t 2

a (16) = 21. 265 + 0.26390(16) + 0.01632(16) 2

= 29.665 m / s 2

19 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/lagrange_
method.html
THE END

http://numericalmethods.eng.usf.edu
Newton’s Divided Difference
Polynomial Method of
Interpolation

Major: All Engineering Majors

Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

http://numericalmethods.eng.usf.edu 1
Newton’s Divided
Difference Method of
Interpolation

http://numericalmethods.eng.usf.edu
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the
value of ‘y’ at a value of ‘x’ that is not given.

3 http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

4 http://numericalmethods.eng.usf.edu
Newton’s Divided Difference
Method
Linear interpolation: Given ( x0 , y 0 ), ( x1 , y1 ), pass a
linear interpolant through the data
f1 ( x) = b0 + b1 ( x − x0 )

where
b0 = f ( x0 )
f ( x1 ) − f ( x0 )
b1 =
x1 − x0

5 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Newton Divided Difference method for linear
interpolation.
Table. Velocity as a
function of time

t (s) v(t ) (m/s)


0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Figure. Velocity vs. time data
6
for the rocket example http://numericalmethods.eng.usf.edu
Linear Interpolation
550
517.35

v(t ) = b0 + b1 (t − t 0 ) 500

ys

t 0 = 15, v(t 0 ) = 362.78 f ( range)


450
(
f x desired )
t1 = 20, v(t1 ) = 517.35
b0 = v(t 0 ) = 362.78 400

v(t ) − v(t 0 )
b1 = 1 = 30.914 362.78
t1 − t 0
350
10 12 14 16 18 20 22 24
x s − 10 x s , range , x desired x s + 10
0 1

7 http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)
550
517.35

500

ys

f ( range)
450
(
f x desired )

400

362.78 350
10 12 14 16 18 20 22 24
x s − 10 x s , range , x desired x s + 10

v(t ) = b0 + b1 (t − t 0 )
0 1

= 362.78 + 30.914(t − 15), 15 ≤ t ≤ 20


At t = 16
v(16) = 362.78 + 30.914(16 − 15)

8
= 393.69 m/s http://numericalmethods.eng.usf.edu
Quadratic Interpolation
Given ( x0 , y 0 ), ( x1 , y1 ), and ( x 2 , y 2 ), fit a quadratic interpolant through the data.
f 2 ( x) = b0 + b1 ( x − x0 ) + b2 ( x − x0 )( x − x1 )

b0 = f ( x0 )

f ( x1 ) − f ( x0 )
b1 =
x1 − x0

f ( x 2 ) − f ( x1 ) f ( x1 ) − f ( x0 )

x 2 − x1 x1 − x0
b2 =
x 2 − x0

9 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Newton Divided Difference method for quadratic
interpolation.
Table. Velocity as a
function of time

t (s) v(t ) (m/s)


0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Figure. Velocity vs. time data
10
for the rocket example http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
550
517.35

500

450

ys
400
f ( range)

(
f x desired ) 350

300

250

227.04 200
10 12 14 16 18 20
10 x s , range , x desired 20

t 0 = 10, v(t 0 ) = 227.04


t1 = 15, v(t1 ) = 362.78
t 2 = 20, v(t 2 ) = 517.35
11 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
b0 = v(t 0 )
= 227.04
v(t ) − v(t 0 ) 362.78 − 227.04
b1 = 1 =
t1 − t 0 15 − 10
= 27.148

v(t 2 ) − v(t1 ) v(t1 ) − v(t 0 ) 517.35 − 362.78 362.78 − 227.04


− −
t 2 − t1 t1 − t 0 20 − 15 15 − 10
b2 = =
t 2 − t0 20 − 10
30.914 − 27.148
=
10
= 0.37660
12 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
v(t ) = b0 + b1 (t − t 0 ) + b2 (t − t 0 )(t − t1 )
= 227.04 + 27.148(t − 10) + 0.37660(t − 10)(t − 15), 10 ≤ t ≤ 20
At t = 16,
v(16) = 227.04 + 27.148(16 − 10) + 0.37660(16 − 10)(16 − 15) = 392.19 m/s
The absolute relative approximate error ∈a obtained between the results from the first
order and second order polynomial is

392.19 − 393.69
∈a = x100
392.19

= 0.38502 %

13 http://numericalmethods.eng.usf.edu
General Form
f 2 ( x) = b0 + b1 ( x − x0 ) + b2 ( x − x0 )( x − x1 )
where
b0 = f [ x0 ] = f ( x0 )
f ( x1 ) − f ( x 0 )
b1 = f [ x1 , x0 ] =
x1 − x0
f ( x 2 ) − f ( x1 ) f ( x1 ) − f ( x0 )

f [ x 2 , x1 ] − f [ x1 , x0 ] x 2 − x1 x1 − x0
b2 = f [ x 2 , x1 , x0 ] = =
x 2 − x0 x 2 − x0
Rewriting
f 2 ( x) = f [ x0 ] + f [ x1 , x0 ]( x − x0 ) + f [ x 2 , x1 , x0 ]( x − x0 )( x − x1 )

14 http://numericalmethods.eng.usf.edu
General Form
Given (n + 1) data points, ( x0 , y 0 ), ( x1 , y1 ),......, ( x n −1 , y n −1 ), ( x n , y n ) as
f n ( x) = b0 + b1 ( x − x0 ) + .... + bn ( x − x0 )( x − x1 )...( x − x n −1 )
where
b0 = f [ x0 ]
b1 = f [ x1 , x0 ]
b2 = f [ x 2 , x1 , x0 ]

bn −1 = f [ x n −1 , x n − 2 ,...., x0 ]
bn = f [ x n , x n −1 ,...., x0 ]

15 http://numericalmethods.eng.usf.edu
General form
The third order polynomial, given ( x0 , y 0 ), ( x1 , y1 ), ( x 2 , y 2 ), and ( x3 , y 3 ), is

f 3 ( x) = f [ x0 ] + f [ x1 , x0 ]( x − x0 ) + f [ x 2 , x1 , x0 ]( x − x0 )( x − x1 )
+ f [ x3 , x 2 , x1 , x0 ]( x − x0 )( x − x1 )( x − x 2 )
b0
x0 f ( x0 ) b1
f [ x1 , x0 ] b2
x1 f ( x1 ) f [ x 2 , x1 , x0 ] b3
f [ x 2 , x1 ] f [ x3 , x 2 , x1 , x0 ]
x2 f ( x2 ) f [ x3 , x 2 , x1 ]
f [ x3 , x 2 ]
x3 f ( x3 )

16 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a function of
time in Table 1. Find the velocity at t=16 seconds using
the Newton Divided Difference method for cubic
interpolation.
Table. Velocity as a
function of time

t (s) v(t ) (m/s)


0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Figure. Velocity vs. time data
17
for the rocket example http://numericalmethods.eng.usf.edu
Example
The velocity profile is chosen as
v(t ) = b0 + b1 (t − t 0 ) + b2 (t − t 0 )(t − t1 ) + b3 (t − t 0 )(t − t1 )(t − t 2 )
we need to choose four data points that are closest to t = 16
t0 = 10, v(t 0 ) = 227.04
t1 = 15, v(t1 ) = 362.78
t 2 = 20, v(t 2 ) = 517.35
t 3 = 22.5, v(t 3 ) = 602.97

The values of the constants are found as:


b0 = 227.04; b1 = 27.148; b2 = 0.37660; b3 = 5.4347×10−3
18 http://numericalmethods.eng.usf.edu
Example
b0
t0 = 10 227.04 b1
27.148 b2
t1 = 15, 362.78 0.37660 b3
30.914 5.4347 ×10 −3
t 2 = 20, 517.35 0.44453
34.248
t3 = 22.5, 602.97

b0 = 227.04; b1 = 27.148; b2 = 0.37660; b3 = 5.4347×10−3

19 http://numericalmethods.eng.usf.edu
Example
Hence
v (t ) = b0 + b1 (t − t 0 ) + b2 (t − t 0 )( t − t1 ) + b3 (t − t 0 )( t − t1 )(t − t 2 )
= 227.04 + 27.148( t − 10) + 0.37660(t − 10)(t − 15)
+ 5.4347 * 10 −3 (t − 10)( t − 15)( t − 20)
At t = 16,
v (16) = 227.04 + 27.148(16 − 10) + 0.37660(16 − 10)(16 − 15)
+ 5.4347 * 10 −3 (16 − 10)(16 − 15)(16 − 20)
= 392.06 m/s
The absolute relative approximate error ∈a obtained is
392.06 − 392.19
∈a = x100
392.06

= 0.033427 %
20 http://numericalmethods.eng.usf.edu
Comparison Table

Order of 1 2 3
Polynomial
v(t=16) 393.69 392.19 392.06
m/s
Absolute Relative ---------- 0.38502 % 0.033427 %
Approximate Error

21 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to
t=16s ?
v (t ) = 227.04 + 27.148(t − 10) + 0.37660( t − 10)( t − 15)
10 ≤ t ≤ 22.5
+ 5.4347 * 10 (t − 10)( t − 15)( t − 20)
−3

= −4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3 10 ≤ t ≤ 22.5


So
16
s(16) − s(11) = ∫ v (t )dt
11

16
= ∫ ( − 4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3 ) dt
11

16
 t2 t3 t4 
= − 4.2541t + 21.265 + 0.13204 + 0.0054347 
 2 3 4  11

22 = 1605 m http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that

v(t ) = −4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3

v(t ) = (− 4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3 )


d d
a (t ) =
dt dt

= 21.265 + 0.26408t + 0.016304t 2


a (16) = 21.265 + 0.26408(16) + 0.016304(16) 2

= 29.664 m / s 2

23 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/newton_div
ided_difference_method.html
THE END

http://numericalmethods.eng.usf.edu
Spline Interpolation Method

Major: All Engineering Majors

Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

http://numericalmethods.eng.usf.edu 1
Spline Method of
Interpolation

http://numericalmethods.eng.usf.edu
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the
value of ‘y’ at a value of ‘x’ that is not given.

3 http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

4 http://numericalmethods.eng.usf.edu
Rocket Example Results
t v Polynomial Velocity at Absolute Least
(s) (m/s) Order t=16 in Relative Number of
0 0 m/s Approxima Significant
10 227.04 te Error Digits
15 362.78 Correct
20 517.35 1 393.69 -------------
22.5 602.97 2 392.19 0.38% 2
30 901.67 3 392.05 0.036% 3
4 392.07 0.0051% 3
5 392.06 0.0026% 4

5 http://numericalmethods.eng.usf.edu
Why Splines ?

6 http://numericalmethods.eng.usf.edu
Why Splines ?

Figure : Higher order polynomial interpolation is a bad idea


7 http://numericalmethods.eng.usf.edu
Linear Interpolation

8 http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)

9 http://numericalmethods.eng.usf.edu
Example
The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at
t=16 seconds using linear splines.
Table Velocity as a
function of time

(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Figure. Velocity vs. time data
for the rocket example
10 http://numericalmethods.eng.usf.edu
Linear Interpolation

11 http://numericalmethods.eng.usf.edu
Quadratic Interpolation

12 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)

13 http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)

14 http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)

15 http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)

16 http://numericalmethods.eng.usf.edu
Quadratic Spline Example
The upward velocity of a rocket is given as a function of time.
Using quadratic splines
a) Find the velocity at t=16 seconds

b) Find the acceleration at t=16 seconds

c) Find the distance covered between t=11 and t=16 seconds

Table Velocity as a
function of time

(s) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure. Velocity vs. time data
for the rocket example

17 http://numericalmethods.eng.usf.edu
Solution

Let us set up the equations


18 http://numericalmethods.eng.usf.edu
Each Spline Goes Through
Two Consecutive Data Points

19 http://numericalmethods.eng.usf.edu
Each Spline Goes Through
Two Consecutive Data Points
t v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

20 http://numericalmethods.eng.usf.edu
Derivatives are Continuous at
Interior Data Points

21 http://numericalmethods.eng.usf.edu
Derivatives are continuous at
Interior Data Points
At t=10

At t=15

At t=20

At t=22.5

22 http://numericalmethods.eng.usf.edu
Last Equation

23 http://numericalmethods.eng.usf.edu
Final Set of Equations

24 http://numericalmethods.eng.usf.edu
Coefficients of Spline
i ai bi ci
1 0 22.704 0
2 0.8888 4.928 88.88
3 −0.1356 35.66 −141.61
4 1.6048 −33.956 554.55
5 0.20889 28.86 −152.13

25 http://numericalmethods.eng.usf.edu
Quadratic Spline Interpolation
Part 2 of 2

http://numericalmethods.eng.usf.edu

26 http://numericalmethods.eng.usf.edu
Final Solution

27 http://numericalmethods.eng.usf.edu
Velocity at a Particular Point
a) Velocity at t=16

28 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
b) The quadratic spline valid at t=16 is
given by

29 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
c) Find the distance covered by the rocket from t=11s to
t=16s.

30 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/spline_met
hod.html
THE END

http://numericalmethods.eng.usf.edu
Linear Regression

Major: All Engineering Majors

Authors: Autar Kaw, Luke Snyder

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

7/17/2017 http://numericalmethods.eng.usf.edu 1
Linear Regression

http://numericalmethods.eng.usf.edu
What is Regression?
What is regression? Given n data points ( x1 , y1 ), ( x2 , y2 ),......, ( xn , yn )
best fity = f (x) to the data.

Ei is= yi − f ( xi )
Residual at each point

y
( xn , y n )
( xi , yi )
Ei = yi − f ( xi )
y = f (x)

( x1 , y1 )
x

Figure. Basic model for regression

http://numericalmethods.eng.usf.edu 3
Linear Regression-Criterion#1
Given n data points ( x1 , y1 ), ( x2 , y2 ),......, ( xn , yn ) best fit y = a 0 + a1 x to the data.
n
Does minimizing∑ Ei work as a criterion?
i =1

( xi , yi )

Ei = yi − a0 − a1 xi ( xn , y n )

( x2 , y 2 )
( x3 , y3 )

y = a0 + a1 x
( x1 , y1 )

x
Figure. Linear regression of y vs x data showing residuals at a typical point, xi .

http://numericalmethods.eng.usf.edu 4
Example for Criterion#1
Example: Given the data points (2,4), (3,6), (2,6) and (3,8), best fit
the data to a straight line using Criterion#1
n
Minimize ∑ Ei
i =1
Table. Data Points 10

8
x y
2.0 4.0 6
y

3.0 6.0 4

2.0 6.0 2

3.0 8.0 0
0 1 2 3 4

Figure. Data points for y vs x data.


http://numericalmethods.eng.usf.edu 5
Linear Regression-Criteria#1

Using y=4x − 4 as the regression curve


Table. Residuals at each point
for regression model y=4x − 4 10

8
x y ypredicted E = y - ypredicted
6
2.0 4.0 4.0 0.0
y 4
3.0 6.0 8.0 -2.0
2
2.0 6.0 4.0 2.0
0
3.0 8.0 8.0 0.0 0 1 2 3 4
4
x
∑ Ei = 0
i =1

Figure. Regression curve y=4x − 4 and y vs x data

http://numericalmethods.eng.usf.edu 6
Linear Regression-Criterion#1
Using y=6 as a regression curve
Table. Residuals at each point
for regression model y=6 10
x y ypredicted E = y - ypredicted 8
2.0 4.0 6.0 -2.0 6
3.0 6.0 6.0 0.0
y
4
2.0 6.0 6.0 0.0 2
3.0 8.0 6.0 2.0 0
4 0 1 2 3 4
∑ Ei = 0
i =1
x

Figure. Regression curve y=6 and y vs x data

http://numericalmethods.eng.usf.edu 7
Linear Regression – Criterion #1
4
∑ Ei = 0 for both regression models of y=4x-4 and y=6
i =1

The sum of the residuals is minimized, in this case it is zero,


but the regression model is not unique.
Hence the criterion of minimizing the sum of the residuals is a
bad criterion.
10

6
y

0
0 1 2 3 4

http://numericalmethods.eng.usf.edu 8
Linear Regression-Criterion#1

Using y=4x − 4 as the regression curve


Table. Residuals at each point
for regression model y=4x − 4 10

8
x y ypredicted E = y - ypredicted
6
2.0 4.0 4.0 0.0
y 4
3.0 6.0 8.0 -2.0
2
2.0 6.0 4.0 2.0
0
3.0 8.0 8.0 0.0 0 1 2 3 4
4
x
∑ Ei = 0
i =1

Figure. Regression curve y=4x-4 and y vs x data

http://numericalmethods.eng.usf.edu 9
Linear Regression-Criterion#2
n
Will minimizing∑ | Ei | work any better?
i =1

( xi , yi )

Ei = yi − a0 − a1 xi ( xn , y n )

( x2 , y 2 )
( x3 , y3 )

y = a0 + a1 x
( x1 , y1 )

x
Figure. Linear regression of y vs. x data showing residuals at a typical point, xi .

http://numericalmethods.eng.usf.edu 10
Example for Criterion#2
Example: Given the data points (2,4), (3,6), (2,6) and (3,8), best fit
n
the data to a straight line using Criterion#2
Minimize ∑ | Ei |
i =1
Table. Data Points 10

8
x y
6
2.0 4.0
y

4
3.0 6.0
2
2.0 6.0
0
3.0 8.0 0 1 2 3 4

Figure. Data points for y vs. x data.


http://numericalmethods.eng.usf.edu 11
Linear Regression-Criterion#2

Using y=4x − 4 as the regression curve


Table. Residuals at each point
for regression model y=4x − 4
10
x y ypredicted E = y - ypredicted
8
2.0 4.0 4.0 0.0
6
3.0 6.0 8.0 -2.0 y
4
2.0 6.0 4.0 2.0
2
3.0 8.0 8.0 0.0
0
4 0 1 2 3 4
∑ | Ei | = 4
i =1 x

Figure. Regression curve y= y=4x − 4 and y vs. x


data

http://numericalmethods.eng.usf.edu 12
Linear Regression-Criterion#2
Using y=6 as a regression curve
Table. Residuals at each point
for regression model y=6 10
x y ypredicted E = y - ypredicted 8
2.0 4.0 6.0 -2.0 6
3.0 6.0 6.0 0.0
y
4
2.0 6.0 6.0 0.0 2
3.0 8.0 6.0 2.0 0
4 0 1 2 3 4
∑ | Ei | = 4
i =1
x

Figure. Regression curve y=6 and y vs x data

http://numericalmethods.eng.usf.edu 13
Linear Regression-Criterion#2
4
∑ Ei = 4 for both regression models of y=4x − 4 and y=6.
i =1

The sum of the absolute residuals has been made as small as


possible, that is 4, but the regression model is not unique.
Hence the criterion of minimizing the sum of the absolute value
of the residuals is also a bad criterion.

http://numericalmethods.eng.usf.edu 14
Least Squares Criterion
The least squares criterion minimizes the sum of the square of the
residuals in the model, and also produces a unique line.
n n 2
S r = ∑ Ei = ∑ ( yi − a0 − a1 xi )
2

i =1 i =1

xi , yi

Ei = yi − a0 − a1 xi xn , y n

x2 , y 2
x ,y
3 3

y = a0 + a1 x
x1 , y1

Figure. Linear regression of y vs x data showing residuals at a typical point, xi .

http://numericalmethods.eng.usf.edu 15
Finding Constants of Linear Model
n n 2
Minimize the sum of the square of the residuals: S r = ∑ Ei = ∑ ( yi − a0 − a1 xi )
2

i =1 i =1
To find a 0 and a1 we minimize Sr with respect to a1 and a 0 .
∂S r n
= −2∑ ( y i − a 0 − a1 xi )(− 1) = 0
∂a 0 i =1

∂S r n
= −2∑ ( y i − a 0 − a1 xi )(− xi ) = 0
∂a1 i =1

giving
n n n

∑a + ∑a x = ∑ y
i =1
0
i =1
1 i
i =1
i

n n n

∑a x + ∑a x = ∑ yi xi
2
0 i 1 i
i =1 i =1 i =1

16 http://numericalmethods.eng.usf.edu
Finding Constants of Linear Model
Solving for a 0 and a1 directly yields,
n n n
n∑ x i y i −∑ x i ∑ y i
i =1 i =1 i =1
a1 = 2
2  
n n
n∑ x i − ∑ x i 
i =1  i =1 
and
n n n n

∑x ∑y −∑x ∑x y
2
i i i i i
a0 = i =1 i =1 i =1 i =1 a 0 = y − a1 x
2
n
 n 
n∑ x − ∑ x i 
2
i
i =1  i =1 

17 http://numericalmethods.eng.usf.edu
Example 1
The torque, T needed to turn the torsion spring of a mousetrap through
an angle, is given below. Find the constants for the model given by
T = k 1 + k 2θ

Table: Torque vs Angle for a


0.4
torsional spring

Angle, θ Torque, T
Torque (N-m)

0.3

Radians N-m
0.2
0.698132 0.188224
0.959931 0.209138
1.134464 0.230052 0.1
0.5 1 1.5 2
1.570796 0.250965 θ (radians)
1.919862 0.313707
Figure. Data points for Torque vs Angle data

18 http://numericalmethods.eng.usf.edu
Example 1 cont.
The following table shows the summations needed for the calculations of
the constants in the regression model.
Table. Tabulation of data for calculation of important
summations
Using equations described for
θ T θ2 Tθ
a 0 and a1 with n = 5
Radians N-m Radians2 N-m-Radians 5 5 5
0.698132 0.188224 0.487388 0.131405 n ∑ θ i Ti −∑ θ i ∑ Ti
0.959931 0.209138 0.921468 0.200758 k2 = i =1 i =1 i =1
2
2  
5 5
1.134464 0.230052 1.2870 0.260986
n ∑ θ i − ∑ θ i 
1.570796 0.250965 2.4674 0.394215 i =1  i =1 
5(1.5896) − (6.2831)(1.1921)
1.919862 0.313707 3.6859 0.602274
5
=
∑=
i =1
6.2831 1.1921 8.8491 1.5896 5(8.8491) − (6.2831)
2

= 9.6091×10 −2 N-m/rad

19 http://numericalmethods.eng.usf.edu
Example 1 cont.
Use the average torque and average angle to calculate k1
5 5

_ ∑T i _ ∑θ i
T= i =1
θ= i =1
n n
1.1921 6.2831
= =
5 5
= 2.3842 × 10 −1 = 1.2566

Using,
_ _
k1 = T − k 2 θ
= 2.3842 × 10 −1 − (9.6091 × 10 −2 )(1.2566)
= 1.1767 × 10 −1 N-m

20 http://numericalmethods.eng.usf.edu
Example 1 Results
Using linear regression, a trend line is found from the data

Figure. Linear regression of Torque versus Angle data

Can you find the energy in the spring if it is twisted from 0 to 180 degrees?
21 http://numericalmethods.eng.usf.edu
Linear Regression (special case)

Given

( x1 , y1 ), ( x 2 , y 2 ), ... , ( xn, yn)

best fit

y = a1 x

to the data.

22 http://numericalmethods.eng.usf.edu
Linear Regression (special case cont.)
y = a1 x
n n n
n∑ x i y i −∑ x i ∑ y i
i =1 i =1 i =1
a1 = 2
n
 n
n∑ x i2 − ∑ x i 
i =1  i =1 

Is this correct?

23 http://numericalmethods.eng.usf.edu
Linear Regression (special case cont.)

y
xi , yi

ε i = yi − a1 xi xn , y n

xi , a1 xi

x1 , y1

24 http://numericalmethods.eng.usf.edu
Linear Regression (special case cont.)

Residual at each data point

ε i = yi − a1 xi
Sum of square of residuals
n
Sr = ∑ ε i
2

i =1

n 2

= ∑ ( yi − a1 xi )
i =1

25 http://numericalmethods.eng.usf.edu
Linear Regression (special case cont.)
Differentiate with respect to a1
dS r n
= ∑ 2( y i − a1 xi )(− xi )
da1 i =1

( )
n
= ∑ − 2 yi xi + 2a1 xi
2

i =1

dS r
=0
da1
gives
n

∑x y i i
a1 = i =1
n

∑ i
x 2

i =1
26 http://numericalmethods.eng.usf.edu
Linear Regression (special case cont.)
Does this value of a1 correspond to a local minima or local
maxima? n

∑x y i i
a1 = i =1
n

∑ i
x 2

i =1

dS r
( )
n
= ∑ − 2 y i xi + 2a1 xi
2

da1 i =1
d 2Sr n
= ∑ 2 xi > 0
2
2
da1 i =1

Yes, it corresponds to a local minima.


n

∑x y i i
a1 = i =1
n

∑x
i =1
2
i

27 http://numericalmethods.eng.usf.edu
Linear Regression (special case cont.)
Is this local minima of Sr an absolute minimum of S r?
Sr

a1

28 http://numericalmethods.eng.usf.edu
Example 2
To find the longitudinal modulus of composite, the following data is
collected. Find the longitudinal modulus, E using the regression model
Table. Stress vs. Strain data σ = Eε and the sum of the square of the
Strain Stress
(%) (MPa)
residuals.
0 0 3.0E+09
0.183 306
0.36 612 Stress, σ (Pa)
2.0E+09
0.5324 917
0.702 1223
0.867 1529 1.0E+09
1.0244 1835
1.1774 2140
0.0E+00
1.329 2446
0 0.005 0.01 0.015 0.02
1.479 2752
Strain, ε (m/m)
1.5 2767
1.56 2896 Figure. Data points for Stress vs. Strain data
29 http://numericalmethods.eng.usf.edu
Example 2 cont.
n
Table. Summation data for regression model ∑σ ε i i

i ε σ ε2 εσ E= i =1
n

∑ε
2
1 0.0000 0.0000 0.0000 0.0000 i
2 1.8300×10−3 3.0600×108 3.3489×10−6 5.5998×105 i =1
12
3
4
3.6000×10−3
5.3240×10−3
6.1200×108
9.1700×108
1.2960×10−5
2.8345×10−5
2.2032×106
4.8821×106
∑ε
i =1
i
2
= 1.2764 × 10 −3
5 7.0200×10−3 1.2230×109 4.9280×10−5 8.5855×106 12

6 8.6700×10−3 1.5290×109 7.5169×10−5 1.3256×107 ∑σ ε


i =1
i i = 2.3337 × 10 8
7 1.0244×10−2 1.8350×109 1.0494×10−4 1.8798×107 12
8 1.1774×10−2 2.1400×109 1.3863×10−4 2.5196×107
∑σ ε i i
9 1.3290×10−2 2.4460×109 1.7662×10−4 3.2507×107 E= i =1
12
10
11
1.4790×10−2
1.5000×10−2
2.7520×109
2.7670×109
2.1874×10−4
2.2500×10−4
4.0702×107
4.1505×107
∑ε i =1
i
2

12 1.5600×10−2 2.8960×109 2.4336×10−4 4.5178×107 2.3337 ×108


12 =
1.2764 ×10 −3
∑ 1.2764×10−3 2.3337×108
i =1 = 182.84 GPa

30 http://numericalmethods.eng.usf.edu
Example 2 Results
The equation σ = 182.84 × 10 9 ε describes the data.

Figure. Linear regression for stress vs. strain data

31 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/linear_regr
ession.html
THE END

http://numericalmethods.eng.usf.edu
Adequacy of Linear
Regression Models

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

3/25/2015 http://numericalmethods.eng.usf.edu 1
Data
y vs x
6.5

5.5

4.5
y

3.5

2.5

2
-350 -300 -250 -200 -150 -100 -50 0 50 100

x
Is this adequate?
y vs x
7

6.5

5.5

5
y

4.5

3.5

2.5

2
-350 -300 -250 -200 -150 -100 -50 0 50 100

x
Straight Line Model
Quality of Fitted Data
• Does the model describe the data
adequately?

• How well does the model predict the


response variable predictably?
Linear Regression Models
• Limit our discussion to adequacy of
straight-line regression models
Four checks
1. Plot the data and the model.
2. Find standard error of estimate.
3. Calculate the coefficient of
determination.
4. Check if the model meets the
assumption of random errors.
Example: Check the adequacy of the
straight line model for given data
T α
(F) (μin/in/F)

α = a0 + a1T
-340 2.45
-260 3.58
-180 4.52
-100 5.28
-20 5.86
60 6.36
END
1. Plot the data and the model
Data and model
α (T ) = 6.0325 + 0.0096964T
T α 7

6.5
(F) (μin/in/F) 6

-340 2.45 5.5

-260 3.58 α 5

4.5
-180 4.52 4

-100 5.28 3.5

3
-20 5.86
2.5
60 6.36 2
-350 -300 -250 -200 -150 -100 -50 0 50 100

T
END
2. Find the standard error of estimate
Standard error of estimate

Sr
sα / T =
n−2
n
S r = ∑ (α i − a0 − a1Ti ) 2

i =1
Standard Error of Estimate
α (T ) = 6.0325 + 0.0096964T

Ti αi a 0 + a1Ti α i − a 0 − a1Ti

-340 2.45 2.7357 -0.28571


-260 3.58 3.5114 0.068571
-180 4.52 4.2871 0.23286
-100 5.28 5.0629 0.21714
-20 5.86 5.8386 0.021429
60 6.36 6.6143 -0.25429
Standard Error of Estimate

S r = 0.25283
Sr
sα / T =
n−2
0.25283
=
6−2
= 0.25141
Standard Error of Estimate
8

6
α

2
-350 -300 -250 -200 -150 -100 -50 0 50 100

T
α i − a0 − a1Ti
Scaled Residual =
sα / T
Scaled Residuals
Residual
Scaled Residual =
Standard Error of Estimate

α i − a0 − a1Ti
Scaled Residual =
sα / T

95% of the scaled residuals need


to be in [-2,2]
Scaled Residuals
sα / T = 0.25141

Scaled
Ti αi Residual
Residual
-340 2.45 -0.28571 -1.1364
-260 3.58 0.068571 0.27275
-180 4.52 0.23286 0.92622
-100 5.28 0.21714 0.86369
-20 5.86 0.021429 0.085235
60 6.36 -0.25429 -1.0115
END
3. Find the coefficient of
determination
Coefficient of determination
n
S t = ∑ (α i − α )
2

i =1
n
S r = ∑ (α i − a0 − a1Ti )
2

i =1

St − S r
r = 2

St
Sum of square of residuals between
data and mean
n
S t = ∑ ( yi − y )
2

i =1

( xn , y n )

( xi , y i )
y

_
y−y _
y=y
(x2 , y 2 )
( x3 , y 3 )
(x1 , y1 )

x
Sum of square of residuals between
observed and predicted
n
S r = ∑ ( yi − a0 − a1 xi )
2

i =1

( xn , y n )
( xi , y i )
y

Ei = yi − a0 − a1 xi

(x2 , y 2 )

( x3 , y 3 )

(x1 , y1 )
x
Limits of Coefficient of
Determination
St − S r
r =
2

St

0 ≤ r ≤1
2
Calculation of St

Ti αi αi − α
-340 2.45 -2.2250 α = 4.6750
-260 3.58 -1.0950
-180 4.52 0.15500
S t = 10.783
-100 5.28 0.60500
-20 5.86 1.1850
60 6.36 1.6850
Calculation of Sr

Ti αi a 0 + a1Ti α i − a 0 − a1Ti
-340 2.45 2.7357 -0.28571
-260 3.58 3.5114 0.068571
-180 4.52 4.2871 0.23286
-100 5.28 5.0629 0.21714
-20 5.86 5.8386 0.021429
60 6.36 6.6143 -0.25429
S r = 0.25283
Coefficient of determination
St − Sr
r =
2

St
10.783 − 0.25283
=
10.783
= 0.97655
Correlation coefficient
St − Sr
r=
St
= 0.98820

How do you know if r is positive or negative ?


What does a particular value
of |r| mean?
0.8 to 1.0 - Very strong relationship
0.6 to 0.8 - Strong relationship
0.4 to 0.6 - Moderate relationship
0.2 to 0.4 - Weak relationship
0.0 to 0.2 - Weak or no relationship
Caution in use of r2
• Increase in spread of regressor variable
(x) in y vs. x increases r2
• Large regression slope artificially yields
high r2
• Large r2 does not measure
appropriateness of the linear model
• Large r2 does not imply regression model
will predict accurately
Final Exam Grade
Final Exam Grades

100

90

80
Final Exam Grade

70

60

50

40
0 10 20 30 40 50 60
Student No
Final Exam Grade vs Pre-Req
GPA
y = 9.8669x + 41.75
R² = 0.2227
100 R=0.4719

90

80
FInal Exam Scores

70

60

50

40
1 1.5 2 2.5 3 3.5 4 4.5 5

Pre-Requisite GPA
END
4. Model meets assumption of random
errors
Model meets assumption of random
errors
• Residuals are negative as well as
positive
• Variation of residuals as a function of the
independent variable is random
• Residuals follow a normal distribution
• There is no autocorrelation between the
data points.
Therm exp coeff vs temperature
T α T α T α
60 6.36 -100 5.28 -280 3.33
40 6.24 -120 5.09 -300 3.07
20 6.12 -140 4.91 -320 2.76
0 6.00 -160 4.72 -340 2.45
-20 5.86 -180 4.52
-40 5.72 -200 4.30
-60 5.58 -220 4.08
-80 5.43 -240 3.83
Data and model
α = 6.0248 + 0.0093868T
7

6.5

5.5

5
α

4.5

3.5

2.5

2
-350 -300 -250 -200 -150 -100 -50 0 50 100

T
Plot of Residuals
0.3

0.2

0.1
Residual

-0.1

-0.2

-0.3

-0.4
-350 -300 -250 -200 -150 -100 -50 0 50 100

T
Histograms of Residuals
Check for Autocorrelation
• Find the number of times, q the sign of the
residual changes for the n data points.
• If (n-1)/2-√(n-1) ≤q≤ (n-1)/2+√(n-1), you
most likely do not have an autocorrelation.
( 22 − 1) 22 − 1
− 22 − 1 ≤ q ≤ + 22 − 1
2 2
5.9174 ≤ q ≤ 15.083
Is there autocorrelation?
0.3

0.2

0.1
Residual

-0.1
5.9174 ≤ q ≤ 15.083

-0.2

-0.3

-0.4
-350 -300 -250 -200 -150 -100 -50 0 50 100

T
y vs x fit and residuals

n=40
(n-1)/2-√(n-1) ≤p≤ (n-1)/2+√(n-1)
Is 13.3≤21≤ 25.7? Yes!
y vs x fit and residuals

n=40
(n-1)/2-√(n-1) ≤p≤ (n-1)/2+√(n-1)
Is 13.3≤2≤ 25.7? No!
END
What polynomial model to choose
if one needs to be chosen?
First Order of Polynomial
-6 Polynomial Regression of order 1
x 10
7

6.5

6
y = a +a *x+a *x 2+.....+a *x m

5.5
m

4.5
2

4
1
0

3.5

2.5

2
-350 -300 -250 -200 -150 -100 -50 0 50 100
Second Order Polynomial
-6 Polynomial Regression of order 2
x 10
7

6.5

6
y = a +a *x+a *x 2+.....+a *x m

5.5
m

4.5
2

4
1
0

3.5

2.5

2
-350 -300 -250 -200 -150 -100 -50 0 50 100
x
Which model to choose?
y vs x
7

6.5

5.5

5
y

4.5

3.5

2.5

2
-350 -300 -250 -200 -150 -100 -50 0 50 100

x
-14
Optimum Polynomial
x 10 Optimum Order of Polynomial

4
Sr÷[n-(m+1)]

0
0 1 2 3 4 5 6
Order of Polynomial, m
THE END
Effect of an Outlier
Effect of Outlier

25

y = 2x
20
R2 = 1
15

10

0
0 2 4 6 8 10 12
Effect of Outlier

60

50 y = 3.2727x - 5.0909
R2 = 0.6879
40

30

20

10

0
0 2 4 6 8 10 12
-10
Nonlinear Regression

Major: All Engineering Majors

Authors: Autar Kaw, Luke Snyder

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

3/19/2015 http://numericalmethods.eng.usf.edu 1
Nonlinear Regression

http://numericalmethods.eng.usf.edu
Nonlinear Regression
Some popular nonlinear regression models:

1. Exponential model: ( y = aebx )


2. Power model: ( y = ax b )
 ax 
3. Saturation growth model:  y = 
 b + x 
4. Polynomial model: ( y = a 0 + a1 x + ... + amx m )

3 http://numericalmethods.eng.usf.edu
Nonlinear Regression
Given n data points ( x1, y1), ( x 2, y 2), ... , ( xn, yn ) best fit y = f (x)
to the data, where f (x) is a nonlinear function of x .

( xn , y n )

( x2 , y 2 )
y = f (x)
( xi , yi )
y − f (x )
i i
( x1 , y1 )

Figure. Nonlinear regression model for discrete y vs. x data

4 http://numericalmethods.eng.usf.edu
Regression
Exponential Model

5 http://numericalmethods.eng.usf.edu
Exponential Model
Given ( x1 , y1 ), ( x 2 , y 2 ), ... , ( x n , y n ) best fit y = ae to the data.
bx

( x1 , y1 )
y = aebx

yi − aebxi
(x , y )
i i

( x2 , y 2 )
( xn , y n )

Figure. Exponential model of nonlinear regression for y vs. x data

6 http://numericalmethods.eng.usf.edu
Finding Constants of Exponential Model
The sum of the square of the residuals is defined as

( )
n
Sr = ∑ yi − ae
bx 2
i

i =1
Differentiate with respect to a and b

∂S r
( )( )
n
= ∑ 2 y i − ae bxi − e bxi = 0
∂a i =1

∂S r
( )( )
n
= ∑ 2 y i − ae bxi
− axi e = 0
bxi

∂b i =1

7 http://numericalmethods.eng.usf.edu
Finding Constants of Exponential Model
Rewriting the equations, we obtain

n n
− ∑ yi e bxi
+ a∑e 2bxi
=0
i =1 i =1

n n
∑ y i xi e
bxi
− a ∑ xi e 2bxi
=0
i =1 i =1

8 http://numericalmethods.eng.usf.edu
Finding constants of Exponential Model
Solving the first equation for a yields
n
bxi
∑ yi e
i =1
a= n
2bxi
∑ e
i =1

Substituting a back into the previous equation


n
bxi
n
∑ yi e n
i =1
∑ y i xi e
bxi
− n
∑ i
x e 2bxi
=0
i =1 2bxi i =1
∑ e
i =1
The constant b can be found through numerical
methods such as bisection method.
9 http://numericalmethods.eng.usf.edu
Example 1-Exponential Model
Many patients get concerned when a test involves injection of a
radioactive material. For example for scanning a gallbladder, a
few drops of Technetium-99m isotope is used. Half of the
Technetium-99m would be gone in about 6 hours. It, however,
takes about 24 hours for the radiation levels to reach what we
are exposed to in day-to-day activities. Below is given the
relative intensity of radiation as a function of time.

Table. Relative intensity of radiation as a function of time.

t(hrs) 0 1 3 5 7 9
γ 1.000 0.891 0.708 0.562 0.447 0.355

10 http://numericalmethods.eng.usf.edu
Example 1-Exponential Model cont.
The relative intensity is related to time by the equation
λt
γ = Ae
Find:
a) The value of the regression constants A and λ
b) The half-life of Technetium-99m
c) Radiation intensity after 24 hours

11 http://numericalmethods.eng.usf.edu
Plot of data

12 http://numericalmethods.eng.usf.edu
Constants of the Model
γ = Ae λt

The value of λ is found by solving the nonlinear equation


n
λti
n
γ
∑ i e n
f (λ ) = ∑ γ i t i e λti
− i =1
n
∑ i
t e 2λti
=0
i =1 2λti i =1
∑ e
i =1
n

∑ i
γ e λt i

A= i =1
n

∑ e 2 λt i

i =1
13 http://numericalmethods.eng.usf.edu
Setting up the Equation in MATLAB
n
λti
n
∑γ ie n
f (λ ) = ∑ γ i t i e λti
− i =1
n
∑ ti e
2λti
=0
i =1 2λti i =1
∑e
i =1

t (hrs) 0 1 3 5 7 9
γ 1.000 0.891 0.708 0.562 0.447 0.355
14 http://numericalmethods.eng.usf.edu
Setting up the Equation in MATLAB
n
λti
n
∑γ ie n
f (λ ) = ∑ γ i t i e λti
− i =1
n
∑ i
t e 2λti
=0
i =1 2λti i =1
∑e
i =1

λ = −0.1151
t=[0 1 3 5 7 9]
gamma=[1 0.891 0.708 0.562 0.447 0.355]
syms lamda
sum1=sum(gamma.*t.*exp(lamda*t));
sum2=sum(gamma.*exp(lamda*t));
sum3=sum(exp(2*lamda*t));
sum4=sum(t.*exp(2*lamda*t));
f=sum1-sum2/sum3*sum4;
15 http://numericalmethods.eng.usf.edu
Calculating the Other Constant
The value of A can now be calculated
6

∑γ e i
λti

A= i =1
6 = 0.9998
∑ e 2 λti

i =1

The exponential regression model then is

γ = 0.9998 e −0.1151t

16 http://numericalmethods.eng.usf.edu
Plot of data and regression curve

γ = 0.9998 e −0.1151t

17 http://numericalmethods.eng.usf.edu
Relative Intensity After 24 hrs
The relative intensity of radiation after 24 hours
−0.1151( 24 )
γ = 0.9998 × e
−2
= 6.3160 × 10
This result implies that only

6.316 × 10−2
× 100 = 6.317%
0.9998
radioactive intensity is left after 24 hours.
18 http://numericalmethods.eng.usf.edu
Homework
• What is the half-life of Technetium-99m
isotope?
• Write a program in the language of your
choice to find the constants of the
model.
• Compare the constants of this regression
model with the one where the data is
transformed.
λt
• What if the model was γ = e ?

19 http://numericalmethods.eng.usf.edu
THE END

http://numericalmethods.eng.usf.edu
20 http://numericalmethods.eng.usf.edu
Polynomial Model
best fit y = a0 + a1 x + ... + am x
m
Given ( x1, y1), ( x 2, y 2), ... , ( xn, yn)
(m ≤ n − 2) to a given data set.

( xn , y n )

( x2 , y 2 )

( xi , yi ) y = a + a x +  + am x m
0 1
yi − f ( xi )
( x1 , y1 )

Figure. Polynomial model for nonlinear regression of y vs. x data

21 http://numericalmethods.eng.usf.edu
Polynomial Model cont.
The residual at each data point is given by
Ei = y i − a 0 − a1 xi − . . . − a m xim
The sum of the square of the residuals then is
n
S r = ∑ Ei2
i =1

( )
n
= ∑ y i − a 0 − a1 xi − . . . − a m xim
2

i =1

22 http://numericalmethods.eng.usf.edu
Polynomial Model cont.
To find the constants of the polynomial model, we set the derivatives
with respect to ai where i = 1, m, equal to zero.
∂S r
( )
n
= ∑ 2. yi − a0 − a1 xi − . . . − am xim (−1) = 0
∂a0 i =1
∂S r
( )
n
= ∑ 2. yi − a0 − a1 xi − . . . − am xim (− xi ) = 0
∂a1 i =1

   
∂S r
( )
n
= ∑ 2. yi − a0 − a1 xi − . . . − am xim (− xim ) = 0
∂am i =1

23 http://numericalmethods.eng.usf.edu
Polynomial Model cont.
These equations in matrix form are given by
   
   n 
 n  n   n m 
 ∑ xi  . ∑ xi  a
  ∑ yi
. .  
  i =1   i =1    0 
   ni =1
 n
  ∑ xi   n 2  n m+1  a1 
 ∑ xi  . . . ∑ xi   =  ∑x y 
  i =1   . . .  i =1
i i
 i =1   i =1 
. . . . . . . . . . .  a  . . . 
  m   
 n m   n m+1   
n
∑ xim yi
n

 ∑ xi   ∑ xi  . . . ∑ xi2 m  
 i =1 
 i =1   i =1   i =1 

The above equations are then solved for a0 , a1 ,  , am

24 http://numericalmethods.eng.usf.edu
Example 2-Polynomial Model
Regress the thermal expansion coefficient vs. temperature data to
a second order polynomial.

Table. Data points for


temperature vs α
7.00E-06

Thermal expansion coefficient, α


Temperature, T Coefficient of 6.00E-06
(oF) thermal
expansion, α 5.00E-06
(in/in/oF)
80 6.47×10−6 (in/in/o F) 4.00E-06

40 6.24×10−6
3.00E-06
−40 5.72×10−6
−120 5.09×10−6 2.00E-06

−200 4.30×10−6 1.00E-06


−280 3.33×10−6 -400 -300 -200 -100 0 100 200

−340 2.45×10−6 Temperature, o F

Figure. Data points for thermal expansion coefficient vs


temperature.
25 http://numericalmethods.eng.usf.edu
Example 2-Polynomial Model cont.
We are to fit the data to the polynomial regression model
α = a0 + a1T + a 2T 2
The coefficients a0 ,a1 , a2 are found by differentiating the sum of the
square of the residuals with respect to each variable and setting the
values equal to zero to obtain

  n   n 2   n 
 n  ∑ Ti   ∑ Ti    ∑ αi 
  i =1   i =1   a   i =1 
0
 n   n 2  n 3     n 
 ∑ i 
 T  ∑ Ti   ∑ Ti   a1  = ∑ Ti α i

 i =n1   i =1   i =1      i =1
 n 
 n 4    2   T 2α
a
 T 2   n 3
 ∑ i  ∑ Ti   ∑ Ti  


∑ i i 

 i =1   i =1   i =1   i =1

26 http://numericalmethods.eng.usf.edu
Example 2-Polynomial Model cont.
The necessary summations are as follows
7
α
Table. Data points for temperature vs.
Temperature, T Coefficient of
∑T
i =1
i
2
=2.5580 ×105
(oF) thermal expansion,
7

∑T
α (in/in/oF)
i
3
= − 7.0472 × 10 7
80 6.47×10−6
i =1
40 6.24×10−6 7
−40 5.72×10−6 ∑T
i =1
i
4
= 2.1363 ×1010
−120 5.09×10−6
7

∑α
−200 4.30×10−6
i = 3.3600 × 10 −5
−280 3.33×10−6
i =1
−340 2.45×10−6 7

∑T α
i =1
i i = − 2.6978 × 10 −3
7

∑T
i =1
i
2
α i =8.5013 × 10 −1

27 http://numericalmethods.eng.usf.edu
Example 2-Polynomial Model cont.
Using these summations, we can now calculate a0 ,a1 , a2
 7.0000 − 8.6000 × 10 2 2.5800 × 10 5  a 0   3.3600 × 10 −5 
   
 − 8. 600 × 10 2
2.5800 × 10 5 − 7.0472 × 10 7   a1  = − 2.6978 × 10 −3 
 2.5800 × 10 5
 − 7.0472 × 10 7 2.1363 × 1010  a 2   8.5013 × 10 −1 
Solving the above system of simultaneous linear equations we have
a 0   6.0217 × 10 
−6

 a  =  6.2782 × 10 −9 
 1  
a 2  − 1.2218 × 10 
−11

The polynomial regression model is then


α = a 0 + a1T + a 2T 2
= 6.0217 × 10 −6 + 6.2782 × 10 −9 T − 1.2218 × 10 −11 T 2

28 http://numericalmethods.eng.usf.edu
Transformation of Data
To find the constants of many nonlinear models, it results in solving
simultaneous nonlinear equations. For mathematical convenience,
some of the data for such models can be transformed. For example,
the data for an exponential model can be transformed.
As shown in the previous example, many chemical and physical processes
are governed by the equation,
y = aebx
Taking the natural log of both sides yields,
ln y = ln a + bx
Let z = ln y and a 0 = ln a
We now have a linear regression model where z = a 0 + a1 x
(implying) a = e ao with a1 = b

29 http://numericalmethods.eng.usf.edu
Transformation of data cont.
Using linear model regression methods,
n n n
n∑ xi z i − ∑ xi ∑ z i
a1 = i =1 i =1 i =1
2
n
  n
n∑ xi2 −  ∑ xi 
i =1  i =1 
_ _
a 0 = z − a1 x
Once ao , a1 are found, the original constants of the model are found as
b = a1
a = e a0

30 http://numericalmethods.eng.usf.edu
THE END

http://numericalmethods.eng.usf.edu
31 http://numericalmethods.eng.usf.edu
Example 3-Transformation of
data
Many patients get concerned when a test involves injection of a radioactive
material. For example for scanning a gallbladder, a few drops of Technetium-
99m isotope is used. Half of the Technetium-99m would be gone in about 6
hours. It, however, takes about 24 hours for the radiation levels to reach what
we are exposed to in day-to-day activities. Below is given the relative intensity
of radiation as a function of time.
1
Table. Relative intensity of radiation as a function

Relative intensity of radiation, γ


of time
t(hrs) 0 1 3 5 7 9
γ 1.000 0.891 0.708 0.562 0.447 0.355 0.5

0
0 5 10
Time t, (hours)

Figure. Data points of relative radiation intensity


vs. time
32 http://numericalmethods.eng.usf.edu
Example 3-Transformation of data
cont.
Find:
a) The value of the regression constants A and λ
b) The half-life of Technetium-99m
c) Radiation intensity after 24 hours
The relative intensity is related to time by the equation
γ = Ae λt

33 http://numericalmethods.eng.usf.edu
Example 3-Transformation of data
cont.
Exponential model given as,
γ = Ae λt
ln (γ ) = ln( A) + λt
Assuming z = ln γ , ao = ln ( A) and a1 = λ we obtain
z =a +at
0 1
This is a linear relationship between z and t

34 http://numericalmethods.eng.usf.edu
Example 3-Transformation of data cont.
Using this linear relationship, we can calculate a0 , a1 where
n n n
n ∑ ti zi − ∑ ti ∑ zi
a1 = i =1 i =1 i =1
2
n
 n
n ∑ t 2 −  ∑ ti 
i =1
1
 i =1 
and
a0 = z − a1t
λ = a1
a
A=e 0

35 http://numericalmethods.eng.usf.edu
Example 3-Transformation of Data
cont.
Summations for data transformation are as follows

Table. Summation data for Transformation of data With n = 6


6

i ti γi
model
z = ln γ ti zi t 2 ∑t
i =1
i = 25.000
i i i
6

∑z
1 0 1 0.00000 0.0000 0.0000
2 1 0.891 −0.11541 −0.11541 1.0000 = −2.8778
i
3 3 0.708 −0.34531 −1.0359 9.0000 i =1
4 5 0.562 −0.57625 −2.8813 25.000 6
5
6
7
9
0.447
0.355
−0.80520
−1.0356
−5.6364
−9.3207
49.000
81.000 ∑t z
i =1
i i
= −18.990


6
−2.8778 −18.990
∑t
25.000 165.00
i
2
= 165.00
i =1

36 http://numericalmethods.eng.usf.edu
Example 3-Transformation of Data
cont.
Calculating a0 , a1
6(− 18.990) − (25)(− 2.8778)
a1 = = −0.11505
6(165.00) − (25)
2

− 2.8778
− (− 0.11505)
25 = −2.6150 × 10 −4
a0 =
6 6
Since
a0 = ln ( A)
A = e a0
− 2.6150×10−4
=e = 0.99974
also
λ = a1 = −0.11505

37 http://numericalmethods.eng.usf.edu
Example 3-Transformation of Data
cont.
Resulting model is γ = 0.99974 × e
−0.11505t

1
γ = 0.99974 × e −0.11505t

Relative
Intensity
0.5
of
Radiation,

0
0 5 10
Time, t (hrs)

Figure. Relative intensity of radiation as a function of


temperature using transformation of data model.

38 http://numericalmethods.eng.usf.edu
Example 3-Transformation of Data
cont.
The regression formula is then
γ = 0.99974 × e −0.11505t
1
b) Half life of Technetium-99m is when γ = γ
2 t =0

0.99974 × e −0 .11505t = (0.99974 )e −0 .11505(0 )


1
2
e −0 .11508t = 0.5
− 0.11505t = ln (0.5)
t = 6.0248 hours

39 http://numericalmethods.eng.usf.edu
Example 3-Transformation of Data
cont.
c) The relative intensity of radiation after 24 hours is then
γ = 0.99974e −0.11505(24 )
= 0.063200
6.3200 ×10 −2
This implies that only ×100 = 6.3216% of the radioactive
0.99983
material is left after 24 hours.

40 http://numericalmethods.eng.usf.edu
Comparison
Comparison of exponential model with and without data
Transformation:
Table. Comparison for exponential model with and without data
Transformation.
With data Without data
Transformation Transformation
(Example 3) (Example 1)
A 0.99974 0.99983
λ −0.11505 −0.11508
Half-Life (hrs) 6.0248 6.0232
Relative intensity
6.3200×10−2 6.3160×10−2
after 24 hrs.

41 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/nonlinear_r
egression.html
THE END

http://numericalmethods.eng.usf.edu

You might also like