Sunteți pe pagina 1din 73

Maths for Petroleum Engineering

2012-2013
Karl Stephen
karl.stephen@pet.hw.ac.uk
Aims
Session 1.
Review of Trig and Calculus

Session 2
Deriving important equations

Session 3
Solving important equations
Session 1 Overview
Trigonometry
Calculus differentiation
Calculus integration
Log and Exponential functions
Overview
Trigonometry
Calculus differentiation
Calculus integration
Log and Exponential functions
Sine, cosine and tangent
definitions
(x,y)
0
u
x
y
r
r
x
cos = u
r
y
sin = u
x
y
tan = u
1 sin cos
2 2
= u + u
Sine function
(x,y)
0
x
y
tan = u
u
x
y
r
sin x
-1.5
-1
-0.5
0
0.5
1
1.5
0 2 4 6 8
sin x
r
y
sin = u
Sine and cosine functions
(x,y)
r
x
cos = u
r
y
sin = u
0
x
y
tan = u
u
x
y
r
-1.5
-1
-0.5
0
0.5
1
1.5
0 2 4 6 8
sin x
cos x
Sine and cosine,
some properties
x
y
tan = u
-1.5
-1
-0.5
0
0.5
1
1.5
0 2 4 6 8
sin x
cos x
) sin( ) sin( u = u
) cos( ) cos( u = u
)
2
sin( ) cos(
t
+ u = u
)
2
cos( ) sin(
t
u = u
) sin( ) 2 sin( u = t + u
) cos( ) 2 cos( u = t + u
Tangent function
(x,y)
0
x
y
tan = u
u
x
y
r
-10
-8
-6
-4
-2
0
2
4
6
8
10
0 1 2 3 4 5 6 7
Tangent properties
x
y
tan = u
-10
-8
-6
-4
-2
0
2
4
6
8
10
0 1 2 3 4 5 6 7
) tan( ) tan( u = u
) tan( ) tan( u = t + u
Applications: co-ordinate change

u

a
b
r

(x,y) or (r,u)
x
y
u = cos r x
u = sin r y
0
Co-ordinates:
Vector, r (r, u):
2 2
y x r + =
(Pythagoras)
x
y
tan
1
= u
Summation of angles
o
|

1.
| o + | o = | + o sin cos cos sin ) sin(

2.
| o | o = | + o sin sin cos cos ) cos(

3.
o o = o cos sin 2 ) 2 sin(

4.
1 cos 2 sin 2 1 sin cos ) 2 cos(
2 2 2 2
o = o = o o = o

Overview
Trigonometry
Calculus differentiation
Calculus integration
Log and Exponential functions
How fast were you going?
t
s
t
s
v =
t
2
s
2
1
1
1
t
s
v =
s
1
t
1
1 2
1 2
2
t t
s s
v

=
t
9
s
9
s
8
t
8
1 i i
1 i i
i
t t
s s
v

=
1 i i
1 i i
i
t t
s s
v

=
Even smaller increments?
What is the instantaneous
Rate of change?
D
i
s
t
a
n
c
e
,

s

time, t
The derivative - definition
Derivative,
rate of change of function f(x) at point x
0

Graphical interpretation
slope of tangent
Notation
f

'(x) = f(x) =

dx
d
dx
df
y
x x0
y = f(x)
x
0

How is it calculated?
The derivative - calculation
y
x
y = f(x)
x
0
+h
f(x
0
+h)
x
0

f(x
0
)
0 0
0 0
x ) h x (
) x ( f ) h x ( f
m , gradient
+
+
=
Newton Quotient
0 0
0 0
0 h 0
x ) h x (
) x ( f ) h x ( f
lim ) x ( ' f
+
+
=

Darcys Law
p
1
p
0
a

q

x

x + Ax
Ax
x
p p
k
a
q
0 1
f
f
A

=
A porous substance has a permeability of 1 Darcy if, in 1 second, 1
cubic centimetre of a gas or liquid with a viscosity of 1 centipoise
will flow through a section 1 centimetre thick with a cross section of
1 square centimetre, when the difference between the pressures on
the two sides of the section is 1 atmosphere.
x
p p k
v
a
q
0 1
f
f
f
A

= =
p
1
p
0
a

v

x

x + Ax
Darcys Law- as a gradient
p
1
p
0
a

x

x + Ax
x d
dp k
v
f
f

=
Let the length of the sample tend to zero.
x
p p
lim
k
v
0 1
0 x
f
f
A

=
A
Simple rules: linearity
) x ( g ) x ( f y + =
) x ( ' g ) x ( ' f
dx
dy
+ =
If



And if ) x ( f . c y =
) x ( ' f . c
dx
dy
=
The derivative - Example 1.
Example, f(x) = ax
2

0 0
0 0
0 h 0
x ) h x (
) x ( f ) h x ( f
lim ) x ( ' f
+
+
=

0 0
2
0
2
0
0 h 0
x ) h x (
) x ( a ) h x ( a
lim ) x ( ' f
+
+
=

h
ax ) h hx 2 x ( a
lim ) x ( ' f
2
0
2
0
2
0
0 h 0
+ +
=

) ah ax 2 ( lim ) x ( ' f
0 0 h 0
+ =

How is it calculated?
The derivative - Example 1.
y
x
y = ax
2

) h ax 2 ( lim
x ) h x (
) x ( f ) h x ( f
lim ) x ( ' f
0 0 h
0 0
0 0
0 h 0
+ =
+
+
=

x
0
+h
f(x
0
+h)
x
0

f(x)
gradient
How is it calculated?
The derivative - Example 1.
y
x
y = ax
2

0 0 0 h
0 0
0 0
0 h 0
ax 2 ) h ax 2 ( lim
x ) h x (
) x ( f ) h x ( f
lim ) x ( ' f = + =
+
+
=

x
0
+h
f(x
0
+h)
x
0

f(x)
The derivative - Example 2.
Example, f(x) = ax
n

0 0
0 0
0 h 0
x ) h x (
) x ( f ) h x ( f
lim ) x ( ' f
+
+
=

0 0
n
0
n
0
0 h 0
x ) h x (
) x ( a ) h x ( a
lim ) x ( ' f
+
+
=

The derivative - Example 2.

) h x )...( h x ).( h x ).( h x ( ) h x (
0 0 0 0
n
0
+ + + + = +
) h , x ( g h nhx x ) h x (
2
1 n
0
n
0
n
0
+ + = +

0 0
n
0
n
0
0 h 0
x ) h x (
) x ( a ) h x ( a
lim ) x ( ' f
+
+
=

i i n
0
n
0 i
i
n
0
h x a ) h x (

=

= +
n
n
1 n
0 1 n
2 2 n
0 2
1 n
0 1
n
0 0
n
0
h a h x a ... h x a h x a x a ) h x ( + + + + + = +


The derivative - Example 2.
Example, f(x) = ax
n

h
)) h , x ( g h h nx ( a
lim ) x ( ' f
2
1 n
0
0 h 0
+
=

)) h , x ( hg nx ( a lim ) x ( ' f
1 n
0 0 h 0
+ =

1 n
0 0
anx ) x ( ' f

=
0 0
n
0
2
1 n
0
n
0
0 h 0
x ) h x (
) x ( a )) h , x ( g h h nx x ( a
lim ) x ( ' f
+
+ +
=

Works for n real also!


More examples
1 n
0 0
anx ) x ( ' f

=
2 / 1
x 3 ) x ( f =
x
1
x
1
x 3 x 2 ) x ( f
2
3 7
+ =
x
1
) x ( f =
2
1 1
x
1
x 1 ) x ( ' f = =

2
1
1
2
1
x 5 . 1 x
2
1
3 ) x ( ' f

= =
2 / 3 3
2 6
x 2
1
x
2
x 9 x 14 ) x ( ' f + + + =
; ax ) x ( f
n
=
Results
Can we show that:
) x sin( ) x ( ' f
0 0
=
) x cos( ) x ( f = then
) x cos( ) x ( ' f
0 0
=
) x sin( ) x ( f = then
Gradients

-1.5
-1
-0.5
0
0.5
1
1.5
0 2 4 6 8
sin x
cos x
) x cos( ) x ( ' f
0 0
=
) x sin( ) x ( f = then
Calculating more
complicated derivatives

Chain rule; y=f(g(x))

Products; y=f(x)g(x)

Quotients; y=f(x)/g(x)
2
) x (sin y =
x cos x sin y =
x
x cos
y =
Examples
The Chain Rule
Combined functions: y=f(u); u=g(x)




dx
du
du
df
) x ( ' y =
)) x ( g ( f y =
The Chain Rule - example


e.g.
dx
du
du
df
) x ( ' y =
)) x ( g ( f y =
2
) x (sin y =
x cos x sin 2 x cos u 2
dx
) x (sin d
du
) u ( d
) x ( ' y
2
= = =
x sin u ; u y
2

The Product Rule
Products







) x ( g ) x ( f ) x ( y =
) x ( ' g ) x ( f ) x ( g ) x ( ' f ) x ( ' y + =
The Product Rule: example
Products



e.g.



) x ( g ) x ( f ) x ( y =
) x ( ' g ) x ( f ) x ( g ) x ( ' f ) x ( ' y + =
x cos x sin y =
dx
) x (cos d
x sin x cos
dx
) x (sin d
) x ( ' y + =
x sin x sin x cos x cos ) x ( ' y =
The Quotient Rule
Quotients
) x ( g
1
). x ( f
) x ( g
) x ( f
) x ( y = =
)'
) x ( g
1
)( x ( f
) x ( g
1
) x ( ' f ) x ( ' y + =
Product rule
2
) x ( g
) x ( ' g
) x ( f
) x ( g
1
) x ( ' f ) x ( ' y =
Chain rule
2
)) x ( g (
) x ( ' g ) x ( f ) x ( g ) x ( ' f
) x ( ' y

=
The Quotient Rule: example
Example:
dx
) x ( d
x cos
x
1
dx
) x (cos d
) x ( ' y
1
+ =
Product rule
x
x cos
y =
Chain rule |
.
|

\
|
+ =
2
x
1
x cos
x
1
x sin ) x ( ' y
) x cos x sin x (
x
1
) x ( ' y
2
+ =
Higher Order derivatives
Second order derivative
the gradient of the gradient of f(x).


n orders, notation:-
0 0
0 0
0 h
2
2
x ) h x (
) x ( ' f ) h x ( ' f
lim ) x ( ' ' f
dx
f d
) x ( f
dx
d
dx
d
+
+
= = =

) x ( f
dx
f d
n
n
n
=
Taylors Series
A function f(x+h) can be expanded to:



This infinite series can be truncated:
......
dx
f d
! 3
h
dx
f d
! 2
h
dx
df
h ) x ( f ) h x ( f
3
3 3
2
2 2
+ + + + = +
2
2 2
dx
f d
! 2
h
dx
df
h ) x ( f ) h x ( f + + ~ +
y=sin(x) sin(0)=0

2 2 3 3
2 3
(0 ) (0) ......
2! 3!
dy h d y h d y
y h y h
dx dx dx
+ = + + + +
cos( )
dy
x
dx
=
2
2
sin( )
y
x
x
c
=
c
3
3
cos( )
y
x
x
c
=
c
0
1
x
dy
dx
=
=
2
2
0
0
x
y
x
=
c
=
c
3
3
0
1
x
y
x
=
c
=
c
2 3 3 5 7
sin( ) 0 .1 .0 ( 1) ......
2! 3! 3! 5! 7!
h h h h h
h h h = + + + + ~ +
5 9 13 1 11 7 3 order
Partial derivative
Let z=f(x,y)
Partial deriviative:
gradient of f wrt x or y
while y or x are fixed
respectively.


y*
x
*) y , x ( f *) y , x x ( f
lim
x
f
0 x
A
A +
=
c
c
A
Mass balance
Fluid flow in 1-D:
flux, v
in

v
out

x
) ( ) (
lim
t
) C ( ) C (
lim
in out
0 x
t t t
0 t
A
v v
=
A

A
A +
A
Ax
Ay
Az
Make instantaneous and local:
Mass balance
Fluid flow in 1-D:
flux, v
in

v
out

Taking limits as At and Ax vanish:
x
) (
t
C
c
v c
=
c
c
Example
x
) x ( f ) x x ( f
lim
x
f
0 0
0 x
A
A +
=
c
c
A
2 2 2
y xy 2 x ) y x ( ) y , x ( f + + = + =
Think y is a constant
y 2 x 2
x
f
+ =
c
c
Partial and ordinary derivatives
Ordinary derivatives used for y(t)
functions of one variable
Partial derivatives are used for f(x,y,z,)
functions of several variables
However, if u=f(x,y) and x=x(t) and y=y(t),
du f dx f dy
dt x dt y dt
c c
= +
c c
Chain rule
Overview
Trigonometry
Calculus differentiation
Calculus integration
Log and Exponential functions
How far did you go?
t
v
vt s =
Average velocity
t
2
v
2
1 1 1
t v s =
v
1
t
1
) t t ( v s s
1 2 2 1 2
=
) t t ( v s s
1 i i i 1 i i
=
Average velocity
1 1 1
t v s =
v
e
l
o
c
i
t
y

time

= =
i
1 i i i
i
1 i i n
) t t ( v s s s
) t t ( v s s
1 i i i 1 i i
=
1 1 1
t v s =
Actual velocity?
v
e
l
o
c
i
t
y

time

+ = =
i
1 i i 1 i i
i
1 i i n
2 / ) t t )( v v ( s s s
Start with the velocity curve then approximate
Integrals - definition
Integral = area under the curve
e.g. total distance travelled at a certain speed
Inverse of the derivative
y
x
y=f(x)
x
0

x
0
+h
Integrals - approximation
Approximate
Area=(hf(x
0
)+0.5h(f(x
0
+h)-f(x
0
))
Area=h((f(x
0
+h)+f(x
0
))/2
y
x
y=f(x)
x
0
x
0
+h
f(x
0
+h)
f(x
0
)
Explain areas
Integrals - approximation
Definition:
Area=E h((f(x
0
+nh)+f(x
0
+(n-1)h))/2

y
x
y=f(x)
a
t
a+h
Integrals - definition
Approximation improved:

y
x
y=f(x)
x1
x2
x1+h
2
0 0 0
1
1
( ) lim 0.5 ( ( ) ( ( 1) )
x
N
h
n
x
area f x dx h f x nh f x n h

=
= = + + +

}
Indefinite and definite Integrals
The Indefinite Integral is



The Definite Integral is
C ) x ( g dx ) x ( f + =
}
) x ( f ) x ( ' g = where
}
=
b
a
) a ( g ) b ( g dx ) x ( f
x
g(x)
Same
derivative
Make dynamic whats the difference here? Relate actual area to abstract indefinite better.
Example solutions:
inverse of differentiation
E.g.
C x
1 n
a
dx ax
1 n n
+
+
=
+
}
C x cos xdx sin + =
}
C x tan dx ) x tan 1 (
2
+ = +
}
Difficult integrals


