MagicJigPipe
International Hazard
Posts: 1554
Registered: 19-9-2007
Location: USA
Member Is Offline
Mood: Suspicious
|
|
Differential Equation?
I am trying to solve what I think is a differential equation but I can't determine how.
I am trying to "make" an equation for the amount of drug in a user's bloodstream at various times. But the catch is that the user is taking a certain
dose (d) every amount of time (t). I treated it as a rate in - rate out equation where:
dQ/dt = rate in - rate out
Q = amount of drug in user
t = time elapsed
P = dosing period
HL= half-life of drug
rate in = (dose)/(P)
rate out = (??)/(P)
?? = dose + Q*(.5)^(t/HL) ??
I can't seem to get this equation into a form to solve it. It better not be separable b/c I've been looking at it for about an hour.
Is the setup correct? If so, how do I solve the diff. eq. And don't make fun of me, math isn't my strongest subject and I tend to make mistakes
without seeing them readily.
Thanks in advance.
[Edited on 3-23-2010 by MagicJigPipe]
"There must be no barriers to freedom of inquiry ... There is no place for dogma in science. The scientist is free, and must be free to ask any
question, to doubt any assertion, to seek for any evidence, to correct any errors. ... We know that the only way to avoid error is to detect it and
that the only way to detect it is to be free to inquire. And we know that as long as men are free to ask what they must, free to say what they think,
free to think what they will, freedom can never be lost, and science can never regress." -J. Robert Oppenheimer
|
|
pantone159
National Hazard
Posts: 590
Registered: 27-6-2006
Location: Austin, TX, USA
Member Is Offline
Mood: desperate for shade
|
|
So you mean something like:
Q decreases at a rate proportional to Q, but then add a constant dose rate d (?)
That would give:
dQ/dt = -k*Q + d
where k is the decay rate, and d is the dose rate.
(k is related to the half-life by k = ln2 / half-life).
The easiest way to solve this, is to change to a new variable, which you make up, which is Q plus a constant. Say,
W = Q + b
where W is the new variable, and b is the constant (which you don't know yet.)
Then, dW/dt = dQ/dt, since b is constant, and you can rewrite as:
dW/dt = -k * (W - b) + d = -k*W + (d + k*b)
Now you pick your b: If you choose b = -d/k, then this simplifies to:
dW/dt = -k * W
(since you made up W in the first place, you are free to choose any b you like!)
This has the trivial solution:
W(t) = W(0) * exp (-k*t)
or
Q(t) - d/k = (Q(0) - d/k) * exp (-k*t)
or
Q(t) = (Q(0) - d/k) * exp (-k*t) + d/k
Notice that at t=0, you get Q = Q(0) as you should.
This is, btw, basically the same equation as for mortgage interest, except in that case, Q increases at a rate proportional to itself (interest on the
debt), but with a constant decrease on top of that (constant rate of paying the note), all in all just a different sign.
|
|
MagicJigPipe
International Hazard
Posts: 1554
Registered: 19-9-2007
Location: USA
Member Is Offline
Mood: Suspicious
|
|
Thank you very much. It would've taken me hours to figure that out.
Wait, let's say a drug had a half-life of 4 hours. Then you took 10 mg every 4 hours. The limit as t approaches infinity should be, of course, 20
mg. But, at 4 hours (right after the second dose) you should have 15 mg of drug in the bloodstream. This equation, however, gives:
12.21 mg.
I'm probably writing it down wrong. Be right back.
EDIT
For example:
Using k = 0.173 (ln(2)/4)
and d = 2.5 (10mg/4hrs)
I get the lim as t->inf is 14.45 mg
with d = 4 I get 23.12 mg
I should be getting 20 mg, right?
2nd EDIT
I have found that the equation:
d*(1-exp(-kt))+Q(0)
Gives the correct results.
3rd EDIT
Nevermind. That only works when HL = Dosing period
[Edited on 3-23-2010 by MagicJigPipe]
"There must be no barriers to freedom of inquiry ... There is no place for dogma in science. The scientist is free, and must be free to ask any
question, to doubt any assertion, to seek for any evidence, to correct any errors. ... We know that the only way to avoid error is to detect it and
that the only way to detect it is to be free to inquire. And we know that as long as men are free to ask what they must, free to say what they think,
free to think what they will, freedom can never be lost, and science can never regress." -J. Robert Oppenheimer
|
|
pantone159
National Hazard
Posts: 590
Registered: 27-6-2006
Location: Austin, TX, USA
Member Is Offline
Mood: desperate for shade
|
|
BTW - My equation assumes that you are dosing at a constant rate, not in discrete bits, like once every hour. The continuous case is easier to analyze
|
|
entropy51
Gone, but not forgotten
Posts: 1612
Registered: 30-5-2009
Member Is Offline
Mood: Fissile
|
|
Pharmacokinetics
First consider the simple case of a drug that is instantaneously and completely absorbed:
C = conc in plasma = total amount in body/volume of distribution
C = Q / Vd
Vd is some multiple of body mass, varies with the drug, depends strongly on lipid solubility of drug.
Q(t) = D exp (-k * t)
where D = dose ingested at time zero, say in mg
k = ln 2 / half-life = 0.693 / thalf
Now consider the case of a drug, of which a fraction f is absorbed with an absorption half life ta and ka = 0.693/ta. The drug is eliminated with a
half life te and ke = 0.693/te. Then for a single dose D the plasma conc. C is:
C(t) = (f * D/Vd)[ka/(ka-ke)]*[exp(-ke * t) - exp(-ka * t)]
For a drug dose D administered at time intervals T the plasma conc. will rise to a maximum and then fall exponentially until the next dose is given.
The average plasma conc. after several doses will be:
Cavg = f * D/( Vd * ke * T)
and the maximum plasma conc. will be
Cmax = f * D /[Vd * (1 - exp(- ke* T)]
There is a nice pharmacokinetics tutorial online.
[Edited on 23-3-2010 by entropy51]
|
|
DJF90
International Hazard
Posts: 2266
Registered: 15-12-2007
Location: At the bench
Member Is Offline
Mood: No Mood
|
|
Nice maths Entropy, I noticed the ln2/halflife that is present in radioactive decay, so I would think you're along the right lines in that respect.
|
|
chief
National Hazard
Posts: 630
Registered: 19-7-2007
Member Is Offline
Mood: No Mood
|
|
Integrate it, after separation of variables ...
|
|
pantone159
National Hazard
Posts: 590
Registered: 27-6-2006
Location: Austin, TX, USA
Member Is Offline
Mood: desperate for shade
|
|
Separate what variables? Everything discussed here seems to be just an ODE, not a partial differential equation.
|
|
MagicJigPipe
International Hazard
Posts: 1554
Registered: 19-9-2007
Location: USA
Member Is Offline
Mood: Suspicious
|
|
I tried that with my original stuff. I don't think it was separable.
And thanks entropy, that was very helpful as well.
[Edited on 3-23-2010 by MagicJigPipe]
"There must be no barriers to freedom of inquiry ... There is no place for dogma in science. The scientist is free, and must be free to ask any
question, to doubt any assertion, to seek for any evidence, to correct any errors. ... We know that the only way to avoid error is to detect it and
that the only way to detect it is to be free to inquire. And we know that as long as men are free to ask what they must, free to say what they think,
free to think what they will, freedom can never be lost, and science can never regress." -J. Robert Oppenheimer
|
|
Magpie
lab constructor
Posts: 5939
Registered: 1-11-2003
Location: USA
Member Is Offline
Mood: Chemistry: the subtle science.
|
|
Quote: Originally posted by MagicJigPipe | I am trying to solve what I think is a differential equation but I can't determine how.
I am trying to "make" an equation for the amount of drug in a user's bloodstream at various times. But the catch is that the user is taking a certain
dose (d) every amount of time (t). I treated it as a rate in - rate out equation where:
dQ/dt = rate in - rate out
Q = amount of drug in user
t = time elapsed
P = dosing period
|
Assuming the dosing, D, is continuous and constant, and the rate of depletion is proportional to Q, ie, kQ, where k is a proportionality constant.
in time interval dt:
dQ = Ddt - kQdt; then separating and integrating (easiest for me):
dQ = (D-kQ)dt
dQ/(D-kQ) = dt
Then, going to my CRC "Standard Mathematical Tables" to get the appropriate integral:
-(1/k)ln(D-kQ) (from Qi to Q) = t (from ti to t)
where Qi is the initial drug load in the user at the initial time, ti. ti is taken as = 0. ln = natural logarithm to base e.
t= -(1/k)ln(D-kQ) - (-1/k)ln(D-kQi)
t= (-1/k)ln[(D-kQ)/D-kQi]
(D-kQ)/(D-kQi) = e^(-tk)
where e = the base of natural logarithms.
Q = [D-(D-kQi)e^(-tk)]/k
The single most important condition for a successful synthesis is good mixing - Nicodem
|
|