You are on page 1of 20

Maple, Mathematica, Magma, Sage, etc.

Numerical computation.
and when numerical approximation
Why should we use

for a definite integral?


1) The antiderivative function is impossible or
difficult
be
to found, a numerical value is good enough.

Ex
Sexex,I*dx. Ssin(x2dx, etc.
(2)

What is
$fixdx?
Remann sum: Divide [a, b] into
a subintervals [xix, xi]

of equal length ox ba,


=

take sample point

x = e [X: Xi] Then


-,

Sfixidx lim
=
If(xY)
=
ox

nc i 1

Thus
Ifxidx = If(x)OXwhen i is "large"
i1
=
x*
Approximation rules (choices of x =[xi -, x:]) An
Xi-1 Xi

left end
x
approximation

x =Xi-1, (n 2,f(xi_)ox
=

end approximation
Right
*

x* =

Xi, Rn 2,f(xi)ox
=
Midpoint
* rule

x* xi
=
=
x

x:Mn 24f(x:)ox
=

Trapezoidal
* rule

Tn I((n
=
Rn)
+

I(f(xi 1)0x
=

i1
=
-

f(xi)0x)
+

X2,f(x)
= f(x)
+
The area of the ith trapezoidal is

(f(xi 1) f(xi).
-> -
+

a
=

1,b 2,n 5 = =

1a

-x
2a =
=

5
=
0.2
=
xo x, x= x3 x4 X5

Xi a 20x 1
= +
=
0.22
+ 0 =5
(i

xo 1,
=

X1 1.2,
=

X2 1.4,
=

X3 1.6, x 1.8,
= =

X5 2 =
cal
Trapezoidal rule

(b) Midpoint rule


x* 1.1,
=
= 113,
x
=
5
x 1.5,
=

x 1.7,
=

x* 1.9.
=
Ex. f(x) I,
=

[1,2]
x=

fix) =
-

42 f(x) Es
=

If x) Es for any xe [1,2]


-2
=

Error bound

1E 1+

=s
2.13
IEml* 4r2 =
=
Take n 5,
=

(Ei) 552=
<

IEm1 I
is:=t 0.003334.
=

Solution. From the above argument, by the error bounds,

=s
rule:
Trapezoidal (ET1*

<0.0001 E
let IEi1=

-> We may take n 41.


=
Midpoint rule:

IEM) E =
=

IEM)* = <0.0001 >

(a).a
=

0, b 1,=

n 10
=

ox
=

1a 1 =
0.1
=

Xi a
=
i.0x
+
0.1i0xi /0
=

:e [Xi-1, Xi]

Xi I(Xi
=
-
1
+

xi) I(0.1(i 1)
=
-

0.1i)
+
0.1i
=
-
0.0512i =10
Mn =

f(x) x =

f(0.1: -0.05) 0.1

-0.05)
e
(0.12
..1
=

i1 =

=
fex.

(b) f(x) ex =
2

f(x) 2xex"
=
f(x) (2
= 4x4)ex"
+

If(x) (2
=
4x))ex
+
6e k
=
=
x = [0,1]

1 Eml -> a = -

, 0.007
=

=
linn-Sexx)-30,007
=>

n 10
=

I (exdx -1.460393) 20.007.

Another
approximation of(af(x)dx

Q:Can we do better?
Whati s
Simpson's Rule?

line the
Previous rules are use
to
segments approximate
to curve
Simpson'srule:
approximate
the curve in each subinterval
by a
quadratic
function (parabolas, ax bx +

c)
+

+
Q,(x) a,x bix Ci
= +

a2 x
bax 2z
+

Q2(x)
=

Derivation of formula:the first parabola is

Q.(x) a,x b,x c,


= + A(X x,)
+
= -
+
B(x -

x) c
+

Q,(x) Q,(X, -ox) Yo


=
=
Q.(x) Y,
=

Q,(x2) Q,(x 0x) yz


= =
+

=> A(ox)" Box C


+

Yo
=
()

S
-

C Y, (2)
=

A(ox) B0x
+

c
+
=

y =
(z)

Ia,(xdx (A(x =
-
x) B(x + -

x) cdx+


area under the
(*Ax Bx
=

+ cdx
+

parabola -
X

2(2A x(ox) 50x(2A(x) 6c)


= +
=
+

4y.)
yox(% y2
+
+
Similarly j*4
x2
Q2(x)dX 50x(yi = +

y4 435)
+


area under the 2nd parabola
*
2i
I X2i =2
QixdX 50x (Yzi-z Yei+ 4Yai-1)
=
+

I
area under the ith parabola

dan
I *
zi 2
-
Qi(x)dx (f(xa-
-
) 4f(xni-i)
* f(x))
+
Runk:
f(x) x,
=
f(x) -
=

x2, f(x) 5,
= +(x) =
-
4
f(x) 25
=

If "(x) =

x 24 k
=

x = [1,2]

IEs)- **-*n* <0.0001

->

Take n 8
=
(n is even).
(b) f(x) ex.
=

It (x) (x12 48x


16x4/ex4x26,2xet0,17
= + +
lEs) as I
-

n 10
=

1):e*dx 1.462681)
-

You might also like