( )
}
xdx cos x sin
n
dx x sin x
}
How do we solve:


or:
Substitution
Solve by parts
Integration by substution

2 2 2
1 1 1
( ) ( ( )) ( )
, ( ( ))
u x x
u x x
dF u dF u x dF u du
area F u x du dx dx
du dx du dx
= = =
} } }
2 2
1 1
, ( ( )) ( ) ( )
u x
u x
du
area F u x f u du f u dx
dx
= =
} }
Inverse
chain rule
E.g.
Solution by substitution


( )
}
=
2
1
x
x
n
xdx cos x sin Area
u ) u ( f and ; x sin u set = =
( )
1 n
1
1 n
2
u
u
n
x
x
n
u u
1 n
1
du u dx
dx
du
u Area
2
1
2
1
+ +

+
= = =
} }
( )
1
1 n
2
1 n
x sin x sin
1 n
1
Area
+ +

+
=
Integrals - solution by parts
From the derivative of a product,
y(x)=f(x)g(x):

Integrating both sides by x gives:
) x ( ' g ) x ( f ) x ( g ) x ( ' f ) x ( ' y + =
dx
dx
dg
f dx g
dx
df
g . f
} }
+ =
dx g
dx
df
g . f dx
dx
dg
f
} }
=
Product rule
Rearranged
Easier to solve?
Integrals - solution by parts
Example:
dx x sin x
}
x sin
dx
dg
; x f = =
x cos g ; 1
dx
df
= =
} }
+ = xdx cos x cos x dx x sin x
dx g
dx
df
g . f dx
dx
dg
f
} }
=
x sin x cos x dx x sin x + =
}
Reduce order
of x to zero
Overview
Trigonometry
Calculus differentiation
Calculus integration
Log and Exponential functions
Log function - definition
Definition
natural logarithm
x ln dx
x
1
x
1

}
1.0
x
y=1/x
y
Log function - relationships
Known results and limits



