SlideShare a Scribd company logo
1
Programming, Computation, Simulation
Applications in Math & Physics
Euler and Runge-Kutta Methods
Ordinary Differential Equations & Initial Value Problems
Syeilendra Pramuditya
Department of Physics
Institut Teknologi Bandung
Grid-based Computation
 Euler-type Methods
 Differential equations
 Temporal domain (variation in time)
 Initial conditions
 Finite Difference Methods
 Differential equations
 Spatial domain (variation in space)
 Boundary conditions: Von Neumann VS
Dirichlet
3
Differential Equation
2
( ) ( , ) 1
( 0) 0
( ) ..?
dy
y x f x y x
dx
y x
y x
    
 

4
Differential Equation
2
( ) ( , ) 1
( 0) 0
dy
y x f x y x
dx
y x
    
 
2
3
3
Exact Solution
( 1)
1
3
( 0) 0 0
1
( ) ( , )
3
dy x dx
y x x C
y x C
y x f x y x x
 
  
   
  
 
5
Differential Equation
1
( ) ( , )
( 1) 0
( ) ..?
dy
y x f x y
dx x
y x
y x
   
 

6
Differential Equation
1
( ) ( , )
( 1) 0
dy
y x f x y
dx x
y x
   
 
Exact Solution
1
ln( )
( 1) 0 0
( ) ( , ) ln( )
dy dx
x
y x C
y x C
y x f x y x

 
   
 
 
7
Differential Equation
2 1
( ) ( , ) 1
( 0) 0
..???
dy
y x f x y x
dx y
y x
y
     
 

Euler Methods
 Linear approx. of Taylor series
 “Simple Euler”
0
x x
0
( )
f x
( )
f x  
0
0 0 0
0
0 0 0
0
0 0 0 0
0 0 0 0
0 0 0
( ) ( )
( ) ( , )
( ) ( ) ( )
( ) ( ) ( , )
( ) ( ) ( , ( ))
( )
y x y x
y x f x y
x x
y x y x x x y x
x x h
y x h y x hf x y
y x h y x hf x y x
y x h y hf

  


  
 
  
  
  
0 0 0
( ) ( , )
y
y x f x y
x

  

9
Ordinary Differential Equation (ODE)
0 0 0 0
0 0 0
( ) ( ) ( , )
( )
( , )
new old old old
y x h y x hf x y
y x h y hf
y y hf x y
  
  
 
 Solve the above ODE numerically (find y(x)) using Simple
Euler method (for 1<x<10), use h = 1.0 and h = 0.5
 How good the numerical solution is?
1
( ) ( , )
( 1) 0
dy
y x f x y
dx x
y x
   
 
Simple Euler Code
0 0 0 0
0 0 0
( ) ( ) ( , )
( )
( , )
new old old old
y x h y x hf x y
y x h y hf
y y hf x y
  
  
 
Solve the ODE numerically (find y(x)) using Simple
Euler method (for 1<x<10), use h = 1.0 and h = 0.5
1
( ) ( , )
( 1) 0
dy
y x f x y
dx x
y x
   
 
Exact VS Numeric
0
0.5
1
1.5
2
2.5
3
0 2 4 6 8 10
Exact
Euler, h = 1.0
Euler, h = 0.5
Euler Methods
 Linear approx. of Taylor series
 “Modified Euler” Use more correct gradient
0
x x
0
( )
f x
( )
f x
 
0 0
0 0
0
0
0 0
0 0
( ) ( ) ( )
( ) ( ) ( , )
2
( )
2
2
( )
mid
mid mid
mid
mid
mid
mid
y x y x x x y x
y x h y x hf x y
h
x x
h
y y x
h
y y f
y x h y hf

  
  
 
 
 
  
Modified Euler
 
0 0
0 0
0
0
0 0
0 0
( ) ( ) ( )
( ) ( ) ( , )
2
( )
2
2
( )
mid
mid mid
mid
mid
mid
mid
y x y x x x y x
y x h y x hf x y
h
x x
h
y y x
h
y y f
y x h y hf

  
  
 
 
 
  
Euler Methods
 Linear approx. of Taylor series
 “Improved Euler” Use more correct gradient
0
x x
0
( )
f x
( )
f x
0 0 0
0 0
0
0 0
0 0 0 0
0 0
( ) ( , )
( ) ( , )
( ) ( )
( )
2
( , ) ( , )
2
( , ) ( , ( , ))
( ) ( )
avg
avg
avg
y x f x y
y x f x y y hf
y x y x
y x
f x y f x y
f
f x y f x h y hf x y
y x h y x hf
 
   
 

 


  
  
Improved Euler
0 0 0
0 0
0
0 0
0 0 0 0
0 0
( ) ( , )
( ) ( , )
( ) ( )
( )
2
( , ) ( , )
2
( , ) ( , ( , ))
( ) ( )
avg
avg
avg
y x f x y
y x f x y y hf
y x y x
y x
f x y f x y
f
f x y f x h y hf x y
y x h y x hf
 
   
 

 


  
  
2nd Order Runge-Kutta (RK2)
1 0 0
1
2 0 0
0 0 2
( , )
( , )
( , )
2 2
( )
dy
y f x y
dx
k hf x y
k
h
k hf x y
y x h y k
  

  
  
4th Order Runge-Kutta (RK4)
 
1 0 0
2 0 0 1
3 0 0 2
4 0 0 3
0 0 1 2 3 4
4th Order Runge-Kutta
( , )
( , )
( , )
2 2
( , )
2 2
( , )
( ) 2 2
6
dy
y f x y
dx
k f x y
h h
k f x y k
h h
k f x y k
k f x h y hk
h
y x h y k k k k
  

  
  
  
     
Exact VS Numeric
 Simple Euler (h = 0.2)
Exact VS Numeric
 Modified Euler (h = 0.2)
Exact VS Numeric
 Improved Euler (h = 0.2)
Exact VS Numeric
 RK4 (h = 0.2)
