Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
86 views

MATLAB Formulas

1) The document discusses several numerical analysis techniques including root finding, finding extrema, solving simultaneous equations, iterative methods, Lagrange and Newton polynomials, regression, integration, differentiation, and solving ordinary differential equations. 2) It provides formulas and explanations for each technique as well as discussing sources of error and different methods like forward, backward, and central differencing. 3) Examples are given for many of the techniques to illustrate their application including integration rules, regression parameters, and iterative methods for solving ODEs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

MATLAB Formulas

1) The document discusses several numerical analysis techniques including root finding, finding extrema, solving simultaneous equations, iterative methods, Lagrange and Newton polynomials, regression, integration, differentiation, and solving ordinary differential equations. 2) It provides formulas and explanations for each technique as well as discussing sources of error and different methods like forward, backward, and central differencing. 3) Examples are given for many of the techniques to illustrate their application including integration rules, regression parameters, and iterative methods for solving ODEs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Root Finding:

) ( ) (
) (
2 log
) / log(
log
2
) (
) (
) ( ) (
) )( (
) ( ) (
) )( (
1
0 0
2
0
1
1
1
1
i i i
i i
i i
MAX
MAX
N
MAX
i
i
i i
i i
i i i
i i
L U
L U U
U R
x f x x f
x f x
x x
E x
E
x
N
x
E
x f
x f
x x
x f x f
x x x f
x x
x f x f
x x x f
x x
+
=
A
=
A
=
A
=
'
=


=
+
+

+
o
o

N =estimate number (first is estimate 1), estimate N involves N-1 function evaluations/wall movements
Finding a Minimum:
2
) 1 (
6180339887 . 1
2
5 1
), )( 1 ( , ,
0
1 2
N
MAX L U L U
x
E X X d d X X d X X
A
= =
+
= = + = =
|
| |
max error assumes midpoint of interval chosen as the final answer, N =number of wall movements

x
1
=low, x
2
=interior, x
3
=high
Simultaneous Equations:
d U x b P L d d Ux Pb Ld Pb LUx b LU P b Ax
d U x b L d d Ux b Ld b LUx b Ax
row pivot pivot pivot below element row row
\ ), * ( \ and
\ , \ and
_ * ) / _ _ (
1
= = = = = = =
= = = = = =
=


Iterative methods:
ii i i ii ij ij ii k k
a b d a a c c d Cx x / / 0
1
= = = + =
+

Lagrange Polynomial:
) ( ) )( ( ) )( (
) ( ) )( ( ) )( (
) (
) ( ) ( ) ( ) ( ) (
1 1 2 1
1 1 2 1
3 3 2 2 1 1
N k k k k k k k
N k k
k
N N
x x x x x x x x x x
x x x x x x x x x x
x L
y x L y x L y x L y x L x p


=
+ + + =
+
+


Numerator of L
k
(x) is product of all (x x
i
) except for (x x
k
)
Denominator of L
k
(x) is product of all (x
k
x
i
) except for (x
k
x
k
)
Newton's Polynomial:
i k i
i
k
i
k
i
k
i i
i i
i
i i
i i
i
N
N
N N
x x
y D y D
y D
x x
Dy Dy
y D
x x
y y
Dy
y D a y D a Dy a y a
x x x x a x x x x a x x a a x p

=
= = = =
+ + + + =
+

+
+
+
+

1
1
1
2
1 2
1
1
1
1
1
2
3 1 2 1 1
1 1 2 1 3 1 2 1
) ( ) ( ) )( ( ) ( ) (



( ) | | ( ) | |
( )| | ( )| | ) ( ) ( ) ( ) (
) ( ) ( ) ( ) (
2
1
1 2 3 2 3 2 1 2
1 2
2
3 2 3 2
2
1 2
2
x f x f x x x f x f x x
x f x f x x x f x f x x
x x


=

Regression:
Straight line fit:
( ) ( )
x m y
x x n
y x x y x
b
x x n
y x y x n
m b mx y
i i
i i i i i
i i
i i i i
=

= + =




2
2
2
2
2


= =

=
2 2 2
)) ( ( ) (
i i r i t
t
r t
x f y S y y S
S
S S
r
For a straight line fit only:
( ) ( )




=
2
2
2
2
i i i i
i i i i
y y n x x n
y x y x n
r
b m b
y
y
x
x
x
x
y
m y y x x x y
m e y y x x e y
b
b x
/ , / 1
1 1
For
, 10 ) log( ) log( For
, ) ln( For
= = = ' = '
+
=
= = = ' = ' =
= = = ' = ' =
| o
|
o
| o o
| o o
|
|

y Q Ra QR Z y Z Za Z x z z
x z a x z a x z a x z a y
T T T
i j ij
m m
= = = =
+ + + =
: ion decomposit QR ) ( : solution Basic
) ( ) ( ) ( ) ( : squares least General
3 3 2 2 1 1


Integration:
( ) ( )
( ) ( ) ) ( ) ( 4 ) ( 2 ) ( 4 ) ( 2 ) ( 4 ) (
3
) ( ) ( 4 ) (
3
) ( ) ( 2 ) ( 2 ) ( 2 ) ( 2 ) (
2
) ( ) (
2
1 4 3 2 1 0 2 1 0
1 3 2 1 0 1 0
N N
N N
x f x f x f x f x f x f x f
h
I x f x f x f
h
I
x f x f x f x f x f x f
h
I x f x f
h
I
+ + + + + + + = + + =
+ + + + + + = + =

( ) ) ( ) ( 3 ) ( 3 ) (
8
3
3 2 1 0
x f x f x f x f
h
I + + + =
k
k k
k
k j k j
k
k j
j
j j j
I
I I I I
I
h
h h I
, 1
1 , 2 , 1
1
1 , 1 , 1
1
,
1
1
1 ,
1 4
4
2
using estimate

= = = c
n c
0
x
0
c
1
x
1
c
2
x
2
c
3
x
3

2 1 -0.57735 1 0.57735
3 5/9 -0.77459 8/9 0 5/9 0.77459
4 0.347855 -0.861136 0.652145 -0.339981 0.652145 0.339981 0.347855 0.861136

Directly usable only for -1 to 1. For a to b use
Differentiation:
First Derivative Formula Error
Forward (2 point)
| | h x f x f
i i
/ ) ( ) (
1

+
O(h)
Forward (3 point)
| | h x f x f x f
i i i
2 / ) ( 3 ) ( 4 ) (
1 2
+
+ +
O(h
2
)
Backwards (2 point)
| | h x f x f
i i
/ ) ( ) (
1
O(h)
Backwards (3 point)
| | h x f x f x f
i i i
2 / ) ( ) ( 4 ) ( 3
2 1
+ O(h
2
)
Central (2 point)
| | h x f x f
i i
2 / ) ( ) (
1 1 +
O(h
2
)
Central (4 point)
| | h x f x f x f x f
i i i i
12 / ) ( ) ( 8 ) ( 8 ) (
2 1 1 2 + +
+ + O(h
4
)
k
k k
k
k j k j
k
k j
j
j j j
D
D D D D
D
h
h h D
, 1
1 , 2 , 1
1
1 , 1 , 1
1
,
1
1
1 ,
1 4
4
2
using estimate

= = = c
ODE's:
A
Cy y B D
dt
y d
y
dt
dy
D Cy
dt
dy
B
dt
y d
A
y
y y
y y y y
h
y t f y t f
y y h y t f y y
y t f y t f h y y y t f
dt
dy
i
m
i
m
i
m
i
m
i
i
i
i
j
i i i
i
i
j
i i i
i
i i i i i i
'
=
'
' = = + +
<

= =
+
+ = + =
= = + = =
+
+

+
+
+
+
+
+

+
+ +
+ + +
,
iteration with iteration no
2
) , ( ) , (
) , ( : Heun
) , ( : Midpoint ) , ( : Euler ) , (
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1 1
0
2 / 1 2 / 1 1
c
| | |

}

=
|
|
.
|

\
|
|
.
|

\
|
+
+
|
.
|

\
|
~
1
0
2 2 2
) (
n
i
i i
b
a
x
a b a b
f c
a b
dx x f

You might also like