1. Maths Tools

  • Upload
    adobi

  • View
    235

  • Download
    0

Embed Size (px)

Citation preview

  • 7/27/2019 1. Maths Tools

    1/73

    Maths for Petroleum Engineering

    2012-2013

    Karl Stephen

    [email protected]

  • 7/27/2019 1. Maths Tools

    2/73

    Aims

    Session 1.

    Review of Trig and Calculus

    Session 2

    Deriving important equations

    Session 3

    Solving important equations

  • 7/27/2019 1. Maths Tools

    3/73

    Session 1 Overview

    Trigonometry

    Calculusdifferentiation

    Calculusintegration

    Log and Exponential functions

  • 7/27/2019 1. Maths Tools

    4/73

    Overview

    Trigonometry

    Calculusdifferentiation

    Calculusintegration

    Log and Exponential functions

  • 7/27/2019 1. Maths Tools

    5/73

    Sine, cosine and tangent

    definitions

    (x,y)

    0

    x

    yr

    r

    xcos

    r

    ysin

    x

    ytan

    1sincos

    22

  • 7/27/2019 1. Maths Tools

    6/73

    Sine function

    (x,y)

    0

    x

    ytan

    x

    yr

    sin x

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    0 2 4 6 8

    sin x

    r

    ysin

  • 7/27/2019 1. Maths Tools

    7/73

    Sine and cosine functions

    (x,y)

    r

    xcos

    r

    ysin

    0

    x

    ytan

    x

    yr

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    0 2 4 6 8

    sin x

    cos x

  • 7/27/2019 1. Maths Tools

    8/73

    Sine and cosine,

    some properties

    x

    ytan

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    0 2 4 6 8

    sin x

    cos x

    )sin()sin(

    )cos()cos(

    )2

    sin()cos(

    )2

    cos()sin(

    )sin()2sin( )cos()2cos(

  • 7/27/2019 1. Maths Tools

    9/73

    Tangent function

    (x,y)

    0

    x

    ytan

    x

    yr

    -10

    -8

    -6

    -4

    -2

    0

    2

    4

    6

    8

    10

    0 1 2 3 4 5 6 7

  • 7/27/2019 1. Maths Tools

    10/73

    Tangent properties

    x

    ytan

    -10

    -8

    -6

    -4

    -2

    0

    2

    4

    6

    8

    10

    0 1 2 3 4 5 6 7

    )tan()tan(

    )tan()tan(

  • 7/27/2019 1. Maths Tools

    11/73

    Applications: co-ordinate change

    a

    b

    r

    (x,y) or (r,)

    x

    y

    cosrx

    sinry

    0

    Co-ordinates:

    Vector, r (r, ):

    22 yxr (Pythagoras)

    x

    ytan 1

  • 7/27/2019 1. Maths Tools

    12/73

    Summation of angles

    ab

    1. bababa sincoscossin)sin(

    2. bababa sinsincoscos)cos(

    3. aaa cossin2)2sin(

    4.

    1cos2sin21sincos)2cos( 2222 aaaaa

  • 7/27/2019 1. Maths Tools

    13/73

    Overview

    Trigonometry

    Calculusdifferentiation

    Calculusintegration

    Log and Exponential functions

  • 7/27/2019 1. Maths Tools

    14/73

    How fast were you going?

    t

    s

    t

    sv

    t2

    s2

    1

    11

    t

    sv

    s1

    t1

    12

    122

    tt

    ssv

    t9

    s9s8

    t8

    1ii

    1iii

    tt

    ssv

    1ii

    1iii

    tt

    ssv

    Even smaller increments?

    What is the instantaneous

    Rate of change?

    Dis

    tance,s

    time, t

  • 7/27/2019 1. Maths Tools

    15/73

    The derivative - definition

    Derivative,

    rate of change of function f(x) at point x0

    Graphical interpretation

    slope of tangent

    Notation

    f'(x) = f(x) =dxd

    dxdf

    y

    xx 0

    = f(x)

    x0

  • 7/27/2019 1. Maths Tools

    16/73

    How is it calculated?

    The derivative - calculation

    y

    x

    y = f(x)

    x0 +h

    f(x0+h)

    x0

    f(x0)

    00

    00

    x)hx(

    )x(f)hx(fm,gradient

    Newton Quotient

    00

    000h0

    x)hx(

    )x(f)hx(flim)x('f

  • 7/27/2019 1. Maths Tools

    17/73

    Darcys Law

    p1p0

    aq

    x x + Dx

    Dx

    xppkaq 01

    f

    f D

    A porous substance has a permeability of1 Darcy if, in 1 second, 1

    cubic centimetre of a gas or liquid with a viscosity of1 centipoise

    will flow through a section 1 centimetre thick with a cross section of

    1 square centimetre, when the difference between the pressures onthe two sides of the section is 1 atmosphere.

    x

    ppkv

    a

    q 01

    f

    ff

    D

  • 7/27/2019 1. Maths Tools

    18/73

    p1p0

    av

    x x + Dx

    Darcys Law- as a gradient

    p1p0

    a

    x x + Dx

    xd

    dpkv

    f

    f

    Let the length of the sample tend to zero.

    x

    pplim

    kv

    010x

    f

    f D

    D

  • 7/27/2019 1. Maths Tools

    19/73

    Simple rules: linearity

    )x(g)x(fy

    )x('g)x('fdx

    dy

    If

    And if)x(f.cy

    )x('f.cdx

    dy

  • 7/27/2019 1. Maths Tools

    20/73

    The derivative - Example 1.

    Example, f(x) = ax2

    00

    00

    0h0 x)hx(

    )x(f)hx(flim)x('f

    00

    2

    0

    2

    00h0

    x)hx(

    )x(a)hx(alim)x('f

    hax)hhx2x(alim)x('f

    2

    0

    2

    0

    2

    00h0

    )ahax2(lim)x('f 00h0

  • 7/27/2019 1. Maths Tools

    21/73

    How is it calculated?

    The derivative - Example 1.

    y

    x

    y = ax2

    )hax2(limx)hx(

    )x(f)hx(flim)x('f 00h

    00

    000h0

    x0 +h

    f(x0+h)

    x0

    f(x)

    gradient

  • 7/27/2019 1. Maths Tools

    22/73

    How is it calculated?

    The derivative - Example 1.

    y

    x

    y = ax2

    000h

    00

    000h0 ax2)hax2(lim

    x)hx(

    )x(f)hx(flim)x('f

    x0 +h

    f(x0+h)

    x0

    f(x)

  • 7/27/2019 1. Maths Tools

    23/73

    The derivative - Example 2.

    Example, f(x) = axn

    00

    000h0

    x)hx()x(f)hx(flim)x('f

    00

    n

    0

    n

    0

    0h0 x)hx(

    )x(a)hx(alim)x('f

  • 7/27/2019 1. Maths Tools

    24/73

    The derivative - Example 2.

    )hx)...(hx).(hx).(hx()hx( 0000n

    0

    )h,x(ghnhxx)hx( 21n

    0

    n

    0

    n

    0

    00

    n

    0

    n

    00h0

    x)hx(

    )x(a)hx(alim)x('f

    iin

    0

    n

    0i

    i

    n

    0 hxa)hx(

    n

    n

    1n

    01n

    22n

    02

    1n

    01

    n

    00

    n

    0 hahxa...hxahxaxa)hx(

  • 7/27/2019 1. Maths Tools

    25/73

    The derivative - Example 2.

    Example, f(x) = axn

    h

    ))h,x(ghhnx(alim)x('f

    21n

    00h0

    ))h,x(hgnx(alim)x('f1n

    00h0

    1n

    00 anx)x('f

    00

    n

    0

    21n

    0

    n

    00h0x)hx(

    )x(a))h,x(ghhnxx(alim)x('f

    Works for n real also!

  • 7/27/2019 1. Maths Tools

    26/73

    More examples

    1n

    00 anx)x('f

    2/1x3)x(f

    x

    1x1x3x2)x(f

    2

    37

    x

    1)x(f

    2

    11

    x

    1x1)x('f

    2

    11

    2

    1

    x5.1x2

    13)x('f

    2/33

    26

    x2

    1

    x

    2x9x14)x('f

    ;ax)x(f n

  • 7/27/2019 1. Maths Tools

    27/73

    Results

    Can we show that:

    )xsin()x('f 00 )xcos()x(f then

    )xcos()x('f 00 )xsin()x(f then

  • 7/27/2019 1. Maths Tools

    28/73

    Gradients

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    0 2 4 6 8

    sin x

    cos x

    )xcos()x('f 00 )xsin()x(f then

  • 7/27/2019 1. Maths Tools

    29/73

    Calculating more

    complicated derivatives

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

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

    Quotients; y=f(x)/g(x)

    2)x(siny

    xcosxsiny

    x

    xcosy

    Examples

  • 7/27/2019 1. Maths Tools

    30/73

    The Chain Rule

    Combined functions: y=f(u); u=g(x)

    dx

    du

    du

    df)x('y

    ))x(g(fy

  • 7/27/2019 1. Maths Tools

    31/73

    The Chain Rule - example

    e.g.

    dx

    du

    du

    df)x('y ))x(g(fy

    2)x(siny

    xcosxsin2xcosu2dx

    )x(sinddu

    )u(d)x('y2

    xsinu;uy 2

  • 7/27/2019 1. Maths Tools

    32/73

    The Product Rule

    Products

    )x(g)x(f)x(y

    )x('g)x(f)x(g)x('f)x('y

  • 7/27/2019 1. Maths Tools

    33/73

    The Product Rule: example

    Products

    e.g.

    )x(g)x(f)x(y

    )x('g)x(f)x(g)x('f)x('y

    xcosxsiny

    dx

    )x(cosdxsinxcos

    dx

    )x(sind)x('y

    xsinxsinxcosxcos)x('y

  • 7/27/2019 1. Maths Tools

    34/73

    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

  • 7/27/2019 1. Maths Tools

    35/73

    The Quotient Rule: example

    Example:

    dx

    )x(dxcos

    x

    1

    dx

    )x(cosd)x('y

    1

    Product rule

    x

    xcosy

    Chain rule 2x1

    xcosx

    1xsin)x('y

    )xcosxsinx(

    x

    1)x('y

    2

  • 7/27/2019 1. Maths Tools

    36/73

    Higher Order derivatives

    Second order derivative

    the gradient of the gradient of f(x).

    n orders, notation:-

    00

    000h2

    2

    x)hx(

    )x('f)hx('flim)x(''f

    dx

    fd)x(f

    dx

    d

    dx

    d

    )x(fdx

    fd nn

    n

  • 7/27/2019 1. Maths Tools

    37/73

    Taylors Series

    A function f(x+h) can be expanded to:

    This infinite series can be truncated:

    ......dx

    fd!3

    hdx

    fd!2

    hdxdfh)x(f)hx(f

    3

    33

    2

    22

    2

    22

    dx

    fd

    !2

    h

    dx

    dfh)x(f)hx(f

  • 7/27/2019 1. Maths Tools

    38/73

    y=sin(x) sin(0)=0

    2 2 3 3

    2 3(0 ) (0) ......

    2! 3!

    dy h d y h d yy h y h

    dx dx dx

    cos( )

    dy

    xdx 2

    2sin( )

    yx

    x

    3

    3cos( )y x

    x

    0

    1x

    dy

    dx

    2

    2

    0

    0x

    y

    x

    3

    3

    0

    1x

    yx

    2 3 3 5 7

    sin( ) 0 .1 .0 ( 1) ......2! 3! 3! 5! 7!

    h h h h h

    h h h

    5913 11173 order

  • 7/27/2019 1. Maths Tools

    39/73

    Partial derivative

    Let z=f(x,y)

    Partial deriviative:

    gradient of f wrt x or ywhile y or x are fixed

    respectively.

    y*

    x

    *)y,x(f*)y,xx(flim

    x

    f0x

    D

    D

    D

  • 7/27/2019 1. Maths Tools

    40/73

    Mass balance

    Fluid flow in 1-D:

    flux, vin vout

    x

    )()(lim

    t

    )C()C(lim

    inout

    0x

    ttt

    0t

    D

    D

    D

    D

    D

    DxDy

    Dz

    Make instantaneous and local:

  • 7/27/2019 1. Maths Tools

    41/73

    Mass balance

    Fluid flow in 1-D:

    flux, vin vout

    Taking limits as Dt and Dx vanish:

    x

    )(

    t

    C

  • 7/27/2019 1. Maths Tools

    42/73

    Example

    x

    )x(f)xx(flim

    x

    f 000x D

    D

    D

    222 yxy2x)yx()y,x(f

    Think y is a constant

    y2x2xf

  • 7/27/2019 1. Maths Tools

    43/73

    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

    Chain rule

  • 7/27/2019 1. Maths Tools

    44/73

    Overview

    Trigonometry

    Calculusdifferentiation

    Calculusintegration

    Log and Exponential functions

  • 7/27/2019 1. Maths Tools

    45/73

    How far did you go?

    t

    v

    vts

    Average velocity

    t2

    v2

    111 tvs

    v1

    t1

    )tt(vss 12212 )tt(vss 1iii1ii

    Average velocity

    111 tvs

    velocity

    time

    i

    1iii

    i

    1iin )tt(vsss)tt(vss 1iii1ii

    111 tvs

    Actual velocity?

    velocity

    time

    i

    1ii1ii

    i

    1iin 2/)tt)(vv(sss

    Start with the velocity curve then approximate

  • 7/27/2019 1. Maths Tools

    46/73

    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)

    x0 x0 +h

  • 7/27/2019 1. Maths Tools

    47/73

    Integrals - approximation

    Approximate

    Area=(hf(x0)+0.5h(f(x0 +h)-f(x0))

    Area=h((f(x0 +h)+f(x0))/2

    y

    x

    y=f(x)

    x0 x0 +h

    f(x0 +h)

    f(x0)

    Explain areas

  • 7/27/2019 1. Maths Tools

    48/73

    Integrals - approximation

    Definition:

    Area=Sh((f(x0 +nh)+f(x0+(n-1)h))/2y

    x

    y=f(x)

    a ta+h

  • 7/27/2019 1. Maths Tools

    49/73

    Integrals - definition

    Approximation improved:

    y

    x

    y=f(x)

    x1 x2x1+h

    2

    0 0 0

    11

    ( ) lim 0.5 ( ( ) ( ( 1) )x N

    h

    nx

    area f x dx h f x nh f x n h

  • 7/27/2019 1. Maths Tools

    50/73

    Indefinite and definite Integrals

    The Indefinite Integral is

    The Definite Integral is

    C)x(gdx)x(f )x(f)x('g where

    b

    a

    )a(g)b(gdx)x(f

    x

    g(x)

    Same

    derivative

    ynamicwhats the difference here? Relate actual area to abstract indefin

  • 7/27/2019 1. Maths Tools

    51/73

    Example solutions:

    inverse of differentiation E.g.

    Cx1n

    adxax 1nn

    Cxcosxdxsin

    Cxtandx)xtan1( 2

  • 7/27/2019 1. Maths Tools

    52/73

    Difficult integrals

    xdxcosxsinn

    dxxsinx

    How do we solve:

    or:

    Substitution

    Solve by parts

  • 7/27/2019 1. Maths Tools

    53/73

    Integration by substution

    2 2 2

    1 1 1

    ( ) ( ( )) ( ), ( ( ))

    u x x

    u x x

    dF u dF u x dF u duarea F u x du dx dx

    du dx du dx

    2 2

    1 1

    , ( ( )) ( ) ( )

    u x

    u x

    duarea F u x f u du f u dxdx

    Inverse

    chain rule

  • 7/27/2019 1. Maths Tools

    54/73

    E.g.

    Solution by substitution

    2

    1

    x

    x

    nxdxcosxsinArea

    u)u(fand;xsinuset

    1n

    1

    1n

    2

    u

    u

    n

    x

    x

    n

    uu1n

    1

    duudxdx

    du

    uArea

    2

    1

    2

    1

    11n21n xsinxsin

    1n

    1Area

  • 7/27/2019 1. Maths Tools

    55/73

    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

    dxdx

    dgfdxgdx

    dfg.f

    dxgdx

    dfg.fdx

    dx

    dgf

    Product rule

    Rearranged

    Easier to solve?

  • 7/27/2019 1. Maths Tools

    56/73

    Integrals - solution by parts

    Example: dxxsinx

    xsindx

    dg

    ;xf

    xcosg;1dx

    df

    xdxcosxcosxdxxsinxdxg

    dxdfg.fdx

    dxdgf

    xsinxcosxdxxsinx

    Reduce order

    of x to zero

  • 7/27/2019 1. Maths Tools

    57/73

    Overview

    Trigonometry

    Calculusdifferentiation

    Calculusintegration

    Log and Exponential functions

  • 7/27/2019 1. Maths Tools

    58/73

    Log function - definition

    Definition

    natural logarithm

    xlndx

    x

    1x

    1

    1.0 x

    y=1/x

    y

  • 7/27/2019 1. Maths Tools

    59/73

    Log function - relationships

    Known results and limits

    01ln

    xasxln

    0xasxln

    x

    y=1/x

    y

    x

    yln x

  • 7/27/2019 1. Maths Tools

    60/73

    Log function - relationships

    addition and multiplication

    xlnalnaxln

    ulnaxlnf(x)let

    dx

    du

    du

    )u(lnd

    (x)f'hent

    where u=ax

    Cxlndxx

    1dx)x('f)x(f

    au

    1

    dx

    du

    du

    )u(lnd

    (x)f'hent aax1

    au

    1

    dx

    du

    du

    )u(lnd

    (x)f'hent x1

    aax

    1

    au

    1

    dx

    du

    du

    )u(lnd

    (x)f'hent Chain

    Rule!

  • 7/27/2019 1. Maths Tools

    61/73

    Log Function addition

    So

    If x=1 then

    Therefore

    Also

    Cxlnaxln

    CC1lnaln

    xlnalnaxln

    xlnaxln a

  • 7/27/2019 1. Maths Tools

    62/73

    Exponential function - definition

    Definition:

    e=2.718

    derivative:

    xe)xexp(y

    xe)x('y

    ylnx

  • 7/27/2019 1. Maths Tools

    63/73

    dx

    dy)x('y

    dy/dx

    1

    dx

    dy)x('y

    dy/)y(lnd

    1

    dy/dx

    1

    dx

    dy)x('y

    y/1

    1

    dy/)y(lnd

    1

    dy/dx

    1

    dx

    dy)x('y xe

    y/1

    1

    dy/)y(lnd

    1

    dy/dx

    1

    dx

    dy)x('y

    Derivative of exponential

    xe)xexp(y

  • 7/27/2019 1. Maths Tools

    64/73

    Log versus ln

    x10y

    x10ln

    ylnylogylog 10

    x10ln10lnxyln

    ln always means natural log

    log often means log10 but can mean ln

    When writing use ln or log10

  • 7/27/2019 1. Maths Tools

    65/73

    Unconverted data

    x

    -4 -2 0 2 4 6

    y

    0

    1000

    2000

    3000

    4000

    5000

    y=exp(2x)

    y=10x

  • 7/27/2019 1. Maths Tools

    66/73

    Converting datanatural log

    x

    -4 -2 0 2 4 6

    y

    e-9e-8e-7e-6e-5e-4e-3e-2e-1e0e1e2e3e4e5e

    6

    e7e8e9e10e11

    y=exp(2x)

    y=10x

  • 7/27/2019 1. Maths Tools

    67/73

    Converting datalog 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=10x

  • 7/27/2019 1. Maths Tools

    68/73

    Log:log plots

    ln x

    ln y

    cxlnmyln

    cxlnmey

    m

    kxy

    12

    22

    xlnxln

    ylnylnm

    22 xlnmylnc

    cxlnm eey

  • 7/27/2019 1. Maths Tools

    69/73

    Log:log plots

    ln x

    cxlnmdx

    dyln

    12

    1xx2xx

    xlnxln

    dx

    dyln

    dx

    dyln

    m

    22

    xlnmylnc

    dx

    dyln mkx

    dx

    dy

    constx1m

    ky 1m

  • 7/27/2019 1. Maths Tools

    70/73

    Log:linear (semilog) plots

    x

    ln y

    cmxyln

    cmxey

    22

    mxylnc

    12

    22

    xx

    ylnylnm

  • 7/27/2019 1. Maths Tools

    71/73

    Log:linear (semilog) plots

    x

    22 mxylnc

    dx

    dyln

    cmxdx

    dyln

    12

    1xx2xx

    xx

    dx

    dyln

    dx

    dyln

    m

    cmxedx

    dy

    constem

    1

    y

    cmx

  • 7/27/2019 1. Maths Tools

    72/73

    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

  • 7/27/2019 1. Maths Tools

    73/73

    See also

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