22
Block-Spring System
( ) ( , ) ( )
( ) ( , ) ( )
F ma
dv F k
a x
dt m m
dv k k
x v t f x t x t
dt m m
dx
v x t f v t v t
dt


  
 

   

   
23
Block-Spring System
   
   
0 0 0
0 0 0 0
0
0 0 0
0 0 0 0
0
2 2
1 1
( ) ( ) ( ) ( ) ( , )
1 1
( ) ( ) ( ) ( ) ( , )
1 1
2 2
t
t
v v at v t v v t t v t v t v f v t
t t
dv k
v t v t v x
dt m
x x vt x t x x t t x t x t x f x t
t t
dx
x t x t x v
dt
E mv kx
  
  


 
        
    
 
        
    
 
0 0 0 0
0 0 0
( ) ( ) ( , )
( )
y x h y x hf x y
y x h y hf
  
  
24
Block-Spring System (Simplified)
1
2
0 0
0 0 1 0 0 0 0
0 0 2 0 0 0 0 0 0
2 2
( ) ( , ) ( )
( ) ( , ) ( )
( )
( ) ( , )
( ) ( , ) ( )
1 1
2 2
dv k
v t f t v x t
dt m
dx
x t f t x v t
dt
kx t kx
v t t v t f t v v t v t
m m
x t t x t f t x x tv t x tv
E mv kx

   
   
   
 
           
   
   
           
 
0 0 0 0
0 0 0 0
( ) ( ) ( , )
( )
y x h y x hf x y
dy
y x h y hf y h
dx
  
    
25
Block-Spring System (Simplified)
0 0
0 0 0 0 0
0 0 0 0 0 0 0
2 2
( ) ( )
( ) ( )
( )
( ) ( )
( ) ( ) ( )
1 1
2 2
dv k
v t x t
dt m
dx
x t v t
dt
kx t kx
v t t v t v t v t v t
m m
x t t x t x t x tv t x tv
E mv kx

  
  
   
 

           
   
   

           
 
0 0 0 0
0 0 0 0
( ) ( ) ( , )
( )
y x h y x hf x y
dy
y x h y hf y h
dx
  
    
26
Block-Spring System (Simplified)
0
0 0 0 0 0
0 0 0
0 0 0 0
2 2
( )
( )
( )
1 1
2 2
kx
dv F
v t t v t v a t v t v t
dt m m
k
v t t v x t
m
dx
x t t x t x v t
dt
E mv kx

             
    
       
 
0 0 0 0
0 0 0 0
( ) ( ) ( , )
( )
y x h y x hf x y
dy
y x h y hf y h
dx
  
    
27
Block-Spring System
1
0 0 0 0 0 0 0 0 0
2
0 0 0
0 0 0 0 0 0
Simple Euler
( , ) ( ) ( )
( ) ( , ) ( , )
( , ) ( ) ( )
( , )
( ) ( , )
new old old
new old
dx
x t x f t v t
dt
x t t x t x t x x tv t v x tv
x x tv
dv k
v t v f t x t
dt m
kx t x kx
v t t v t v t v v t v t
m m
v v t
   

           
  

   
   
 

           
   
   

  
2 2
1 1
2 2
old
kx
m
E mv kx
 
 
 
 
Block-Spring System
 Analytic Solution
( ) cos( )
( ) sin( )
m
m
x t x t
v t v t
 
 
 
  
29
Write a Simple Euler Code
 m = k = 1
 0 < t < 20 sec
 dt = 0.2
 x(t=0) = 1
 v(t=0) = 0
 Calculate x(t) and v(t) using Simple Euler
 Output: time,x(t),x_exact,v(t),v_exact,Em
0 0 0 0
0 0 0 0
( ) ( ) ( , )
( )
y x h y x hf x y
dy
y x h y hf y h
dx
  
    
0
0 0 0 0 0
0 0 0
0 0 0 0
2 2
( )
( )
( )
1 1
2 2
kx
dv F
v t t v t v a t v t v t
dt m m
k
v t t v x t
m
dx
x t t x t x v t
dt
E mv kx

             
    
       
 
Simple Euler Code
0 0 0
0 0 0
2 2
( )
( )
1 1
2 2
k
v t t v x t
m
x t t x v t
E mv kx
    
    
 
output.txt
Gnuplot Script
# Script to plot 1D dataset
reset
unset label
unset key
set key left top
set xrange [0:10]
set yrange [-3:3]
set title "Plot Image"
set xlabel "X Value"
set ylabel "Y Value"
set terminal wxt size 600,400 font "Verdana,10"
plot 'output.txt' using 2:3 title "Numeric" with linespoints pointtype 6 lw 1 lc 7, 
'output.txt' using 2:4 title "Analytic" with linespoints pointtype 6 lw 1 lc 6
33
Simple Euler: Position
34
Simple Euler: Velocity
Simple Euler: Energy
36
Block-Spring System
1
2
0 0 1 0 0 0
0 0 2 0 0 0
0 0 1
0 0 2
Modified Euler
( , ) ( ) ( )
( , ) ( ) ( )
( ) ( )
2 2 2
( ) ( )
2 2 2
( ) ( )
( ) ( )
mid
mid
mid
mid
dx
x t x f t v t
dt
dv k
v t v f t x t
dt m
t t t
x x t x f t x v
t t t k
v v t v f t v x
m
x t t x t f t
v t t v t f t
   

   
  
       
   
       
     
     
37
Modified Euler: Position
38
Modified Euler: Velocity
Modified Euler: Energy
Mass-Spring System
 2nd Order Runge-Kutta (RK2)
1 0 0
1
2 0 0
0 0 2
( ) ?
( , )
( , )
( , )
2 2
( )
q t
dq
q f t q
dt
k dt f t q
k
dt
k dt f t q
q t dt q k

  
 
   
  
1 0 0
1
2 0 0
0 0 2
( ) ?
( , )
( , )
( , )
2 2
( )
y x
dy
y f x y
dx
k hf x y
k
h
k hf x y
y x h y k

  

  
  
y(x)
x
q(t)
t
Mass-Spring System
 2nd Order Runge-Kutta (RK2)
1
( ) ?
( , ) ( )
x t
dx
x f t x v t
dt

   
x(t)
t
v(t)
t
2
( ) ?
( , ) ( )
v t
dv k
v f t v x t
dt m


   
Mass-Spring System
 2nd Order Runge-Kutta (RK2)
1 0 0
1
2 0 0
0 0 2
( ) ?
( , )
( , )
( , )
2 2
( )
q t
dq
q f t q
dt
k dt f t q
k
dt
k dt f t q
q t dt q k

  
 
   
  
