## Example to show how numerical ODE solutions can be used to find integrals

In a previous post, I enumerated how we can use numerical ODE techniques like Euler and Runge-Kutta methods to find approximate value of definite integrals. Here is an example. Be sure to do the exercises at the end of the post to appreciate the procedure.

_____________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu

## Comparing Runge-Kutta 2nd order methods

Many a times, students ask me

Which of the Runge-Kutta 2nd order methods gives the most accurate answer to solving a first order ODE?

dy/dx=f(x,y), y(0)=y0

There is no direct answer, although Ralston’s method gives a minimum bound for the truncation error (Ralston, A., Runge-Kutta Methods with Minimum Error Bounds, Match. Compu., Vol 16, page 431, 1962).

They also ask me if using the first three terms of the Taylor series would give a more accurate answer if we calculate $f^{\prime}(x,y)$ symbolically.

The equations for the four methods are given below

Here is the comparison graph for

dy/dx=sin(5*x)-0.4*y, y(0)=5

with

step size of h=1.1

and

step size of h=0.55

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu

## Can I use numerical solution of ODE techniques to do numerical integration?

Yes.

If you are finding the value of the $y=\int_{a}^{b} f(x) dx$, then we can solve the integral as an ordinary differential equation as

dy/dx=f(x), y(a)=0

We can now use any of the numerical techniques such as Euler’s methods and Runge-Kutta methods to find the value of y(b) which would be the approximate value of the integral. Use exact techniques of solving linear ODEs with fixed coefficients such as Laplace transforms, and you can have the exact value of the integral.

_____________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu

## Time of death – a classic ODE problem

One of the classical applied problems in ordinary differential equations is that of finding the time of death of a homicide victim.

The estimation of time of death is generally based on the temperature of the body at two times – 1) when the victim is found and 2) then a few hours later. Assuming the ambient temperature stays the same and the body is treated as a lumped system, one can use a simple linear ODE to solve the problem.

It is somewhat an inverse problem as we are trying to find the value of the independent variable – the time of death. Here is a solved problem (a pdf version also available).

_____________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu

## Data for aluminum cylinder in iced water experiment

A colleague asked me what if he did not have time or resources to do the experiments that have been developed at University of South Florida (USF) for numerical methods. He asked if I could share the data taken at USF.

Why not – here is the data for the experiment where an aluminum cylinder is placed in iced water. This link also has the exercises that the students were asked to do.

The temperature vs time data is as follows: (0,23.3), (5,16.3), (10,13), (15,11.8), (20,11), (25,10.7), (30,9.6), (35,8.9), (40,8.4). Time is in seconds and temperature in Celcius. Other data needed is

Ambient temperature of iced water = 1.1oC

Diameter of cylinder = 44.57 mm

Length of cylinder = 105.47 mm

Density of aluminum = 2700 kg/m3

Specific heat of aluminum = 901 J/(kg-oC)

Thermal conductivity of aluminum = 240 W/(m-K)

Table 1. Coefficient of thermal expansion vs. temperature for aluminum (Data taken from http://www.llnl.gov/tid/lof/documents/pdf/322526.pdf by using mid values of temperatures at which CTE is reported)

 Temperature (oC) Coefficient of thermal expansion (μm/m/oC) -10 58 12.5 59 37.5 60 62.5 62 87.5 66 112.5 71

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu