Differential equations 1
YouTube lecture recording from October 2020
The following YouTube video was recorded for the 2020 iteration of the course.
The material is still very similar:
Separation of Variables
What is a Differential Equation?
If is a variable that depends on the variable , then a differential equation in and is one that relates to , to , or to both.
We write
How do we Find the Solutions to a Differential Equation?
The simplest differential equations are very similar to integration.
Since all the terms in (just the derivative in this case) on the left, and all the terms involving on the right.
Then we integrate both sides
The general solution to this equation is
where and are a arbitrary constants.
If we are given the initial conditions, say, when (often written as ),
we can determine the value for the constants; in this example .
This approach can be generalised into what is known as the Separation of Variables Method.
Separation of variables: example 1
The equation is already separated, with all terms in (just the derivative in
this case) on the left, and terms involving on the right.
We then integrate both sides with respect to :
Initial conditions
If we are told that , can we calculate ?
We have that
so:
>
Is this right? Here's an example of how we can use SciPy's
odeint
method to numerically solve differential equations:import scipy import numpy as np c = 1.0 A = -1.0 x0 = 1.0 x1 = 10.0 x = np.linspace(x0,x1,100) y_exact = x**2 + c*x + A def dydx(y, x): return 2*x + c y_numerical = scipy.integrate.odeint(dydx, c, x)
Separation of variables: example 2
Separate the variables so that all the terms in are on one side of the equation and all the terms in are on the other side:
Integrating both sides with respect to :
Now integrate on each side:
So:
Separation of variables: example 3
Rearrange to get:
We have
Now integrate by parts, ,
with and :
Let's check this answer: .
Substitute in initial conditions gives
c3 = 2.0 x0 = 0.0 x1 = 1.0 x = np.linspace(x0,x1,100) y_exact = np.sqrt(-2*np.exp(-x)*(1 + x) + c3) def dydx(y, x): return np.exp(-x) * x / y y_numerical = scipy.integrate.odeint(dydx, 1e-8, x) # why 1e-8 instead of zero?
Real-world example 1: biochemistry
The Michaelis-Menten equation relates the rate of an enzyme reaction to its
substrate concentration, and has the form (if there is a large quantity of
enzyme):
where is the substrate concentration, and and are constants.
By integration, we will derive expressions relating substrate concentration to time when
- when
- when
and sketch the graphs of against in each case.
Case 1
When , in the differential equation's denominator can be neglected:
The rate of change in concentration is a constant, so this is a zeroth order process.
We can integrate directly to obtain
where is a constant of integration.
If , then .
The graph thus has slope and crosses the vertical axis at .
Case 2
When , in the differential equation's denominator can be neglected:
The rate of change in concentration depends on the concentration, so this is a first order process.
> >
On a graph crosses the vertical axis at and decreases with time exponentially.
Lets look at this numerically using the original equation:
As changes in value, we can see how the behaviour of changes:
K=0.2:
K=1.0:
Real-world example 2: bacterial growth
Suppose the growth rate of a bacterial colony is proportional to its size,
and that we observe that the colony triples in size after 10 hours.
How long will it take to reach 11 times its original size?
Let represent the number of bacteria, and suppose there are at time .
We are given that when hours, , and need to find the time at which .
The equation of growth is:
We can solve this to obtain Using the condition, we have that so
We can use the data from to find
To find when :
Real-world example 3: radioactive decay
The rate at which a sample decays is proportional to the amount left, i.e.
where is the mass of radioactive atoms at time and is called the decay constant.
The element radium (atomic mass=226) has a decay constant of s.
Solving the differential equation via separation of variables, we obtain the general solution
Consider an arbitrary initial condition: at , Then:
Substituting in (1) gives the solution
The half-life, is the time taken for to reduce by half.
Putting and in (2) we get
>
Note that this time is independent of the initial value ,
The half-life for radium is thus or about 1600 years.
Real-world example 4: more biochemistry
The power to which the concentration of a species is raised in a rate law
is the order of the process/reaction with respect to that species.
A reaction with the rate law
is first order in and first order in .
The overall order of a process/reaction is the sum of the orders of all the
components. This rate law is thus second-order overall.
Note that this is different from the order of an ODE, which is given by the
highest derivative.
Both zeroth and first order processes are modelled below by first order
differential equations.
(A) Zeroth order processes
- rate of change is independent of concentration, i.e. the rate of change is proportional to concentration raised to power zero
>
General solutions:
>
(B) First order processes
The rate of change depends on the concentration of one species, i.e. the rate of change is proportional to concentration raised to first power.
Half-life is a constant, i.e. it is independent of the amount there at the beginning.
>
General solutions:
>
When the two different solutions look like this:
Introductory problems
Introductory problems 1
Find the general solutions of the following differential equations:
Check your answers by differentiating them.
Introductory problems 2
Find the solution to the following differential equations subject to the specified boundary conditions:
Use Python's
scipy.integrate.odeint
to verify your solutions# hint import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # you need a function that calculates dy/dt def dydx(y,x): return 1 / x y0 = 0 # <-- the y-value of the initial condition x0 = 2 # <-- the x-value of the initial condition # the x-values at which to calculate the solution x = np.linspace(x0, x0 + 10, 1000) # solve ODE numerically y = odeint(dydx, y0, x) # plot the numerical solution and your hand-calculated # solution, and check that they agree
Main problems
Main problems 1
The number of bacteria present in a given culture increases at a rate proportional to the number present.
When first observed, the culture contained bacteria, and two hours later it contained .
- Find the number present hours after observations began.
- How long did it take for the number of bacteria to triple?
- Sketch a curve of the solution to the equation that you derive.
- What assumptions are implicit in this model of bacterial growth?
Main problems 2
Solve:
- . Find such that
Main problems 3
In a certain chemical reaction, substance is transformed into product .
The mass of at any given time, , is , and the rate of transformation of at time is proportional to .
Given that the original mass of is 130g, and that 50g has been transformed after 150 seconds:
- Form and solve the differential equation relating to .
- Find the mass of transformed over a 300s period.
- Sketch a graph of versus .
Main problems 4
Newton's law of cooling states that the rate of decrease of the temperature of a body is proportional to the amount by which its temperature exceeds the temperature of its surroundings.
If is the initial temperature of a body, is the temperature of its surroundings, and is the temperature of the body at time :
- Form a differential equation for Newton's Law of cooling.
- Show that , where is a constant, and state the units of the constant .
- Glycerol is to be added to a protein sample prior to storage. The glycerol is heated to to aid accurate pipetting. To avoid denaturation of the sample, the glycerol must then be allowed to cool to below before being added to the protein. If the ambient temperature is , the glycerol cools to at time minutes. At what time can the glycerol be added to the protein?
- Using a choice of axes that will allow you easily to predict the temperature of the glycerol, sketch a graph of the anticipated variation of the glycerol temperature with time.
- Once the glycerol has been added to the protein, will the rate of cooling be described by the same constant ? Give reasons for your answer.
Main problems 5
The amount of (radioactive carbon-14) in a sample is measured using a Geiger counter, which records each disintegration of an atom.
The rate at which decays is proportional to the amount present.
The half-life of is about 5730 years.
This means that half of the sample will have disintegrated after 5730 years.
In living tissue, disintegrates at a rate of about 13.5 atoms per minute per gram of carbon.
Because living tissue is constantly exchanging carbon with its environment, the proportion of among its carbon atoms remains constant over time.
Once the tissue is no longer living, this constant exchange of carbon ceases and the fraction of among its carbon atoms begins to get smaller.
Consequently, the disintegration rate drops.
In 1977 a charcoal fragment found at Stonehenge on the Salisbury Plain recorded 8.2 disintegrations per minute per gram of carbon: about 60% of that for living tissue.
Assuming that the charcoal was formed during the building of the site, use this information to estimate the date at which Stonehenge was built.
Extension problems
Extension problems 1
The absorbance of a solution is given by the equation:
where is the intensity of the light impinging on the solution (incident light) and is the intensity of the light emerging from it (transmitted light).
The Beer-Lambert law states that
where is the absorbance of the solute, is the concentration of the solute and is the distance that the light has travelled through the solution.
- The transmittance is defined as the fraction of incident light transmitted through the solution (). Derive an expression relating the transmittance, , of the solution to , and .
- The attenuation of the light beam is defined as the difference between the intensities of the incident and the transmitted light (). Derive an expression for the attenuation of the light beam when a beam of light intensity traverses a distance through a solution of fixed concentration . Sketch a graph showing the dependence of on in a solution of fixed concentration.
- ATP has a molar absorbtion of . Calculate the initial rate (in watts/cm) at which light intensity is attenuated when a light beam of intensity 200 watts enters a solution of ATP. What would happen to this rate if i. the concentration of ATP is doubled; i. the intensity of the incident light is doubled; i. the length of the cell holding the solution is doubled?