1
1 1
2 1
2
2
( ) ( )
( ) ( )
( ) ( )
2 2
( ) ( ) ( ) ( )
2 2 2
( ) ( )
2
( ) ( ) ( ) ( ) ( )
2
dx
x f t v t
dt
k t f t t v t
t t
k t f t t v t
t t t k
v t v t v v t x t
m
t k
k t v t x t
m
t k
x t t x t k x t t v t x t
m
   
     
 
       
   

     
 
 
    
 
 
 
 
         
 
 
Mass-Spring System
 2nd Order Runge-Kutta (RK2)
1 0 0
1
2 0 0
0 0 2
( ) ?
( , )
( , )
( , )
2 2
( )
q t
dq
q f t q
dt
k dt f t q
k
dt
k dt f t q
q t dt q k

  
 
   
  
2
1 2
2 2
2
2
( ) ( )
( ) ( )
( ) ( )
2 2
( ) ( ) ( ) ( )
2 2 2
( ) ( )
2
( ) ( ) ( ) ( ) ( )
2
dv k
v f t x t
dt m
k
k t f t t x t
m
t k t
k t f t t x t
m
t t t
x t x t x x t v t
k t
k t x t v t
m
k t
v t t v t k v t t x t v t
m

   

     
  
       
  

    
 
 
   
 
 
 
 
        
 
 
RK2: Position x(t)
RK2: Velocity v(t)
RK2: Mechanical Energy Em(t)
4th Order Runge-Kutta (RK4)
 
1 0 0
2 0 0 1
3 0 0 2
4 0 0 3
0 0 1 2 3 4
( , )
( , )
( , )
2 2
( , )
2 2
( , )
( ) 2 2
6
dy
y f x y
dx
k f x y
h h
k f x y k
h h
k f x y k
k f x h y hk
h
y x h y k k k k
  

  
  
  
     
1
2
( ) ( )
( ) ( )
( ) ?
( ) ?
dx
x f t v t
dt
dv k
v f t x t
dt m
x t dt
v t dt
   

   
 
 
RK4: Position x(t)
49
Damped Mass-Spring System
F ma kx cv
dv F kx cv
a
dt m m
dv k c
x v
dt m m
dx
v
dt
   
 
  

 

50
Damped Mass-Spring System
     
   
0 0 0
0 0 0 0
0
0 0 0
0 0 0 0
0
2 2
1 1
( ) ( ) ( ) ( ) ( , )
1 1
( ) ( ) ( ) ( ) ( , )
1 1
2 2
t
t
v v at v t v v t t v t v t v f v t
t t
dv
v t v t v x cv
dt
x x vt x t x x t t x t x t x f x t
t t
dx
x t x t x v
dt
E mv kx
  
  


 
        
     
 
        
    
 
51
Damped Oscillation
 m = k = 1
 0 < t < 20 sec
 dt = 0.2
 x(t=0) = 1
 v(t=0) = 0
 c = 0.15
 Calculate x(t) and v(t) using Euler Method
 Output: time,x(t),x_exact,v(t),v_exact,Em
0 0 0 0
0 0 0 0
( ) ( ) ( , )
( )
y x h y x hf x y
dy
y x h y hf y h
dx
  
    
0 0
0 0 0 0 0
0 0
0 0
0 0 0 0
2 2
( )
( )
( )
1 1
2 2
kx cv
dv F
v t t v t v a t v t v t
dt m m
kx cv
v t t v t
m
dx
x t t x t x v t
dt
E mv kx
 
             
 
    
       
 
52
Damped Oscillation (Mod. Euler)
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
0 5 10 15 20
TIme
Position
Damped Oscillation: Analytical Solution
 Halliday-Resnick, Chapter 15
Type of Damped Oscillation
Type of Damped Oscillation
LC Oscillation
2
2
0
d x k
x
dt m
 
Damped LC Oscillation (RLC Circuit)
 The RLC Circuit
2
2
0
d x c dx k
x
dx m dt m
  
Self-Practice for Interested Students
 Ideal/undamped oscillating systems
 Mass-spring systems
 RLC systems
 Modified / Improved Euler Methods
 RK2 / RK4 Methods
 Damped oscillating systems
 Mass-spring systems
 RLC systems
 Modified / Improved Euler Methods
 RK2 / RK4 Methods
 Underdamped / Overdamped / Critically damped
Ad

More Related Content

What's hot (20)

Initial Value Problems
Initial Value ProblemsInitial Value Problems
Initial Value Problems
Mohammad Tawfik
 
Métodos de resolución de EDOs mediante series
Métodos de resolución de EDOs mediante seriesMétodos de resolución de EDOs mediante series
Métodos de resolución de EDOs mediante series
Angel Vázquez Patiño
 
Runge-Kutta methods with examples
Runge-Kutta methods with examplesRunge-Kutta methods with examples
Runge-Kutta methods with examples
Sajjad Hossain
 
linear transformation
linear transformationlinear transformation
linear transformation
mansi acharya
 
Lecture-4 Reduction of Quadratic Form.pdf
Lecture-4 Reduction of Quadratic Form.pdfLecture-4 Reduction of Quadratic Form.pdf
Lecture-4 Reduction of Quadratic Form.pdf
Rupesh383474
 
03 dynamic.system.
03 dynamic.system.03 dynamic.system.
03 dynamic.system.
Mahmoud Hussein
 
Fourier series 1
Fourier series 1Fourier series 1
Fourier series 1
Dr. Nirav Vyas
 
Numerical Solution of Ordinary Differential Equations
Numerical Solution of Ordinary Differential EquationsNumerical Solution of Ordinary Differential Equations
Numerical Solution of Ordinary Differential Equations
Meenakshisundaram N
 
HERMITE SERIES
HERMITE SERIESHERMITE SERIES
HERMITE SERIES
MANISH KUMAR
 
Perturbation
PerturbationPerturbation
Perturbation
Dharmendrapresentation
 
Bessel’s equation
Bessel’s equationBessel’s equation
Bessel’s equation
kishor pokar
 
Applications of Z transform
Applications of Z transformApplications of Z transform
Applications of Z transform
AakankshaR
 
Numerical integration
Numerical integrationNumerical integration
Numerical integration
Mohammed_AQ
 
Initial value problems
Initial value problemsInitial value problems
Initial value problems
Ali Jan Hasan
 
Fourier series
Fourier seriesFourier series
Fourier series
Naveen Sihag
 
Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...
Suddhasheel GHOSH, PhD
 
