Lecture 1. About Differential Calculus

by Reinaldo Baretti Machνn

 

 

 

  Free counter and web stats

 

 http://www1.uprh.edu/rbaretti http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysics.htm

 http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysicsPart2.htm

 http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysicsPart3.htm

 http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysicsPart4.htm

 http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysicsPart5.htm

 http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysicsPart6.htm

 http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysicsPart7.htm

 

 

 

Reference :

 

1. Mathematical Techniques for Biology and Medicine (Dover Publications- Paperback)

by William Simon ; http://www.amazon.com/Mathematical-Techniques-Biology-Medicine-William/dp/0486652475/ref=sr_1_1?ie=UTF8&s=books&qid=1223731765&sr=8-1

 

 

 

Examples and problem from:

Chapter 1 . Reference 1. The problem numbers refer to the textbook listing.

 

 

Problem 15

Let R~rate of generation of a substance ~ moles/time

V~ volume  ,

C ~ concentration ~  moles/volume

F ~ rate of a liquid flow ~volume/time

 

Verify that the differential equation

       dC/dt= R/V –(F/V) C                       (1)

 

 (DE) is dimensionally correct.

 

Substitute the dimensions and obtain

 

moles/(volume-time) ~  moles/(volume-time) –(volume/time)*(1/volume)*moles/volume)

 

 

****

2. Plot    log 10 ( y =exp(α x) )   vs     -2 ≤ x ≤ 2

 

 for selected values    - 2 ≤ α   ≤ 2

 

A  FORTRAN code was used

c     plot log 10 (y=exp(alfa*x) )

      data xi,xf, nstep / -2.,2. , 30/

      data alfa /2.0/

      dx=(xf-xi)/float(nstep)

      do 10 i=0,nstep

      x=xi+dx*float(i)

      y=exp(alfa*x)

      print 100 ,x, log10(y)

10    continue

100   format(1x,'x,log10(y)=',2(3x,e10.3))

      stop

      end

 

*****

Derivative of the exponential function.

Let y = A exp( f(x) ) ,where A is a constant ant f(x) is some

function of the independent variable x .

By definition exp(x) is an infinite series,

 

y=exp( f(x) ) = 1 + f(x) + f(x)2/2 + …  f(x)n /n!  

 

dy/dx= 0 + df/dx + f(x) (df/dx) + 3 (f2/3!)(df/dx) +

 

          n (fn-1/n!)(df/dx)

 

        = (1 + f(x) + f(x)2/2 + …  f(x)n /n! ) (df/dx)

Hence

 

 d  exp( f(x)) /dx        = exp( f(x) ) (df/dx)

Let  y1 = A exp( - λt ) be a decaying exponential while

 

y2 = B exp(+ λt ) is agrowing exponential. The constant

λ has dimension of ~ 1 /time . For example .25 /sec ,

.5/hour  , .02 /year  etc/

 

Their first derivatives are 

dy1/dt = - λ A exp( - λt ) = - λ y1  and

 

dy2/dt = + λ A exp( + λt ) =  λ y2  .

 

 

 

 

 

 

 

Example of exponential growth

Suppose the world population grows at  the rate of

.02/year. This means that if ∆t= 1 year 

 

∆y/(y∆t)  ={ y(t+1 year) –y(t) }/[∆t y(t)]

    

         = .02 /year   ≡  λ

 

In the limit   dy/dt = λ y

 

Let y(t) = A exp (.02 t) with A=1.E9 at t=0 ( the year zero is the 1900).

Plot of y vs t .(MATLAB code)

%population growth

lambda=.02 ; A=1.e9;

t=[0:5:110];

y=A*exp(lambda*t);

year=t+1900;

 

 

plot(year,y),xlabel('year'),ylabel('Population')

 

 

 

The doubling time is a function of λ.

Writing     y2 / y1 =2=  A exp(λ t2 ) / A exp(λ t1 ) = exp(λ( t2 – t1))

Take the natural log and get

ln(2) =   λ( t2 – t1)    or  (t2 – t1)doubling = 0.693 / λ 

 

In the present example there is a time scale

 

 Tscale = 1/ λ= (.02 /year )-1 = 50 years  .

 

The world population doubles every .693(50) ≈ 35 years  .

 

        

 

Example of exponential decay

 

Let y(t) = A exp( -λt)   ,     λ ~1/time  , Tscale =1/ λ.

 

The half life is the interval  ∆t1/2 for which y diminishes to half the y value at the origin of the chosen interval.

 

Let y(0) = A  ,    y (t1/2) = A/2 = A exp(-λt1/2 )  .Thus