0 1 ln =
x as x ln
0 x as x ln
x
y=1/x
y
x
y
ln x
Log function - relationships
addition and multiplication
x ln a ln ax ln + =
u ln ax ln f(x) let = =
dx
du
du
) u (ln d
(x) f' hen t =
where u=ax
C x ln dx
x
1
dx ) x ( ' f ) x ( f + = = =
} }
a
u
1
dx
du
du
) u (ln d
(x) f' hen t = = a
ax
1
a
u
1
dx
du
du
) u (ln d
(x) f' hen t = = =
x
1
a
ax
1
a
u
1
dx
du
du
) u (ln d
(x) f' hen t = = = =
Chain
Rule!
Log Function addition
So

If x=1 then

Therefore

Also
C x ln ax ln + =
C C 1 ln a ln = + =
x ln a ln ax ln + =
x ln a x ln
a
=
Exponential function - definition
Definition:


e=2.718
derivative:
x
e ) x exp( y = =
x
e ) x ( ' y =
y ln x =

dx
dy
) x ( ' y =
dy / dx
1
dx
dy
) x ( ' y = =
dy / ) y (ln d
1
dy / dx
1
dx
dy
) x ( ' y = = =
y / 1
1
dy / ) y (ln d
1
dy / dx
1
dx
dy
) x ( ' y = = = =
x
e
y / 1
1
dy / ) y (ln d
1
dy / dx
1
dx
dy
) x ( ' y = = = = =
Derivative of exponential
x
e ) x exp( y = =
Log versus ln
x
10 y =
x
10 ln
y ln
y log y log
10
= = =
x
10 ln 10 ln x y ln = =
ln always means natural log
log often means log
10
but can mean ln
When writing use ln or log
10

Unconverted data
x
-4 -2 0 2 4 6
y
0
1000
2000
3000
4000
5000
y=exp(2x)
y=10
x
Converting data natural log
x
-4 -2 0 2 4 6
y
e
-9
e
-8
e
-7
e
-6
e
-5
e
-4
e
-3
e
-2
e
-1
e
0
e
1
e
2
e
3
e
4
e
5
e
6
e
7
e
8
e
9
e
10
e
11
y=exp(2x)
y=10
x
Converting data log 10
x
-4 -2 0 2 4 6
y
0.0001
0.001
0.01
0.1
1
10
100
1000
10000
100000
y=exp(2x)
y=10
x
Log:log plots
ln x
ln y
c x ln m y ln + =
c x ln m
e y
+
=
m
kx y =
1 2
2 2
x ln x ln
y ln y ln
m

=
2 2
x ln m y ln c =
c x ln m
e e y =
Log:log plots
ln x
c x ln m
dx
dy
ln + =
1 2
1 x x 2 x x
x ln x ln
dx
dy
ln
dx
dy
ln
m

=
= =
2 2
x ln m y ln c =
dx
dy
ln
m
kx
dx
dy
=
const x
1 m
k
y
1 m
+
+
=
+
Log:linear (semilog) plots
x
ln y
c mx y ln + =
c mx
e y
+
=
2 2
mx y ln c =
1 2
2 2
x x
y ln y ln
m

=
Log:linear (semilog) plots
x
2 2
mx y ln c =
dx
dy
ln
c mx
dx
dy
ln + =
1 2
1 x x 2 x x
x x
dx
dy
ln
dx
dy
ln
m

=
= =
c mx
e
dx
dy
+
=
const e
m
1
y
c mx
+ =
+
Next time?
Applications 1. Deriving flow equations
Mass balance
Diffusivity Equation
Vector Calculus
Application 2. Solution of flow equations
Steady State flow
Pressure solution and averaging
Numerical Simulation
Buckley-Leverret Theory
Exponential Integral

See also
http://www.mathcentre.ac.uk/

S-ar putea să vă placă și