Lagrangian Mechanics
Lagrangian MechanicsLagrangian Mechanics
Lagrangian Mechanics
AmeenSoomro1
 
Presentation mathmatic 3
Presentation mathmatic 3Presentation mathmatic 3
Presentation mathmatic 3
nashaat algrara
 
Newton's Forward/Backward Difference Interpolation
Newton's Forward/Backward  Difference InterpolationNewton's Forward/Backward  Difference Interpolation
Newton's Forward/Backward Difference Interpolation
VARUN KUMAR
 
State space analysis, eign values and eign vectors
State space analysis, eign values and eign vectorsState space analysis, eign values and eign vectors
State space analysis, eign values and eign vectors
Shilpa Shukla
 
Métodos de resolución de EDOs mediante series
Métodos de resolución de EDOs mediante seriesMétodos de resolución de EDOs mediante series
Métodos de resolución de EDOs mediante series
Angel Vázquez Patiño
 
Runge-Kutta methods with examples
Runge-Kutta methods with examplesRunge-Kutta methods with examples
Runge-Kutta methods with examples
Sajjad Hossain
 
linear transformation
linear transformationlinear transformation
linear transformation
mansi acharya
 
Lecture-4 Reduction of Quadratic Form.pdf
Lecture-4 Reduction of Quadratic Form.pdfLecture-4 Reduction of Quadratic Form.pdf
Lecture-4 Reduction of Quadratic Form.pdf
Rupesh383474
 
Numerical Solution of Ordinary Differential Equations
Numerical Solution of Ordinary Differential EquationsNumerical Solution of Ordinary Differential Equations
Numerical Solution of Ordinary Differential Equations
Meenakshisundaram N
 
Bessel’s equation
Bessel’s equationBessel’s equation
Bessel’s equation
kishor pokar
 
Applications of Z transform
Applications of Z transformApplications of Z transform
Applications of Z transform
AakankshaR
 
Numerical integration
Numerical integrationNumerical integration
Numerical integration
Mohammed_AQ
 
Initial value problems
Initial value problemsInitial value problems
Initial value problems
Ali Jan Hasan
 
Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...
Suddhasheel GHOSH, PhD
 
Lagrangian Mechanics
Lagrangian MechanicsLagrangian Mechanics
Lagrangian Mechanics
AmeenSoomro1
 
Presentation mathmatic 3
Presentation mathmatic 3Presentation mathmatic 3
Presentation mathmatic 3
nashaat algrara
 
Newton's Forward/Backward Difference Interpolation
Newton's Forward/Backward  Difference InterpolationNewton's Forward/Backward  Difference Interpolation
Newton's Forward/Backward Difference Interpolation
VARUN KUMAR
 
State space analysis, eign values and eign vectors
State space analysis, eign values and eign vectorsState space analysis, eign values and eign vectors
State space analysis, eign values and eign vectors
Shilpa Shukla
 

Similar to SPSF04 - Euler and Runge-Kutta Methods (20)

Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...
Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...
Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...
IOSR Journals
 
A Convergence Theorem Associated With a Pair of Second Order Differential Equ...
A Convergence Theorem Associated With a Pair of Second Order Differential Equ...A Convergence Theorem Associated With a Pair of Second Order Differential Equ...
A Convergence Theorem Associated With a Pair of Second Order Differential Equ...
IOSR Journals
 
Ah unit 1 differentiation
Ah unit 1 differentiationAh unit 1 differentiation
Ah unit 1 differentiation
sjamaths
 
Linear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.comLinear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.com
Abu Bakar Soomro
 
Controllability of Linear Dynamical System
Controllability of  Linear Dynamical SystemControllability of  Linear Dynamical System
Controllability of Linear Dynamical System
Purnima Pandit
 
The Study of the Wiener Processes Base on Haar Wavelet
The Study of the Wiener Processes Base on Haar WaveletThe Study of the Wiener Processes Base on Haar Wavelet
The Study of the Wiener Processes Base on Haar Wavelet
Scientific Review SR
 
DSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and Systems
DSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and SystemsDSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and Systems
DSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and Systems
Amr E. Mohamed
 
Lecture 5: Stochastic Hydrology
Lecture 5: Stochastic Hydrology Lecture 5: Stochastic Hydrology
Lecture 5: Stochastic Hydrology
Amro Elfeki
 
two degree of freddom system
two degree of freddom systemtwo degree of freddom system
two degree of freddom system
Yash Patel
 
Circuit Network Analysis - [Chapter4] Laplace Transform
Circuit Network Analysis - [Chapter4] Laplace TransformCircuit Network Analysis - [Chapter4] Laplace Transform
Circuit Network Analysis - [Chapter4] Laplace Transform
Simen Li
 
STate Space Analysis
STate Space AnalysisSTate Space Analysis
STate Space Analysis
Hussain K
 
Lecture -Earthquake Engineering (2).pdf
Lecture -Earthquake Engineering (2).pdfLecture -Earthquake Engineering (2).pdf
Lecture -Earthquake Engineering (2).pdf
RayRabara
 
A common random fixed point theorem for rational ineqality in hilbert space ...
 A common random fixed point theorem for rational ineqality in hilbert space ... A common random fixed point theorem for rational ineqality in hilbert space ...
A common random fixed point theorem for rational ineqality in hilbert space ...
Alexander Decker
 
D028036046
D028036046D028036046
D028036046
inventionjournals
 
Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...
journal ijrtem
 
Solution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDMSolution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDM
Syeilendra Pramuditya
 
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
nutkoon
 
discrete_state_spaceeeeeerrrrrrrrrrrrrrrr
discrete_state_spaceeeeeerrrrrrrrrrrrrrrrdiscrete_state_spaceeeeeerrrrrrrrrrrrrrrr
discrete_state_spaceeeeeerrrrrrrrrrrrrrrr
ManhHoangVan
 
Intro Class.ppt
Intro Class.pptIntro Class.ppt
Intro Class.ppt
PrakashDuraisamyCIT
 
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
NUI Galway
 
Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...
Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...
Asymptotic Behavior of Solutions of Nonlinear Neutral Delay Forced Impulsive ...
IOSR Journals
 
A Convergence Theorem Associated With a Pair of Second Order Differential Equ...
A Convergence Theorem Associated With a Pair of Second Order Differential Equ...A Convergence Theorem Associated With a Pair of Second Order Differential Equ...
A Convergence Theorem Associated With a Pair of Second Order Differential Equ...
IOSR Journals
 
