math for developers

Embed Size (px)

Citation preview

  • 7/23/2019 math for developers

    1/4

    0.1 Derivative. Geometrical interpretation of

    derivative.

    Derivative. Let f(x) =y be a function and aand a+h be two points.

    a) h is called the argument increment.

    b) f(a+h) f(a) is called function increment.

    Definition 0.1.1. Derivative of a function at a point x0 is the limit

    limh0

    f(a+h) f(a)

    h .

    The derivative can be written in the following ways:

    f(a) = df

    dx(a).

    Geometrical interpretation of derivative

    Figura 1: A picture of a gull.

    Line equation

    Definition 0.1.2. Let A(xA, yA) and B(xB, yB) two points. Then the lineequation which passed through this points is:

    x xA

    xB xA=

    y yA

    yB yA.

    The above formula can be written in the following way:

    y= yB yA

    xB xA x

    yB yA

    xB xA xA+ yA.

    The slop of the line is:

    m= yB yA

    xB xA.

    1

  • 7/23/2019 math for developers

    2/4

    0.2 Taylor Polynomial

    Let f :I R be a function derivable for ntimes in the point a I. TaylorPolynomial attached to the function f in the point ais:

    (Tnf)(x) = f(a) +x a

    1! f(a) +. . .+

    (x a)n

    n! f(n)(a). (1)

    1. The Taylor formula for the function f in the neighbourhood of thepoint a is:

    f(x) = (Tnf)(x) + (Rnf)(x),

    where

    2. (Rnf)(x) is the rest in Taylor formula.

    3. MacLaurin FormulaIf in the Taylor Formula it will be choosen a= 0then:

    f(x) =f(0) +xf(0) +. . .+xn

    n!f(n)(0) + (Rnf)(x). (2)

    Example 0.2.1. 1. ex 1 + x+ x2

    2! +. . .+ x

    n

    n!;

    2. sin x x x3

    3! + x

    5

    5! +. . .+ (1)n x

    2n+1(2n+1)!

    ;

    3. cos x 1 x2

    2! + x

    4

    4! +. . .+ (1)n x

    2n

    (2n)!.

    Figura 2: Taylor approximation

    Example0.2.2 (Approximation for cos function).

    2

  • 7/23/2019 math for developers

    3/4

    0.3 Newtons Method

    The goal of this section is to find, using an approximation, the solution forthe the following equation:

    f(x) = 0.

    The function must have the following properties:

    a) function must be continuous

    b) function must be derivable

    c) f(a) f(b)< 0.

    Property c) and a) gave the a solution for the equation f(x) = 0. To obtainthe rule for Newtons method is it necessary to write the Taylor series for thefunction f(x) around the point a.

    f(x) = f(a) +x a

    1! f(a) +

    (x a)2

    2! f(a) +

    (x a)3

    3! f(a) +. . . (3)

    Retaining only the first and the second terms of above series, it is obtainedthe equation of the tangent in a point and an approximation for the initialfunction. So:

    f(x) f(a) + (x a)f

    (a). (4)

    The steps to apply the Newtons method are:

    Step 1. It is chosen a point x1 which is the close to the solution according withan estimate.

    Step 2. It is create the tangent line at the point (x1, f(x1) using the equationof the tangent:

    y = f(x1) + f(x1)(x x1).

    Step 3. The tangent line will intersect the Ox-axis when y = 0. So,

    f(x1) + f(x1)(x2 x1) = 0 (5)

    f(x1) = f(x1)(x2 x1) (6)

    f(x1)

    f(x1) = x2 x1 (7)

    x2 = x1 f(x1)

    f(x1). (8)

    3

  • 7/23/2019 math for developers

    4/4

    Step 4. It is verified iff(x2) = 0. If the answer is YESthen the algorithm is

    closed; if not, the process will repeat with another approximation.

    ...

    The Step 3. can be written in a general way:

    xn+1 = xn f(xn)

    f(xn). (9)

    Example 0.3.1. Use Newtons method to find the fourth approximation, x4,to the root of the following equation

    x3 x 1 = 0

    starting with x1= 1.

    No. f(x) =x3 x 1 f(x) = 3x2 1

    n xn f(xn) f(xn) xn+1=xn f(xn)f(xn)

    1 1 1 2 1.52 1.5 0.875 5.75 1.3478260873 1.347826087 0.100682173 4.449905482 1.325200399

    4 1.325200399 0.002058362 4.268468292 1.3247181745 1.324718174 0.000000924 4.264634722 1.324717957

    4