exp(((-λt1/2) =1/2 . Take the natural log 

 

 -λt1/2 = ln(1/2) = - ln(2) .

The half life is  t1/2 = .693/λ = .693 Tscale , which is the same expression for the doubling time in the case of exponential growth.

 

Problem 11  ( Ref. 1)

The concentration of a substance decays as shown in the table.

Assume y = A exp(-λt ) and find A , λ and the time scale.  

 

time (sec)

 y(conc)

ln(y)

1

0.0096

-4.64

2

0.0048

-5.34

3

0.0024

-6.03

4

0.0012

-6.72

From inspection it is clear that the half life is one second. Thus

λ = .693 /t1/2 = 0.693 /sec . Also y(1) =.0096 = A exp(-.693)

 

thus A = 1.92E-2 . A will have the dimensions of A which  are not specified here.

 

Now we treat the same problem by fitting the data with a least square software.

The following plot shows  the natural log of y vs time (t).

ln y = ln A – λt  . This equation is a straight line of the form

say ,   u = b – m x    . The slope is  – m = - λ and the vertical axis intercept

b= ln A.

 

The line should be called   u = -3.95 -.693 x .The y in the plot IS NOT or y.

Anyway  we have that  m= λ=0.693/ second  and ln (A)=-3.95  ,

 

A= exp(-3.95)=1.92E-2  . The half life t1/2 = 0.693/ λ=1.0 second

 

 

*   

*    Plot of   y=1.92E-2  exp( -.693 t) 

 

Matlab code

% exponential decay

lambda=.693 ; A=1.92E-2;

t=[0:.5:5];

y=A*exp(-lambda*t);

plot(t,y),xlabel('t~sec'),ylabel('Y')

*****

 

Prob 3 (ref 1)

Given U(x) = W(x) V(x)     ;    V(x)  = S(x) W(x)

 

W(x=2)=3  ; V(2) = 4  ; ( dW/dx)x=2 =4  ;  (dV/dx)x=2= 2

 

find dU/dx    and dS/dx   at x=2 .

Answer:

dU/dx=  (dW/dx) V  + W (dV/dx)  ;using the given values ,

 

          = (4)(4) +(3)(2) = 22 .

 

dV/dx = (dS/dx)W + S (dW/dx) =(dS/dx)W + (V/W)*(dW/dx)

         2= (dS/dx) (3) +(4/3)4

 

dS/dx = -10/9

 

Problem 4. Let y(3)=4  , y(3.1)=4.3  what is  ∆y/∆x ?

dy/dx ≈  ∆y/∆x = (4.3-4)/(3.1-3) = .3/.1 = 3

 

No dimensions are given here for y or x  but in general they have different units and the slope ∆y/∆x will have units . For if instead of x we have time

so that ∆x → ∆t ~ sec or minutes or hours and ∆y ~ units of length

 

then  ∆y/∆x = 3 ( units of length/unit of time )

 

 

Problem 5. Given dy(3)/dx= 2 and y(3)=12 find an approximate value

for y(3.1). Let ∆x = 3.1-3 = 0.1  and suppose the derivative does not change appreciably in the range     3.0 ≤ x≤ 3.1  .

Then   ∆y/∆x ≈ dy/dx= 2 

    y2 - y1 =  2 (∆x)   ,  y2 = y1 +  2 (∆x)  =12 +2(.1)=12.2 ,

that is y(3.1) = y2 = 12.2

 

Problem 6.  Given V= g(u)   and  u =f(x)   , by the chain rule find

dV/dx  .    dV/dx= (dg/du) (du/dx) or alternatively

                            =(dg/du) df/dx

 

Problem 7.  Let   f(x)= x4 +2   ,   g(u)  =u2 and apply it to prob 6.

 

df/dx= 4 x3  , dg/du = 2 u = 2f(x)= 2x4 +4 .   Hence

 

dV/dx=  (2x4 +4)( 4 x3 ) = 8x7 + 16x3    

 

 Problem 8 & 9 are examples of exponential growth.

 d C(t)/dt = k C(t)  is the same kind equation as dy/dt = k y.

 

So  the answer is  C(t) = A exp (kt) The constant A is found from an intial value.

 

First case :  given  C(t=0) ≡ C0 =2moles/liter= A exp( 0) =A

 

So the solution is     C(t) = (2 moles/liter) * exp( kt) .

 

Second case: the concentration is specified at t=1 sec.

 

C(t=1) = A exp(k (1) )    = 2moles/liter

 

A = 2 exp(-k) ~ moles/liter

 

So       C(t) = 2 exp(-k) * exp( kt) . If we call the intial instant t1 , where t1 is arbitrary  then a general expression would be, C(t) = 2  exp( k (t- t1 )  ).

 

Prob 13. Given  y = A exp(-kt)  and y(4) = (1/2) y(2) , find k.

 

This tells us that the half life is 2 seconds. From what is explained in the previous problems or examples ( see above)

 

k ≡ λ = .693 /t1/2  = .693 /(2) = 0.346 /sec

 

Prob 11. In the following expressions what must be the dimensions of k:

a) exp( -kt2 )   , t ~ seconds   ; implies  k ~ 1/sec2

 

b) C=( F/k) t  ,  k ~F t/C  ~ (liters/sec)* (sec)*(liters/mol)~liters2/mol

 

c)R=(F+K) exp(-F *t /V )   given F~liter/sec , K must have the same dimensions  ~ liters/sec and of course R ~ liters/sec

 

 

Prob 16.   Given  the second order differential equation (DE)

 

                d2C/dt 2 + B dC/dt +D C = E   and

 

C ~ concentration say ~ moles/liter  . What are the dimensions

