Sie sind auf Seite 1von 5

NONLINEAR

Bisection Method
Example: f(x) = x^3+x^2-3x-3=0
starting values: a=1, b=2
tolerance: 0.0001
f(x) 1 1 -3 -3
ITERATION: x1 x2 f(x1) f(x3) f(x1)*f(x3) x3=(x1+x2)/2 F(x3)=tolerance
1 1.000000 2.000000 -4.000000 -1.875000 7.500000 1.500000 -1.875000
2 1.500000 2.000000 -1.875000 0.171875 -0.322266 1.750000 0.171875
3 1.500000 1.750000 -1.875000 -0.943359 1.768799 1.625000 -0.943359
4 1.625000 1.750000 -0.943359 -0.409424 0.386234 1.687500 -0.409424
5 1.687500 1.750000 -0.409424 -0.124786 0.051091 1.718750 -0.124786
6 1.718750 1.750000 -0.124786 0.022030 -0.002749 1.734375 0.022030
7 1.718750 1.734375 -0.124786 -0.051755 0.006458 1.726563 -0.051755
8 1.726563 1.734375 -0.051755 -0.014957 0.000774 1.730469 -0.014957
9 1.730469 1.734375 -0.014957 0.003513 -0.000053 1.732422 0.003513
10 1.730469 1.732422 -0.014957 -0.005728 0.000086 1.731445 -0.005728
11 1.731445 1.732422 -0.005728 -0.001109 0.000006 1.731934 -0.001109
12 1.731934 1.732422 -0.001109 0.001201 -0.000001 1.732178 0.001201
13 1.731934 1.732178 1.732056 0.000046

Algorithm:Set x3 = (x1+x2)/2, If f(x3)*f(x1) < 0 then x2 = x3. Otherwise, x1= x3.

Nonpolynomial: Newton's Method


f ( xn )
x n+1 =x n − , n=0,1,2 ,. . .
Ex. f(x)= 3x + sinx -e^x = 0 f ' ( x n)
find: the root of f(x)
f'(x) = 3 +cosx - e^x tolerance
x sinx cosx e^x f(xi) f'(xi)
x0= 0 0 1 1 -1 3
x1= 0.333333 0.3271947 0.9449569 1.39561243 -0.068417728 2.54934452123
x2= 0.360171 0.352434 0.9358367 1.43357412 -0.000627985 2.50226254781
x3= 0.360422 0.3526689 0.9357482 1.43393395 -5.62516E-08

Exercise: 1. Use bisection method to find a root of f(x)=x^3 -3x^2-6x+8=0 near x=3.5
2. Use Newton's method to finf the root of f(x) = e^x -4x^2, near x= 0.7.

Interpolation: Divided difference


Example:
xi f(xi)=fi[0] fi[1] fi[2] fi[3] fi[4]
3.200 22.000
2.700 17.800 8.400
1.000 14.200 2.118 2.856
4.800 38.300 6.342 2.012 -0.527
5.600 51.700 16.750 2.263 0.087 0.256

Pn (x )=f [0 ] +( x−x 0 )f [1 ]+( x−x 0 )( x−x 1 ) f [2 ]+.. .+(x −x 0 )( x− x1 ).. .( x−x n−1 )f [ n]
0 0 0 0
Pn (x )=f [0 ] +( x−x 0 )f [1 ]+( x−x 0 )( x−x 1 ) f [2 ]+.. .+(x −x 0 )( x− x1 ).. .( x−x n−1 )f [ n]
0 0 0 0

P4(x)= 22.000+8.4(x-3.2)+2.856(x-3.2)(x-2.7)-0.527(x-3.2)(x-2.7)(x-1)+0.256(x-3.2)(x-2.7)(x-1)(x-4.8)

Least Squares Approximation: y = ax + b

a∑ x 2 + b ∑ xi = ∑ xi Y i
i

a ∑ xi + bN = ∑ Yi
Example:
x=T,0C y=R,ohm
s
20.5 765
32.7 826
51 873
73.2 942
95.7 1032
N=5
∑ xi 273.1 ∑ xi Y i 254932.5

∑ x i2 18607.27
∑ Yi 4438

a b k
18607.27 273.1 254932.5
273.1 5 4438

A^-1 0.000271 -0.0148


-0.0148 1.008374

a= 3.394873
b= 702.1721

Thus, R = 702.2 + 3.39T.

at T=100 R= 1041.659

at T=50 R= 871.9157

Exercise: 3) Construct a divided difference table from these data.


x f(x)
0.5 1.0025
-0.2 1.394
0.7 1.0084
0.1 1.1221
0 1.1884

Obtain the interpolating polynomial.


What is the value of f(x) at x = 0.3?

4)Find the least squares line that fits the following data.
x f(x)
1 5.04
2 8.12
3 10.64
4 13.18
5 16.2
6 20.04

Then find the value of at x = 10.5.


.( x−x n−1 )f [ n]
0
.( x−x n−1 )f [ n]
0

7)(x-1)(x-4.8)

Das könnte Ihnen auch gefallen