to dream the impossible scheme
DESCRIPTION
To Dream the Impossible Scheme. Part 1 Approximating Derivatives on Non-Uniform, Skewed and Random Grid Schemes Part 2 Applying Rectangular Finite Difference Schemes to Non-Rectangular Regions to Approximate Solutions to Partial Differential Equations. - PowerPoint PPT PresentationTRANSCRIPT
To Dream the Impossible Scheme
Part 1Approximating Derivatives on Non-Uniform,
Skewed and Random Grid Schemes
Part 2Applying Rectangular Finite Difference Schemes to
Non-Rectangular Regions to Approximate
Solutions to Partial Differential Equations
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
Approximating Derivatives on Non-Uniform, Skewed and Random, Grid Schemes
Skewed
Non-Uniform
Random
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
How do we approximate f’(.5)
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
2-Point Forward Difference Approximation
'( ) 4.064 3.5(.5) 5.64
.1f
f x x f x
x
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
2-Point Backward Difference Approximation
( ) 3.5 3.056'(.5) 4.44.1
f x f x xf
x
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
2-Point Central Difference Approximation
( ) 4.064 3.056'(.5) 5.042 .2
f x x f x xf
x
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
In Summary … so Far
Method Approximation
2-PT BD 4.442-PT CD 5.042-PT FD 5.64
Which is right?
Which is better?
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
3-PT FD Approx
3 4 ( ) ( 2 )'(.5) 4.92
2f x f x x f x x
fx
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
4-PT CD Approximation
2 1 1 28 8'(.5) 512
f f f ffx
Note the new compact notation:
( )nf f x n x
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
5-PT FD Approximation:
0 1 2 3 425 48 36 16 3'(.5) 512
f f f f ffx
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
In Summary
Method Approximation
2-PT BD 4.442-PT CD 5.042-PT FD 5.643-PT FD 4.924-PT CD 5.005-PT FD 5.00
Which is the best approximation?
Approximating Derivativesfrom a Data Table
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
Method Approximation
2-PT BD 4.442-PT CD 5.042-PT FD 5.643-PT FD 4.924-PT CD 5.005-PT CD 5.00
3
2
( ) 4 2 2
( ) 12 2 (.5) 5
f x x x
f x x f
Estimates of the 1st Derivative (CRC)
1 001( )
2hf x f f f
x
0 1 2
2(3)
01( ) 3 4
2 3hf x f f f f
x
2 1 1 2
4(5)
01( ) 8 8
12 30hf x f f f f f
x
0 1 2 3
4(5)
0 41( ) 25 48 36 16 3
512hf x f f f f f f
x
2-point FD:
3-point FD:
4-point CD:
5-point FD:
2-point CD: 1 1
2(3)
01( )
2 6hf x f f f
x
Estimates of Higher Order Derivatives (CRC)
2(4)
1 0 101( ) 2
12hf x f f f f
x
(3)3 2 130 0
1( ) 3 3f x f f f f O hx
44 3 2 1 040
1( ) 4 6 4 ( )f x f f f f f O hx
2nd D,2-point CD :
3rd D, 4-point FD:
3rd D, 4-point CD:
4th D, 5-point FD:
(3) 22 1 1 230
1( ) 2 22
f x f f f f O hx
4th D, 5-point CD: 4 2
2 1 0 1 2401( ) 4 6 4 ( )f x f f f f f O hx
What’s Missing?Derivative
Grid Scheme # Points 1 2 3 4 >=5
Forward/BackwardDifference
2 ☺ na na na na
3 ☺ ☺ na na na
4 ??? ??? ☺ na na
5 ☺ ??? ??? ☺>6 ??? ??? ??? ??? ???
CentralDifference
2 ☺ na na na na
3 ??? ☺ na na na
4 ☺ ??? ☺ na na
5 ??? ??? ??? ☺ na
>6 ??? ??? ??? ??? ???Non-Uniform ??? ??? ??? ??? ???
Skewed-Grid Schemes ??? ??? ??? ??? ???
• Where do these Equations Come From– Derivation starts with the Taylor Series centered on x:
– i.e:
– Or in a shorthand form the you will see on the following slides:
( )
0
( )( ) ( )!
nn
n
xf x x f xn
2 3 4 (4)( ) ( ) ( )( ) ( ) '( ) ( ) ( ) ( )
2! 3! 4!x x xf x x f x xf x f x f x f
1
(0) (1) (2) (3)0 0 0 0
2 3 4(4) ( )
2! 3! 4!f f f f f f
Derivation of 2-Point BD Equationfor the 1st Derivative on a Uniform Grid
Where: fn=f(x0+nδ) where δ is the grid spacing.Note: Equation for f0 is expanded for use in further derivationNote: Define 00=1
Start with Three 3-Term Taylor Series Expansions.
)3(0
3)2(
0
2)1(
0
1
0
0
0
)3(0
3)2(
0
2)1(
0
1
0
0
1
)3(0
3)2(
0
2)1(
0
1
0
0
2
!3
0
!2
0
!1
0
!0
0
!3!2!1!0
!3
2
!2
2
!1
2
!0
2
fffff
fffff
fffff
Derivation of 3-Point BD Equationfor the 1st Derivative on a Uniform Grid
Multiply Each Equation by a Weight ωn .
)2(0
2
0)1(
0
1
00
0
000
)2(0
2
1)1(
0
1
10
0
111
)2(0
2
2)1(
0
1
20
0
222
!2
0
!1
0
!0
0
!2!1!0
!2
2
!1
2
!0
2
ffff
ffff
ffff
Note: Error term dropped for the time being for brevity
Derivation of 3-Point BD Equationfor the 1st Derivative on a Uniform Grid
Sum up the Coefficients to Generate the 1st Derivative Expression .
0
!2
0
!2!2
2
1!1
0
!1!1
2
0!0
0
!0!0
2
2
0
2
1
2
2
1
0
1
1
1
2
0
0
0
1
0
2
Derivation of 3-Point BD Equationfor the 1st Derivative on a Uniform Grid
A little algebraic manipulation …
0012
!1012
0012
20
21
22
1
10
11
12
00
01
02
Derivation of 2-Point BD Equationfor the 1st Derivative on a Uniform Grid
Note: A Vandermonde Matrix
0
/!1
0
)0()1()2(
)0()1()2(
)0()1()2(1
0
1
2
222
111
000
And rewritten as a matrix equation …
Derivation of 3-Point BD Equationfor the 1st Derivative on a Uniform Grid
A General Vandermonde Matrix
113
12
11
223
22
21
321
11111
nn
nnn
n
n
V
nji
ijV1
)()det(
Solving for ω-2 Using Cramer’s Rule
0 0
1 1 0 03
2 2 2 2
2 0 0 0
1 1 1
2 2 2
0 1 0
1! 1 0 1 01! 1
0 1 0 1 0 1
( 1 2)(0 2)(0 1) 22 1 0
2 1 0
2 1 0
Cofactor Expansion
Determinant of a Vandermonde matrix
Derivation of 3-Point BD Equationfor the 1st Derivative on a Uniform Grid
Solve for the Remaining Weights.
2
3,
2
4,
2
1012
3
3 23 (3) (3)
2 1 03
( 2)
[ ] ( 1) ( ) ( )3! 3
0
R f f
Now use weights to calculate the coefficient of the remainder term …
Derivation of 3-Point BD Equationfor the 1st Derivative on a Uniform Grid
Voila! .
2
(1) (3)0 2 1 0
14 3 ( )
2 3f f f f f
Derivation of 3-Point BD Equationfor the 2nd Derivative on a Uniform Grid
Alter RHS Slightly ….
2
0 0 0
21 1 1
1
2 2 2 0
2 1 0
2 1 0
2 1 1
0 01! 00 2!
Derivation of 5-Point CD Equationfor the 3rd Derivative on a Uniform GriD
(or, if I desire, anything up to the 4th Derivative)
3
4
0 0
1 1
0 0 0
1 1 1 2
12 2 2 2 2
3 3 3 3 3 1
24 4 4 4 4
0
1 2
01 2001 2
3!/ 02 1 0
2 1 0
02 1 0002 1 0
1 2 0 4!/
2 1 0 1 2
(or, if I desire, anything up to the 4th Derivative)
System will also Work for Skew Grid Schemes(i.e. use backward 1st and 4th point and forward 1st , 2nd, and 6th point
to find the 3rd derivative on a uniform grid)
3
0 0 0 0 0
1 1 1 1 1 4
12 2 2 2 2
1
3 3 3 3 3 2
64 4 4 44
2
4 1 1 2 6
04 1 1 2 6004 1 1 2 6
3!/4 1 1 2 6 0
4 1 1 6
Note: The grid is “uniform”, the spacing between the points is not.
A General Matrix System(for an r-point approximation for the ith derivative)
an: integer that describes position of grid point with respect to center point (i.e. anΔx).
1
0 0 0
1
1
1 1 1
1
0
!/
0
i
r
ai r
i i i iai r
r r rai r
a a a
ia a a
a a a
Using Cramer's Rule to Solve for ωa1
1
0 0
1 1
0 0 0
1
1
1 1 1
1
0
!/
0
i r
i iii r
r r
i r
a
i r
i i i
i r
r r r
i r
a a
i a a
a a
a a a
a a a
a a a
Which “Simplifies” to:
1
0 0 0
2
1 1 1 1
2
1 1 1
2
1
!1
i r
i n i i i
i i r
r r r
i r
a
j kk j r
a a a
ia a a
a a a
a a
Determinant of a Vandermonde matrixCofactor ExpansionAbout the 1st Column and The (i+1)th Row
Turning our Attention to the Numerator …
T. Ernst, Generalized Vendermonde Systems of Equations. Mathematics of Computation, 24, (1970) 893-903.
I.G. Macdonald, Symmetric Functions and Hall Polynomials, Oxford Mathematical Mongraphs, Second Ed. 1995.
S.D. Marchi, Polynomials arising in factoring generalized Vandermonde determinants: An algorthm for computingtheir coefficients, The Mathematical and Computer Modeling, 34 (2003) 280-287.
1 11,det , ..., , ..., detr i m n ri nM s a a a V
Minor of the Vandermonde MatrixWith the (i+1)th row and nth columnremoved (from previous slide).
Schur polynomialof order r-i-1
Vandermonde Matrix withthe rth row and nth columnremoved.
Schur Polynomials
0 1
1 11
2 11
3 11
11
,..., 1
,...,
,...,
,...,
,...,
n
n
n jj
n j kj k n
n j k lj k ln
n
n n jj
s a a
s a a a
s a a a a
s a a a a a
s a a a
Therefore …
111
1 ,
1
,..., ,...,
!1
m n r j kr ik j r
i n j k nn i
j kk j r
s a a a a a
i
a a
det V
det(V)
Schur Polynomial
Finally …
11 1
1
,..., ,...,!1
m n ri n r i
n in j
j n r
s a a ai
a a
Where ωn is the nth weight for an r-point estimate of theith derivative with grid points whose relative position tothe center is given by {a1, …, ar} and grid spacing is δ.
Recall the Earlier Example …(i.e. use backward 1st and 4th point and forward 1st , 2nd, and 6th point
to estimate the 3rd derivative on a uniform grid)
3
0 0 0 0 0
1 1 1 1 1 4
12 2 2 2 2
1
3 3 3 3 3 2
64 4 4 44
2
4 1 1 2 6
04 1 1 2 6004 1 1 2 6
3!/4 1 1 2 6 0
4 1 1 6
Note: The grid is “uniform”, the spacing between the points is not.
Using Algorithm Generates …
5(3) 24 1 1 2 63
1 4 5 9 1 3 21
75 21 25 6 350 20f f f f f f f
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.056
0.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
1.2 11.312
(3) 1(.5) ( .11755 .727619 1.46304 .795333 .081634) 24.001
f
3
2
( ) 24 24
( ) 4 2 2
( ) 12 2
x x f x
f x x x
f x x
f
It also Generates the 4th Derivative…
5(4) 24 1 1 2 64
1 2 4 12 1 3 4
75 21 25 3 175 5f f f f f f f
x y=f(x)
0 2
0.1 2.204
0.2 2.432
0.3 2.708
0.4 3.0560.5 3.5
0.6 4.064
0.7 4.772
0.8 5.648
0.9 6.716
1 8
1.2 11.312
(3) 1(.5) (.058773 .5821 1.95072 1.59067 .163269) 3.61 13.0001
f E
(4)
3
2
( ) 0( ) 24 24
( ) 4 2 2
( ) 12 2
xx x f x f
f x x x
f x x
f
Derivative
Grid Scheme # Points 1 2 3 4 >=5
Forward/BackwardDifference
2 ☺ na na na na
3 ☺ ☺ na na na
4 ☺ ☺ ☺ na na
5 ☺ ☺ ☺ ☺>6 ☺ ☺ ☺ ☺ ☺
CentralDifference
2 ☺ na na na na
3 ☺ ☺ na na na
4 ☺ ☺ ☺ na na
5 ☺ ☺ ☺ ☺>6 ☺ ☺ ☺ ☺ ☺
Non-Uniform ☺ ☺ ☺ ☺ ☺Skewed-Grid Schemes ☺ ☺ ☺ ☺ ☺
The Extension to Random Grids…
11 1
1
,..., ,...,!1
m n ri n r i
n in j
j n r
s a a ai
a a
A slight adjustment to this equation will accomplish this.Let δ=1 and ai be the position from the point of interest.
Applying Finite Difference Schemes to Non-Rectangular Regions
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
-1.5
-1
-0.5
0
0.5
1
1.5
-4 -3 -2 -1 0 1 2 3 4
-3
-2
-1
0
1
2
3
-3 -2 -1 0 1 2 3-3
-2
-1
0
1
2
3
The Wave Equationon a Circular Membrane
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
-1-0.5
00.5
1
-1
-0.5
0
0.5
1-1
-0.5
0
0.5
1
Initial Condition
Object: Solve analytically using the polar from of the wave equation.Then compare to a numerical finite difference approximation thatsuperimposes a rectangular grid on the circle. Note that the grid size varies from point to point on the circle.
The Wave Equation
udt
u 222
2
2
2
2
22
2
2
dy
u
dx
u
dt
u
2
2
22
2
2 111
d
u
rr
u
rrrdt
u
2
22
2
2 1
dr
u
r
u
rdt
u
Rectangular Form:
Wave Equation:
Polar Form:
Polar Form: (Radial Symmetry)
Boundary/Initial Conditions
continuity),2,('),0,('
continuity),2,(),0,(
continuity),,0(
membranepinned0),,1(
trutru
trutru
tu
tu
velocityinitialno0)0,,('
)sin(8216)0,,(
ru
rrru
2
2
211
2
2
2
2
d
u
rr
u
rdr
u
dt
u
PDE (ω=1, 0≤r ≤1):
Boundary Conditions:
Initial Conditions:
Analytic Solution
20
10
)(2
cos
)(2
sin2)(
20
10 )cos(
)sin()()sin(8
216
rdrdm
mrmnmJ
rdrdm
mrmnmJrr
mnB
mnA
Jm: Bessel Function of the First Kind of order mμmn: Is the nth eigenvalue of Jm
)cos()sin(
)cos(0 1
mm
tmnrmnmJm n mnB
mnAu
Numeric Solution
kjiy
kjiy
kjiy
kjix
kjix
kjix
kji
kji
kji
uuuuuu
uuut
1,,1,,,,1
1,,
1,2
101101
21
Since the grid is rectangular, use the rectangular form of thewave equation:
2
2
2
2
2
2
dy
u
dx
u
dt
u
The discrete form of this equation from finite difference methods
Note: Based on 3-point central difference formulations of the spatial terms.Note: Based on 3-point backward difference formulation in time.Note: The time grid is uniform.
Numeric Solution
kjiy
kjiy
kjiy
kjix
kjix
kjix
kji
kji
kji
uuuuuut
uuu
1,,1,,,1,1
2
,,1
,
101101
2
Time Stepping:
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
Stability Requirement:Δt ≤ smallest grid increment
DemonstrationUsing 3-pt CD Formulations
Future ResearchApply to More Complex Regions
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
-1.5
-1
-0.5
0
0.5
1
1.5
-4 -3 -2 -1 0 1 2 3 4
-3
-2
-1
0
1
2
3
-3 -2 -1 0 1 2 3-3
-2
-1
0
1
2
3