Ah unit 1 differentiation
Ah unit 1 differentiationAh unit 1 differentiation
Ah unit 1 differentiation
sjamaths
 
Linear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.comLinear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.com
Abu Bakar Soomro
 
Controllability of Linear Dynamical System
Controllability of  Linear Dynamical SystemControllability of  Linear Dynamical System
Controllability of Linear Dynamical System
Purnima Pandit
 
The Study of the Wiener Processes Base on Haar Wavelet
The Study of the Wiener Processes Base on Haar WaveletThe Study of the Wiener Processes Base on Haar Wavelet
The Study of the Wiener Processes Base on Haar Wavelet
Scientific Review SR
 
DSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and Systems
DSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and SystemsDSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and Systems
DSP_FOEHU - Lec 02 - Frequency Domain Analysis of Signals and Systems
Amr E. Mohamed
 
Lecture 5: Stochastic Hydrology
Lecture 5: Stochastic Hydrology Lecture 5: Stochastic Hydrology
Lecture 5: Stochastic Hydrology
Amro Elfeki
 
two degree of freddom system
two degree of freddom systemtwo degree of freddom system
two degree of freddom system
Yash Patel
 
Circuit Network Analysis - [Chapter4] Laplace Transform
Circuit Network Analysis - [Chapter4] Laplace TransformCircuit Network Analysis - [Chapter4] Laplace Transform
Circuit Network Analysis - [Chapter4] Laplace Transform
Simen Li
 
STate Space Analysis
STate Space AnalysisSTate Space Analysis
STate Space Analysis
Hussain K
 
Lecture -Earthquake Engineering (2).pdf
Lecture -Earthquake Engineering (2).pdfLecture -Earthquake Engineering (2).pdf
Lecture -Earthquake Engineering (2).pdf
RayRabara
 
A common random fixed point theorem for rational ineqality in hilbert space ...
 A common random fixed point theorem for rational ineqality in hilbert space ... A common random fixed point theorem for rational ineqality in hilbert space ...
A common random fixed point theorem for rational ineqality in hilbert space ...
Alexander Decker
 
Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...Positive and negative solutions of a boundary value problem for a fractional ...
Positive and negative solutions of a boundary value problem for a fractional ...
journal ijrtem
 
Solution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDMSolution of simplified neutron diffusion equation by FDM
Solution of simplified neutron diffusion equation by FDM
Syeilendra Pramuditya
 
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
nutkoon
 
discrete_state_spaceeeeeerrrrrrrrrrrrrrrr
discrete_state_spaceeeeeerrrrrrrrrrrrrrrrdiscrete_state_spaceeeeeerrrrrrrrrrrrrrrr
discrete_state_spaceeeeeerrrrrrrrrrrrrrrr
ManhHoangVan
 
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
2013.06.17 Time Series Analysis Workshop ..Applications in Physiology, Climat...
NUI Galway
 
Ad

Recently uploaded (20)

ANTI URINARY TRACK INFECTION AGENT MC III
ANTI URINARY TRACK INFECTION AGENT MC IIIANTI URINARY TRACK INFECTION AGENT MC III
ANTI URINARY TRACK INFECTION AGENT MC III
HRUTUJA WAGH
 
Issues in using AI in academic publishing.pdf
Issues in using AI in academic publishing.pdfIssues in using AI in academic publishing.pdf
Issues in using AI in academic publishing.pdf
Angelo Salatino
 
Integration of AI and ML in Biotechnology
Integration of AI and ML in BiotechnologyIntegration of AI and ML in Biotechnology
Integration of AI and ML in Biotechnology
Sourabh Junawa
 
Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...
Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...
Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...
Professional Content Writing's
 
university of arizona ~ favor's college candidate project.pptx
university of arizona ~ favor's college candidate project.pptxuniversity of arizona ~ favor's college candidate project.pptx
university of arizona ~ favor's college candidate project.pptx
favoranamelechi107
 
Cordaitales - Yudhvir Singh Checked[1].pptx gymnosperms
Cordaitales - Yudhvir Singh Checked[1].pptx gymnospermsCordaitales - Yudhvir Singh Checked[1].pptx gymnosperms
Cordaitales - Yudhvir Singh Checked[1].pptx gymnosperms
ReetikaMakkar
 
Examine human hair for cortex and medulla.
Examine human hair for cortex and medulla.Examine human hair for cortex and medulla.
Examine human hair for cortex and medulla.
NutanRathod6
 
Green Synthesis of Gold Nanoparticles.pptx
Green Synthesis of Gold Nanoparticles.pptxGreen Synthesis of Gold Nanoparticles.pptx
Green Synthesis of Gold Nanoparticles.pptx
Torskal Nanoscience
 
Electroencephalogram_ wave components_Aignificancr
Electroencephalogram_ wave components_AignificancrElectroencephalogram_ wave components_Aignificancr
Electroencephalogram_ wave components_Aignificancr
klynct
 
Components of the Human Circulatory System.pptx
Components of the Human  Circulatory System.pptxComponents of the Human  Circulatory System.pptx
Components of the Human Circulatory System.pptx
autumnstreaks
 
A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...
A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...
A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...
Sérgio Sacani
 
Reticular formation_groups_organization_
Reticular formation_groups_organization_Reticular formation_groups_organization_
Reticular formation_groups_organization_
klynct
 
AP 2024 Unit 1 Updated Chemistry of Life
AP 2024 Unit 1 Updated Chemistry of LifeAP 2024 Unit 1 Updated Chemistry of Life
AP 2024 Unit 1 Updated Chemistry of Life
mseileenlinden
 
ART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan College
ART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan CollegeART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan College
ART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan College
Agin Tom
 
BIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATION
BIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATIONBIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATION
BIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATION
KrishnaShastri7
 
Chapter-10-Light-reflection-and-refraction.ppt
Chapter-10-Light-reflection-and-refraction.pptChapter-10-Light-reflection-and-refraction.ppt
Chapter-10-Light-reflection-and-refraction.ppt
uniyaladiti914
 
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptxA CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
ANJALICHANDRASEKARAN
 
