Numerical methods and
computation Physics
Course code: PHC023P1M
Credits: 2-0-2
Instructions: Dr. Sanat Kumar Tiwari
TA: Ab Rauoof Wani
Numerical integration - Error correction - Rechardson’s extrapolation
Numerical di
ff
erentiation: basics
What we learnt in previous lecture?
Rechardson’s extrapolation
How the expression takes form for step size = ?
h2 h1/2
I(h) = the approximation of the trapezoidal rule with step size h = (b - a)/n,
For two step sizes and :
h1 h2
Numerical differentiation: Example
• Fourier’s law of heat conduction quanti
fi
es the observation that
heat
fl
ows from regions of high to low temperature
• Gradient/Derivative tells the direction of
fl
ow of the heat.
q(x) = − κ
dT
dx
Numerical differentiation: Example
• Fourier’s law of heat conduction quanti
fi
es the observation that
heat
fl
ows from regions of high to low temperature
• Gradient/Derivative tells the direction of
fl
ow of the heat.
q(x) = − κ
dT
dx
Engineering equations with derivatives
Numerical differentiation
Numerical differentiation
• A simple example for the
fi
rst derivative:
• We are aware, it comes from the Taylor’s expansion, let’s
calculate the error
• Based on formula, let’s re-write the
fi
rst derivative:
Numerical differentiation: Why we need it?
• Even for known functional forms that we need to di
ff
erentiate, the
data is usually sampled without knowing the function itself.
• There are some cases where we have is a discrete data set only.
We may still be interested in studying changes in the data
through derivatives.
• At times, exact formulas are available but are complicated and
di
ff
erentiation requires a lot of function evaluations. It is simpler
to approximate the derivative instead.
• When approximating solutions to ordinary (or partial) di
ff
erential
equations, we typically represent the solution as a discrete
approximation that is de
fi
ned on a grid.
Taylor’s series
Numerical differentiation: First derivative
Forward di
ff
erence
Backward di
ff
erence
Central di
ff
erence
First derivative: Central difference: Derivation
Aim is to get
fi
rst derivative, so subtract second eqn from 1st
First derivative: the accuracy vs grid points
i i + 1 i + 2 i + 3
i − 1
i − 2
i − 3
i + 3
First derivative: the accuracy vs grid points
i i + 1 i + 2 i + 3
i − 1
i − 2
i − 3
• A th order derivative needs minimum data points on
stencil
• The order of accuracy of nth derivative can be improved taking
into accounts grid points more than
n n + 1
n + 1
Second derivative: the accuracy vs grid points
i i + 1 i + 2 i + 3
i − 1
i − 2
i − 3
• A th order derivative needs minimum data points on
stencil
• The order of accuracy of nth derivative can be improved taking
into accounts grid points more than
n n + 1
n + 1
Second derivative: the forward difference
i i + 1 i + 2 i + 3
i − 1
i − 2
i − 3
Forward di
ff
erence
Second derivative: Forward difference
Forward di
ff
erence
Second derivative: Central difference
i i + 1 i + 2 i + 3
i − 1
i − 2
i − 3
Central di
ff
erence
Second derivative: Central difference
Central di
ff
erence
First derivative: FD: accuracy
O(h2
)
Forward di
ff
erence
i i + 1 i + 2 i + 3 i + 4 i + 6
i + 5
First derivative: FD: accuracy
O(h2
)
Forward di
ff
erence
Queries/concerns
sanat.tiwari@iitjammu.ac.in
Course LMS page
https://lms.iitjammu.ac.in/course/view.php?id=233

L10_Numerical_Differentiation_PHC023P1M.pdf

  • 5.
    Numerical methods and computationPhysics Course code: PHC023P1M Credits: 2-0-2 Instructions: Dr. Sanat Kumar Tiwari TA: Ab Rauoof Wani
  • 6.
    Numerical integration -Error correction - Rechardson’s extrapolation Numerical di ff erentiation: basics What we learnt in previous lecture?
  • 7.
    Rechardson’s extrapolation How theexpression takes form for step size = ? h2 h1/2 I(h) = the approximation of the trapezoidal rule with step size h = (b - a)/n, For two step sizes and : h1 h2
  • 8.
    Numerical differentiation: Example •Fourier’s law of heat conduction quanti fi es the observation that heat fl ows from regions of high to low temperature • Gradient/Derivative tells the direction of fl ow of the heat. q(x) = − κ dT dx
  • 9.
    Numerical differentiation: Example •Fourier’s law of heat conduction quanti fi es the observation that heat fl ows from regions of high to low temperature • Gradient/Derivative tells the direction of fl ow of the heat. q(x) = − κ dT dx
  • 10.
  • 11.
  • 12.
    Numerical differentiation • Asimple example for the fi rst derivative: • We are aware, it comes from the Taylor’s expansion, let’s calculate the error • Based on formula, let’s re-write the fi rst derivative:
  • 13.
    Numerical differentiation: Whywe need it? • Even for known functional forms that we need to di ff erentiate, the data is usually sampled without knowing the function itself. • There are some cases where we have is a discrete data set only. We may still be interested in studying changes in the data through derivatives. • At times, exact formulas are available but are complicated and di ff erentiation requires a lot of function evaluations. It is simpler to approximate the derivative instead. • When approximating solutions to ordinary (or partial) di ff erential equations, we typically represent the solution as a discrete approximation that is de fi ned on a grid.
  • 14.
  • 15.
    Numerical differentiation: Firstderivative Forward di ff erence Backward di ff erence Central di ff erence
  • 16.
    First derivative: Centraldifference: Derivation Aim is to get fi rst derivative, so subtract second eqn from 1st
  • 17.
    First derivative: theaccuracy vs grid points i i + 1 i + 2 i + 3 i − 1 i − 2 i − 3
  • 18.
  • 19.
    First derivative: theaccuracy vs grid points i i + 1 i + 2 i + 3 i − 1 i − 2 i − 3 • A th order derivative needs minimum data points on stencil • The order of accuracy of nth derivative can be improved taking into accounts grid points more than n n + 1 n + 1
  • 20.
    Second derivative: theaccuracy vs grid points i i + 1 i + 2 i + 3 i − 1 i − 2 i − 3 • A th order derivative needs minimum data points on stencil • The order of accuracy of nth derivative can be improved taking into accounts grid points more than n n + 1 n + 1
  • 21.
    Second derivative: theforward difference i i + 1 i + 2 i + 3 i − 1 i − 2 i − 3 Forward di ff erence
  • 22.
    Second derivative: Forwarddifference Forward di ff erence
  • 23.
    Second derivative: Centraldifference i i + 1 i + 2 i + 3 i − 1 i − 2 i − 3 Central di ff erence
  • 24.
    Second derivative: Centraldifference Central di ff erence
  • 25.
    First derivative: FD:accuracy O(h2 ) Forward di ff erence i i + 1 i + 2 i + 3 i + 4 i + 6 i + 5
  • 26.
    First derivative: FD:accuracy O(h2 ) Forward di ff erence
  • 31.