of each term in the DE.

 

A derivative d/dt ~ 1/time  , d2 /dt2 ~ 1/time2

 

d2C/dt 2 ~ moles/(liter-time2)

 

B ~ { moles/(liter-time2)}/ dC/dt ~{ moles/(liter-time2)}*(liter-time/moles)

  

  ~1/time

 

D ~ 1/time2     ,   E ~ moles/(liter-time2)

 

In a problem with a given data we can associate particular time scales related to the coefficients B and D ;     TB ≡ (1/B)    ; TD = (1/D)1/2 .

 

 

Prob 17.  Find the derivatives of the following.

 

a) y = x4 + 3 x3 + x +2 

 

Analytically, and by hand,  this is quite a straight forward. The rule to apply is d xn /dx = n xn-1 .

 

dy/dx = 4 x3 + 9 x2 + 1 + 0  .

 

Using MATLAB is also quite easy.

syms x y;

y=x^4 +3*x^3 +x + 2 ;

diff(y,x)

ans =

 4*x^3+9*x^2+1

 

These are  analytical answers . A specific value of x p can be inserted in the equations to find the numerical values of the derivative at that point.

For example at x= 1 , dy/dx= 14 . No units or dimensions have been specified in this purely mathematical example.

 

 

Find the second derivative of  y = x4 + 3 x3 + x +2. We have already taken the first  derivative dy/dx= 4 x3 + 9 x2 + 1 . The second derivative is

d2y/dx2 = 12 x2 + 18x . Or using Matlab

 

syms x y;

y=x^4 +3*x^3 +x +2;

dydx=diff(y,x),

d2ydx=diff(y,x,2)

d3ydx=diff(y,x,3)

Answers:

dydx = 4*x^3+9*x^2+1

 d2ydx =12*x^2+18*x

d3ydx =24*x+18

 

 

 

17. (b)  find the derivative of  y =(x3 –x) /(x3 +x) ≡ u(x) v(x)-1

 where u(x) = (x3 –x)   and v(x) = (x3 +x)

dy/dx = du/dx * v-1 + u d u-1 /x

          =(3x2 -1) v-1 + u (-1) v-2 dv/dx

 

          =( 3x2 -1) v-1 – ( u/v2) (3x2 +1) .

 

Or using MATLAB

syms x y;

y=(x^3-x)/(x^3+x);

dydx=diff(y,x)

dydx =

 (3*x^2-1)/(x^3+x)-(x^3-x)/(x^3+x)^2*(3*x^2+1)

 

17. (c)   y= A exp(x2 )

 

dy/dx = A d exp[exp(x2 )] /dx = A exp (x2) d (x2) /dx

          =  2x A exp(x2)

 

18 (d)     y = A x exp(x2)

 

Using MATLAB

syms x y A;

y=A*x*exp(x^2) ;

dydx=diff(y,x)

dydx =

 

A*exp(x^2)+2*A*x^2*exp(x^2)

 

Let in 18 (d) A =2 .By numerical means calculate an approximation to dy/dx in the range     0 ≤ x ≤ 2 and compare with the exact values

obtained from dydx= A*exp(x2 )+2Ax2 exp(x2 ) .

Let ∆x =1.e-3

 

and approximate dy/dx  by  {y(x+∆x) – y(x)} /∆x.

The last column is the exact value of the derivative.

 

x,deltay/deltax , dy/dx=    0.0000E+00    0.2000E+01    0.2000E+01

 x,deltay/deltax , dy/dx=    0.2000E+00    0.2249E+01    0.2248E+01

 x,deltay/deltax , dy/dx=    0.4000E+00    0.3101E+01    0.3098E+01

 x,deltay/deltax , dy/dx=    0.6000E+00    0.4937E+01    0.4931E+01

 x,deltay/deltax , dy/dx=    0.8000E+00    0.8661E+01    0.8648E+01

 x,deltay/deltax , dy/dx=    0.1000E+01    0.1634E+02    0.1631E+02

 x,deltay/deltax , dy/dx=    0.1200E+01    0.3281E+02    0.3275E+02

 x,deltay/deltax , dy/dx=    0.1400E+01    0.7000E+02    0.6986E+02

 x,deltay/deltax , dy/dx=    0.1600E+01    0.1587E+03    0.1583E+03

 x,deltay/deltax , dy/dx=    0.1800E+01    0.3829E+03    0.3820E+03

 x,deltay/deltax , dy/dx=    0.2000E+01    0.9851E+03    0.9828E+03

 

Fortran code for the derivative

      data A ,xi ,xf ,nstep/2.,0.,2., 10/

      data deltax/1.e-3/

      y(x) =a*x*exp(x**2)

      dydx(x)=A*exp(x**2 )+2.*A*x**2*exp(x**2)

      dx=(xf-xi)/float(nstep)

      do 10 i=0,nstep

      x=xi+dx*float(i)

      print 100 ,x, (y(x+deltax)-y(x))/deltax ,dydx(x)

10    continue

100   format(1x,'x,deltay/deltax , dy/dx=', 3(3x,e11.4))

      stop

      end

       

 

END OF CHAPTER 1.