Approach to Upper GASTRO INTESTINAL Bleed.pptx
Approach to Upper GASTRO INTESTINAL Bleed.pptxApproach to Upper GASTRO INTESTINAL Bleed.pptx
Approach to Upper GASTRO INTESTINAL Bleed.pptx
PrabakaranNatarajan10
 
Antimalarial drug Medicinal Chemistry III
Antimalarial drug Medicinal Chemistry IIIAntimalarial drug Medicinal Chemistry III
Antimalarial drug Medicinal Chemistry III
HRUTUJA WAGH
 
Brief Presentation on Garment Washing.pdf
Brief Presentation on Garment Washing.pdfBrief Presentation on Garment Washing.pdf
Brief Presentation on Garment Washing.pdf
BharathKumar556689
 
ANTI URINARY TRACK INFECTION AGENT MC III
ANTI URINARY TRACK INFECTION AGENT MC IIIANTI URINARY TRACK INFECTION AGENT MC III
ANTI URINARY TRACK INFECTION AGENT MC III
HRUTUJA WAGH
 
Issues in using AI in academic publishing.pdf
Issues in using AI in academic publishing.pdfIssues in using AI in academic publishing.pdf
Issues in using AI in academic publishing.pdf
Angelo Salatino
 
Integration of AI and ML in Biotechnology
Integration of AI and ML in BiotechnologyIntegration of AI and ML in Biotechnology
Integration of AI and ML in Biotechnology
Sourabh Junawa
 
Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...
Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...
Discrete choice experiments: Environmental Improvements to Airthrey Loch Lake...
Professional Content Writing's
 
university of arizona ~ favor's college candidate project.pptx
university of arizona ~ favor's college candidate project.pptxuniversity of arizona ~ favor's college candidate project.pptx
university of arizona ~ favor's college candidate project.pptx
favoranamelechi107
 
Cordaitales - Yudhvir Singh Checked[1].pptx gymnosperms
Cordaitales - Yudhvir Singh Checked[1].pptx gymnospermsCordaitales - Yudhvir Singh Checked[1].pptx gymnosperms
Cordaitales - Yudhvir Singh Checked[1].pptx gymnosperms
ReetikaMakkar
 
Examine human hair for cortex and medulla.
Examine human hair for cortex and medulla.Examine human hair for cortex and medulla.
Examine human hair for cortex and medulla.
NutanRathod6
 
Green Synthesis of Gold Nanoparticles.pptx
Green Synthesis of Gold Nanoparticles.pptxGreen Synthesis of Gold Nanoparticles.pptx
Green Synthesis of Gold Nanoparticles.pptx
Torskal Nanoscience
 
Electroencephalogram_ wave components_Aignificancr
Electroencephalogram_ wave components_AignificancrElectroencephalogram_ wave components_Aignificancr
Electroencephalogram_ wave components_Aignificancr
klynct
 
Components of the Human Circulatory System.pptx
Components of the Human  Circulatory System.pptxComponents of the Human  Circulatory System.pptx
Components of the Human Circulatory System.pptx
autumnstreaks
 
A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...
A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...
A Massive Black Hole 0.8kpc from the Host Nucleus Revealed by the Offset Tida...
Sérgio Sacani
 
Reticular formation_groups_organization_
Reticular formation_groups_organization_Reticular formation_groups_organization_
Reticular formation_groups_organization_
klynct
 
AP 2024 Unit 1 Updated Chemistry of Life
AP 2024 Unit 1 Updated Chemistry of LifeAP 2024 Unit 1 Updated Chemistry of Life
AP 2024 Unit 1 Updated Chemistry of Life
mseileenlinden
 
ART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan College
ART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan CollegeART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan College
ART.pdf. Agin Tom, clinical Psychology, Prajyoti Niketan College
Agin Tom
 
BIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATION
BIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATIONBIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATION
BIODIESEL AND ROLEs OF GLYCEROL PRODUCTION AND APPLICATION
KrishnaShastri7
 
Chapter-10-Light-reflection-and-refraction.ppt
Chapter-10-Light-reflection-and-refraction.pptChapter-10-Light-reflection-and-refraction.ppt
Chapter-10-Light-reflection-and-refraction.ppt
uniyaladiti914
 
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptxA CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
ANJALICHANDRASEKARAN
 
Approach to Upper GASTRO INTESTINAL Bleed.pptx
Approach to Upper GASTRO INTESTINAL Bleed.pptxApproach to Upper GASTRO INTESTINAL Bleed.pptx
Approach to Upper GASTRO INTESTINAL Bleed.pptx
PrabakaranNatarajan10
 
Antimalarial drug Medicinal Chemistry III
Antimalarial drug Medicinal Chemistry IIIAntimalarial drug Medicinal Chemistry III
Antimalarial drug Medicinal Chemistry III
HRUTUJA WAGH
 
Brief Presentation on Garment Washing.pdf
Brief Presentation on Garment Washing.pdfBrief Presentation on Garment Washing.pdf
Brief Presentation on Garment Washing.pdf
BharathKumar556689
 
Ad

SPSF04 - Euler and Runge-Kutta Methods

  • 1. 1 Programming, Computation, Simulation Applications in Math & Physics Euler and Runge-Kutta Methods Ordinary Differential Equations & Initial Value Problems Syeilendra Pramuditya Department of Physics Institut Teknologi Bandung
  • 2. Grid-based Computation  Euler-type Methods  Differential equations  Temporal domain (variation in time)  Initial conditions  Finite Difference Methods  Differential equations  Spatial domain (variation in space)  Boundary conditions: Von Neumann VS Dirichlet
  • 3. 3 Differential Equation 2 ( ) ( , ) 1 ( 0) 0 ( ) ..? dy y x f x y x dx y x y x        
  • 4. 4 Differential Equation 2 ( ) ( , ) 1 ( 0) 0 dy y x f x y x dx y x        2 3 3 Exact Solution ( 1) 1 3 ( 0) 0 0 1 ( ) ( , ) 3 dy x dx y x x C y x C y x f x y x x              
  • 5. 5 Differential Equation 1 ( ) ( , ) ( 1) 0 ( ) ..? dy y x f x y dx x y x y x       
  • 6. 6 Differential Equation 1 ( ) ( , ) ( 1) 0 dy y x f x y dx x y x       Exact Solution 1 ln( ) ( 1) 0 0 ( ) ( , ) ln( ) dy dx x y x C y x C y x f x y x           
  • 7. 7 Differential Equation 2 1 ( ) ( , ) 1 ( 0) 0 ..??? dy y x f x y x dx y y x y         
  • 8. Euler Methods  Linear approx. of Taylor series  “Simple Euler” 0 x x 0 ( ) f x ( ) f x   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ( ) ( ) ( ) ( , ) ( ) ( ) ( ) ( ) ( ) ( , ) ( ) ( ) ( , ( )) ( ) y x y x y x f x y x x y x y x x x y x x x h y x h y x hf x y y x h y x hf x y x y x h y hf                     0 0 0 ( ) ( , ) y y x f x y x     
  • 9. 9 Ordinary Differential Equation (ODE) 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) ( , ) new old old old y x h y x hf x y y x h y hf y y hf x y          Solve the above ODE numerically (find y(x)) using Simple Euler method (for 1<x<10), use h = 1.0 and h = 0.5  How good the numerical solution is? 1 ( ) ( , ) ( 1) 0 dy y x f x y dx x y x      
  • 10. Simple Euler Code 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) ( , ) new old old old y x h y x hf x y y x h y hf y y hf x y         Solve the ODE numerically (find y(x)) using Simple Euler method (for 1<x<10), use h = 1.0 and h = 0.5 1 ( ) ( , ) ( 1) 0 dy y x f x y dx x y x      
  • 11. Exact VS Numeric 0 0.5 1 1.5 2 2.5 3 0 2 4 6 8 10 Exact Euler, h = 1.0 Euler, h = 0.5
  • 12. Euler Methods  Linear approx. of Taylor series  “Modified Euler” Use more correct gradient 0 x x 0 ( ) f x ( ) f x   0 0 0 0 0 0 0 0 0 0 ( ) ( ) ( ) ( ) ( ) ( , ) 2 ( ) 2 2 ( ) mid mid mid mid mid mid mid y x y x x x y x y x h y x hf x y h x x h y y x h y y f y x h y hf                
  • 13. Modified Euler   0 0 0 0 0 0 0 0 0 0 ( ) ( ) ( ) ( ) ( ) ( , ) 2 ( ) 2 2 ( ) mid mid mid mid mid mid mid y x y x x x y x y x h y x hf x y h x x h y y x h y y f y x h y hf                
  • 14. Euler Methods  Linear approx. of Taylor series  “Improved Euler” Use more correct gradient 0 x x 0 ( ) f x ( ) f x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ( ) ( , ) ( ) ( , ) ( ) ( ) ( ) 2 ( , ) ( , ) 2 ( , ) ( , ( , )) ( ) ( ) avg avg avg y x f x y y x f x y y hf y x y x y x f x y f x y f f x y f x h y hf x y y x h y x hf                   
  • 15. Improved Euler 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ( ) ( , ) ( ) ( , ) ( ) ( ) ( ) 2 ( , ) ( , ) 2 ( , ) ( , ( , )) ( ) ( ) avg avg avg y x f x y y x f x y y hf y x y x y x f x y f x y f f x y f x h y hf x y y x h y x hf                   
  • 16. 2nd Order Runge-Kutta (RK2) 1 0 0 1 2 0 0 0 0 2 ( , ) ( , ) ( , ) 2 2 ( ) dy y f x y dx k hf x y k h k hf x y y x h y k          
  • 17. 4th Order Runge-Kutta (RK4)   1 0 0 2 0 0 1 3 0 0 2 4 0 0 3 0 0 1 2 3 4 4th Order Runge-Kutta ( , ) ( , ) ( , ) 2 2 ( , ) 2 2 ( , ) ( ) 2 2 6 dy y f x y dx k f x y h h k f x y k h h k f x y k k f x h y hk h y x h y k k k k                   
  • 18. Exact VS Numeric  Simple Euler (h = 0.2)
  • 19. Exact VS Numeric  Modified Euler (h = 0.2)
  • 20. Exact VS Numeric  Improved Euler (h = 0.2)
  • 21. Exact VS Numeric  RK4 (h = 0.2)
  • 22. 22 Block-Spring System ( ) ( , ) ( ) ( ) ( , ) ( ) F ma dv F k a x dt m m dv k k x v t f x t x t dt m m dx v x t f v t v t dt                 
  • 23. 23 Block-Spring System         0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 1 1 ( ) ( ) ( ) ( ) ( , ) 1 1 ( ) ( ) ( ) ( ) ( , ) 1 1 2 2 t t v v at v t v v t t v t v t v f v t t t dv k v t v t v x dt m x x vt x t x x t t x t x t x f x t t t dx x t x t x v dt E mv kx                                           0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) y x h y x hf x y y x h y hf      
  • 24. 24 Block-Spring System (Simplified) 1 2 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 2 2 ( ) ( , ) ( ) ( ) ( , ) ( ) ( ) ( ) ( , ) ( ) ( , ) ( ) 1 1 2 2 dv k v t f t v x t dt m dx x t f t x v t dt kx t kx v t t v t f t v v t v t m m x t t x t f t x x tv t x tv E mv kx                                                  0 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) y x h y x hf x y dy y x h y hf y h dx        
  • 25. 25 Block-Spring System (Simplified) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 1 1 2 2 dv k v t x t dt m dx x t v t dt kx t kx v t t v t v t v t v t m m x t t x t x t x tv t x tv E mv kx                                                  0 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) y x h y x hf x y dy y x h y hf y h dx        
  • 26. 26 Block-Spring System (Simplified) 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 ( ) ( ) ( ) 1 1 2 2 kx dv F v t t v t v a t v t v t dt m m k v t t v x t m dx x t t x t x v t dt E mv kx                               0 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) y x h y x hf x y dy y x h y hf y h dx        
  • 27. 27 Block-Spring System 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 Simple Euler ( , ) ( ) ( ) ( ) ( , ) ( , ) ( , ) ( ) ( ) ( , ) ( ) ( , ) new old old new old dx x t x f t v t dt x t t x t x t x x tv t v x tv x x tv dv k v t v f t x t dt m kx t x kx v t t v t v t v v t v t m m v v t                                                         2 2 1 1 2 2 old kx m E mv kx        
  • 28. Block-Spring System  Analytic Solution ( ) cos( ) ( ) sin( ) m m x t x t v t v t         
  • 29. 29 Write a Simple Euler Code  m = k = 1  0 < t < 20 sec  dt = 0.2  x(t=0) = 1  v(t=0) = 0  Calculate x(t) and v(t) using Simple Euler  Output: time,x(t),x_exact,v(t),v_exact,Em 0 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) y x h y x hf x y dy y x h y hf y h dx         0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 ( ) ( ) ( ) 1 1 2 2 kx dv F v t t v t v a t v t v t dt m m k v t t v x t m dx x t t x t x v t dt E mv kx                              
  • 30. Simple Euler Code 0 0 0 0 0 0 2 2 ( ) ( ) 1 1 2 2 k v t t v x t m x t t x v t E mv kx            
  • 32. Gnuplot Script # Script to plot 1D dataset reset unset label unset key set key left top set xrange [0:10] set yrange [-3:3] set title "Plot Image" set xlabel "X Value" set ylabel "Y Value" set terminal wxt size 600,400 font "Verdana,10" plot 'output.txt' using 2:3 title "Numeric" with linespoints pointtype 6 lw 1 lc 7, 'output.txt' using 2:4 title "Analytic" with linespoints pointtype 6 lw 1 lc 6
  • 36. 36 Block-Spring System 1 2 0 0 1 0 0 0 0 0 2 0 0 0 0 0 1 0 0 2 Modified Euler ( , ) ( ) ( ) ( , ) ( ) ( ) ( ) ( ) 2 2 2 ( ) ( ) 2 2 2 ( ) ( ) ( ) ( ) mid mid mid mid dx x t x f t v t dt dv k v t v f t x t dt m t t t x x t x f t x v t t t k v v t v f t v x m x t t x t f t v t t v t f t                                            
  • 40. Mass-Spring System  2nd Order Runge-Kutta (RK2) 1 0 0 1 2 0 0 0 0 2 ( ) ? ( , ) ( , ) ( , ) 2 2 ( ) q t dq q f t q dt k dt f t q k dt k dt f t q q t dt q k              1 0 0 1 2 0 0 0 0 2 ( ) ? ( , ) ( , ) ( , ) 2 2 ( ) y x dy y f x y dx k hf x y k h k hf x y y x h y k            y(x) x q(t) t
  • 41. Mass-Spring System  2nd Order Runge-Kutta (RK2) 1 ( ) ? ( , ) ( ) x t dx x f t x v t dt      x(t) t v(t) t 2 ( ) ? ( , ) ( ) v t dv k v f t v x t dt m      
  • 42. Mass-Spring System  2nd Order Runge-Kutta (RK2) 1 0 0 1 2 0 0 0 0 2 ( ) ? ( , ) ( , ) ( , ) 2 2 ( ) q t dq q f t q dt k dt f t q k dt k dt f t q q t dt q k              1 1 1 2 1 2 2 ( ) ( ) ( ) ( ) ( ) ( ) 2 2 ( ) ( ) ( ) ( ) 2 2 2 ( ) ( ) 2 ( ) ( ) ( ) ( ) ( ) 2 dx x f t v t dt k t f t t v t t t k t f t t v t t t t k v t v t v v t x t m t k k t v t x t m t k x t t x t k x t t v t x t m                                                              
  • 43. Mass-Spring System  2nd Order Runge-Kutta (RK2) 1 0 0 1 2 0 0 0 0 2 ( ) ? ( , ) ( , ) ( , ) 2 2 ( ) q t dq q f t q dt k dt f t q k dt k dt f t q q t dt q k              2 1 2 2 2 2 2 ( ) ( ) ( ) ( ) ( ) ( ) 2 2 ( ) ( ) ( ) ( ) 2 2 2 ( ) ( ) 2 ( ) ( ) ( ) ( ) ( ) 2 dv k v f t x t dt m k k t f t t x t m t k t k t f t t x t m t t t x t x t x x t v t k t k t x t v t m k t v t t v t k v t t x t v t m                                                             
  • 47. 4th Order Runge-Kutta (RK4)   1 0 0 2 0 0 1 3 0 0 2 4 0 0 3 0 0 1 2 3 4 ( , ) ( , ) ( , ) 2 2 ( , ) 2 2 ( , ) ( ) 2 2 6 dy y f x y dx k f x y h h k f x y k h h k f x y k k f x h y hk h y x h y k k k k                    1 2 ( ) ( ) ( ) ( ) ( ) ? ( ) ? dx x f t v t dt dv k v f t x t dt m x t dt v t dt             
  • 49. 49 Damped Mass-Spring System F ma kx cv dv F kx cv a dt m m dv k c x v dt m m dx v dt             
  • 50. 50 Damped Mass-Spring System           0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 1 1 ( ) ( ) ( ) ( ) ( , ) 1 1 ( ) ( ) ( ) ( ) ( , ) 1 1 2 2 t t v v at v t v v t t v t v t v f v t t t dv v t v t v x cv dt x x vt x t x x t t x t x t x f x t t t dx x t x t x v dt E mv kx                                           
  • 51. 51 Damped Oscillation  m = k = 1  0 < t < 20 sec  dt = 0.2  x(t=0) = 1  v(t=0) = 0  c = 0.15  Calculate x(t) and v(t) using Euler Method  Output: time,x(t),x_exact,v(t),v_exact,Em 0 0 0 0 0 0 0 0 ( ) ( ) ( , ) ( ) y x h y x hf x y dy y x h y hf y h dx         0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 ( ) ( ) ( ) 1 1 2 2 kx cv dv F v t t v t v a t v t v t dt m m kx cv v t t v t m dx x t t x t x v t dt E mv kx                                 
  • 52. 52 Damped Oscillation (Mod. Euler) -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2 0 5 10 15 20 TIme Position
  • 53. Damped Oscillation: Analytical Solution  Halliday-Resnick, Chapter 15
  • 54. Type of Damped Oscillation
  • 55. Type of Damped Oscillation
  • 56. LC Oscillation 2 2 0 d x k x dt m  
  • 57. Damped LC Oscillation (RLC Circuit)  The RLC Circuit 2 2 0 d x c dx k x dx m dt m   
  • 58. Self-Practice for Interested Students  Ideal/undamped oscillating systems  Mass-spring systems  RLC systems  Modified / Improved Euler Methods  RK2 / RK4 Methods  Damped oscillating systems  Mass-spring systems  RLC systems  Modified / Improved Euler Methods  RK2 / RK4 Methods  Underdamped / Overdamped / Critically damped
  翻译: