Simpson H4 BioS. Simpson 3 3 0 x. β α (β α)3 (x α)(x β)dx = () * * x * * ɛ δ
y = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f() + f() + f(3) + f(4) () *4 S = 3 f( + i) i i=0 8 x =, 3,, 5, 3, 7, 4, 9, 5 i f(x) f(i) S S = f() + f ( 3 ) + f() + f ( 5 ) + f(3) + f ( 7 ) + f(4) + f *3 f(x) *4 f() f(4) ( 9 )
8 S = 7 f i=0 ( + i ) [a, b] n a, b h = b a n S n S = f(a + h i) h (3) i=0 n b a f(x)dx = lim n h n f(a + h i) i=0 f(x) *5 f(x) = x (0, ) * Dirac delta (distribution). 0 5 ( ) f(x) 5 y = x 4 y = x 4 *5 f(x) * x lim f(x) = (0, ) R x 0 dx 0 x = 3
S S = n = { } f() + f() { } + f() + f(3) { } f( + i) + f( + (i + )) i=0 { } + f(3) + f(4) { } + f(4) + f(5) S = { } f() + f() { } + f() + f(3) { } + f(3) + f(4) { } + f(4) + f(5) = f() + f() + f(3) + f(4) + f(5) = f() 3 + f( + i) + f(5) [a, b] n h = b a n (n + ) S n { } S = f(a + h i) + f(a + h (i + )) h i=0 n = f(a + h i) h n + f(a + h (i + )) h i=0 i=0 i=0 n = f(a + h i) h n + f(a + h i) h = f(a) h n + f(a + h i) h + f(b) h = f(a) h n + f(a + h i) h + f(b) h (4) 3 Simpson 8 x =,, 3 x = 3, 4, 5 (, f()), (, f()), (3, f(3)) (3, f(3)), (4, f(4)), (5, f(5)) 4
7 y = x 8 y = x Simpson Simpson 3 *7 3. Lagrange Simpson Lagrange Lagrange ( ) y = f(x) 3 (, y ), (x, y ), (x 3, y 3 ), x, x 3 *8 f(x) f(x) = (x x )(x x 3 ) ( x )( x 3 ) y + (x )(x x 3 ) (x )(x x 3 ) y + (x )(x x ) (x 3 )(x 3 x ) y 3 f(x) *9 3 (, y ), (x, y ), (x 3, y 3 ) f( ) = ( x )( x 3 ) ( x )( x 3 ) y + ( )( x 3 ) (x )(x x 3 ) y + ( )( x ) (x 3 )(x 3 x ) y 3 = y f(x ) = (x x )(x x 3 ) ( x )( x 3 ) y + (x )(x x 3 ) (x )(x x 3 ) y + (x )(x x ) (x 3 )(x 3 x ) y 3 = y f(x 3 ) = (x 3 x )(x 3 x 3 ) ( x )( x 3 ) y + (x 3 )(x 3 x 3 ) (x )(x x 3 ) y + (x 3 )(x 3 x ) (x 3 )(x 3 x ) y 3 = y 3 *0 *7 f(x) = ax + bx + c a, b, c 3 3 *8 *9 x *0 3 5
3.. Lagrange y = f(x) 3 (, ), (, 4), (3, 5) f(x) (, y ) = (, ), (x, y ) = (, 4), (x 3, y 3 ) = (3, 5) Lagrange f(x) = {x ( )} (x 3) { ( )} ( 3) + (x )(x 3) (x ){x ( )} 4 + {( ) } {( ) 3} (3 ){3 ( )} (x + )(x 3) 4(x )(x 3) (x )(x + ) = + + 3 5 = 0(x x ) + 8(x 4x + 3) + 5(x + x ) 30 = 0x + 0x + 0 + 8x 3x + 4 + 5x + 5x 30 30 = 3x 7x + 54 30 f() = 3 7 + 54 30 =, f( ) = 5 + 4 + 54 30 = 4, f(3) = 7 + 54 30 y = f(x) (, ), (, 4), (3, 5) = 5 9 3 y = 3x 7x + 54 30 y = f(x) 3 (, 3), (, 5), (4, 9) f(x) (, y ) = (, 3), (x, y ) = (, 5), (x 3, y 3 ) = (4, 9) Lagrange f(x) = (x )(x 4) (x )(x 4) (x )(x ) 3 + 5 + ( )( 4) ( )( 4) (4 )(4 ) 9
3(x )(x 4) 5(x )(x 4) 9(x )(x ) = + + 3 = (x x + 8) + 5(x 5x + 4) + 3(x 3x + ) = x x + + 5x 5x + 0 + 3x 9x + = x + f() = 3, f() = 5, f(4) = 9 (, 3), (, 5), (4, 9) 3 * 0 3 y = x + 3. Simpson Simpson Lagrange Simpson 3 (, y ), (x, y ), (x 3, y 3 ) < x < x 3 x 3 x = x = d * y = f(x) 3 f(x) x 3 S S = d y + 4d y + d y 3 (5), x, x 3 3 (, y ), (x, y ), (x 3, y 3 ) f(x) Lagrange f(x) = (x x )(x x 3 ) ( x )( x 3 ) y + (x )(x x 3 ) (x )(x x 3 ) y + (x )(x x ) (x 3 )(x 3 x ) y 3 * 3 3 * 3 7
x 3 S { (x x )(x x 3 ) S = f(x)dx = ( x )( x 3 ) y + (x )(x x 3 ) (x )(x x 3 ) y + (x x } )(x x ) (x 3 )(x 3 x ) y 3 dx S = y ( x )( x 3 ) y 3 + (x 3 )(x 3 x ) (x x )(x x 3 )dx + y (x )(x x 3 ) (x )(x x 3 )dx (x )(x x )dx () *3 (x x )(x x 3 )dx = { } (x ) + ( x ) (x x 3 )dx = (x )(x x 3 )dx + ( x ) (x x 3 )dx = [ ] x3 (x 3 ) 3 + ( x ) (x x 3) = (x 3 ) 3 + ( x ) {0 } ( x 3 ) ( = d3 + d ) ) ( ( d x 3 x = x = d ), x 3 = d = d3 (7) () (x )(x x 3 )dx = (x 3 ) 3 = d3 (8) 3 (x )(x x )dx = = (x ){(x x 3 ) + (x 3 x )}dx (x )(x x 3 )dx + (x 3 x ) = (x 3 ) 3 = (x 3 ) 3 = d3 + d d [ (x x ) + (x 3 x ) ] x3 + (x 3 x ) (x 3 ) ( x 3 x = x = d ) (x )dx = d3 (9) *3 () Z β α (β α)3 (x α)(x β)dx = Z β Z β n o Z β Z β (x α)(x γ)dx = (x α) (x β) + (β γ) dx = (x α)(x β)dx + (β γ) (x α)dx α α α α 8
(7) (8) (9) () ) y S = ( x )( x 3 ) d3 + y ( (x )(x x 3 ) d3 + = y ( d ) ( d) + y ( d d ) d3 ) ( d3 + y 3 d d d3 y 3 (x 3 )(x 3 x ) d3 ( x = x 3 x = d, x 3 = d ) = d y + 4d y + d y 3 8 y = x 8 x 3 Simpson S (, ), (, ), (3, 3 ) 3 d f(x) = d = S = + 4 + 3 = 0 8 = 0 9 3. dx x = [log x]3 = log(3) log().098 3 3.. Simpson Lagrange Simpson x i y y i = f(x i ) d 3.3 Simpson 3 Simpson 9
f(x) = x x 5 h =, 0., 0.0, 0.00, 0.000 5 h = SAS =, x =, x 3 = 3, x 4 = 4, x 5 = 5 y y = f( ) = =, y = f(x ) =, y 3 = f(x 3 ) = 3, y 4 = f(x 4 ) = 4 y = x 4 3 y = x 4 4 y = x 8 (i) 4 0 f(x)dx h = = 5 4 f(x i ) =.0833 ( + + 3 + ) 4 0
(ii) 4 0 f(x)dx f( ) h 4 + h f(x i ) + f(x 5 ) h i= = ( + + 3 + ) + 4 5 =.83333 (iii) Simpson 3 (, y ), (x, y ), (x 3, y 3 ) S = d y + 4d y + d y 3 3 (x 3, y 3 ), (x 4, y 4 ), (x 5, y 5 ) S = d y 3 + 4d y 4 + d y 5 ( d S = S + S = y + 4d y + d ) ( d y 3 + y 3 + 4d y 4 + d ) y 5 = d y + 4d y + d y 3 + 4d y 4 + d y 5 = + 8 + 4 3 + 8 4 + 5. y 3 S, S 3.4 Simpson y 3 Simpson S : {, x, x 3 }, S : {x 3, x 4, x 5 } SAS
Simpson < x < < x m < x m+ f(x i ) y i x i+ x i = d d (i =, m + ) 4d h i = (i : ) d (i :, m + ) Simpson S S = m+ y i h i (0) S = d y + 4 y + d y 3 S = S 3 = S 4 =.. S n = d y 3 + 4 y 4 + d y 5 d y 5 + 4 y + d y 7 d y 7 + 4 y 8 + d y 9 d y n + 4 y n + d y n+ d y y n+ y, y 4,, y n 4d d y 3, y 5,, y n 4 f(x) Simpson n
x f(x) f(x) f(x) f( ) h h f( ) h f( ) x f(x ) h h f(x ) h i f(x i ) 3 x 3 f(x 3 ) h 3 h 3 f(x 3 )... n x n f(x n ) h n h n f(x n ) n x n f(x n ) h n h n f(x n ).. 3 h i f(x i ) n. h i f(x i ) n h i f(x i ) n h i f(x i ) () *4 (3)(4)(0) 5 < x < x 3 < x 4 < x 5 h S = h f( ) + h f(x ) + h f(x 3 ) + h f(x 4 ) h = h = h 3 = h 4 = h S = 4 h i f(x i ) S = h f() + h f(x ) + h f(x 3 ) + h f(x 4 ) + h f(x 5) h = h 5 = h, h = h 3 = h 4 = h S = 5 h i f(x i ) Simpson S = d f() + 4d f(x ) + d f(x 3) + 4d f(x 4) + d f(x ) d h = h 5 = d, h = h 4 = 4d, h 3 = d S = 5 h i f(x i ) *4 n X f(x i ) h i 3
SAS *5 n, step, start, end no * %macro rect(start, end, step, no) data d no = &no n = (&end - &start) / &step + * step = &step * do to (n-) * x = &start + (i-) * &step * f = %f(x) * h = &step * area + f * h * output end run data out &no length no 8. type $. set d end=final type = rectangular if final then output drop i x f h run %mend rect * %macro trape(start, end, step, no) data d no = &no n = (&end - &start) / &step + * step = &step * do i = to n * x = &start + (i-) * &step * f = %f(x) * if or i=n then h= &step/ * else h = &step * area + f * h * output end run n o *5 + 4 0 (0 4)/ + = 4 4,, 8, 0 4
data out &no length no 8. type $0. set d end=final type = trapezoid if final then output drop i x f h run %mend trape *Simpson %macro simp(start, end, step, no) data d3 no = &no n = (&end - &start) / &step + * d = *&step * step = &step * do i = to n * x = &start + (i-)*d / * f = %f(x) if or i=n then area + f * d / * else if mod(i, ) = 0 then area + f * 4 * d / * else area + f * * d / * output end run data out3 &no length no 8. type $0. set d3 end=final type = Simpson if final then output drop i x f run %mend simp 3 %macro exe0(start, end, step, no) %rect(&start, &end, &step, &no) %trape(&start, &end, &step, &no) %simp(&start, &end, &step, &no) %mend exe0 5 5
%macro exe(start, end, no) %exe0(&start, &end,, &no) %exe0(&start, &end, 0., %eval(&no + )) %exe0(&start, &end, 0.0, %eval(&no + )) %exe0(&start, &end, 0.00, %eval(&no + 3)) %exe0(&start, &end, 0.000, %eval(&no + 4)) * data out rect &no set out &no out %eval(&no + ) out %eval(&no + ) out %eval(&no + 3) out %eval(&no + 4) run * data out trape &no set out &no out %eval(&no + ) out %eval(&no + ) out %eval(&no + 3) out %eval(&no + 4) run *Simpson data out simp &no set out3 &no out3 %eval(&no + ) out3 %eval(&no + ) out3 %eval(&no + 3) out3 %eval(&no + 4) run %mend exe 5 [ ] 5 x dx = log(x) = log(5) data check area = log(5) run f(x) = x 5 x area.0944 f(x) %macro f(x) / &x %mend f
%exe(, 5, ) f(x) = x 5 3 x f(x) = x 5 x no type n step area rectangular 5.0000.08333 rectangular 4 0.000.504 3 rectangular 40 0.000.345 4 rectangular 400 0.000.0984 5 rectangular 4000 0.000.0948 no type n step area trapezoid 5.0000.8333 trapezoid 4 0.000.04 3 trapezoid 40 0.000.0945 4 trapezoid 400 0.000.0944 5 trapezoid 4000 0.000.0944 4 f(x) = x x 5 Simpson no type n d step area Simpson 5.0000.0000. Simpson 4 0.000 0.000.0944 3 Simpson 40 0.000 0.000.0944 4 Simpson 400 0.000 0.000.0944 5 Simpson 4000 0.000 0.000.0944 Simpson Simpson n = 4 * f(x) = exp(x) 0 x 4 4 0 f(x)dx = 4 0 exp(x)dx = [ ] 4 exp(x) = e 4 0 data check area = exp(4) - exp(0) run * 7
5 f(x) = exp(x) 0 x 4 area 53.598 f(x) %macro f(x) exp(&x) %mend f %exe(0, 4, ) f(x) = exp(x) 0 x 4 7 f(x) = x 5 x no type n step area rectangular 5.0000 3.99 rectangular 4 0.000 50.99 3 rectangular 40 0.000 53.330 4 rectangular 400 0.000 53.574 5 rectangular 4000 0.000 53.5955 no type n step area trapezoid 5.0000 57.999 trapezoid 4 0.000 53.48 3 trapezoid 40 0.000 53.598 4 trapezoid 400 0.000 53.598 5 trapezoid 4000 0.000 53.598 8 f(x) = x x 5 Simpson no type n d step area Simpson 5.0000.0000 53.838 Simpson 4 0.000 0.000 53.598 3 Simpson 40 0.000 0.000 53.598 4 Simpson 400 0.000 0.000 53.598 5 Simpson 4000 0.000 0.000 53.598 n = 4 Simpson n = 40 4 8
3 ( f(x) = exp x ) x 3 h =, 0., 0.0, 0.00, 0.000 5 3 exp ) ( x dx = 3 π = ( 3 π π exp π exp = π {Φ(3) Φ( )} ( x ) dx ( x ) dx π exp ) ) ( x dx data check pi = constant( pi ) * pi π area = sqrt( * pi) * (cdf( norm, 3) - cdf( norm, -) run 9 f(x) = exp x x 3 area.0555 f(x) %macro f(x) exp(-/ * (&x**)) %mend f %exe(-, 3, ) 3 9
0 f(x) = exp x x 3 f(x) = exp x x 3 no type n step area rectangular 5.0000.34840 rectangular 4 0.000.3479 3 rectangular 40 0.000.0853 4 rectangular 400 0.000.0585 5 rectangular 4000 0.000.0558 no type n step area trapezoid 5.0000.0509 trapezoid 4 0.000.050 3 trapezoid 40 0.000.0555 4 trapezoid 400 0.000.0555 5 trapezoid 4000 0.000.0555 f(x) = exp x x 3 Simpson no type n d step area Simpson 5.0000.0000.40 Simpson 4 0.000 0.000.055 3 Simpson 40 0.000 0.000.0555 4 Simpson 400 0.000 0.000.0555 5 Simpson 4000 0.000 0.000.0555 n Simpson [] Jennison,C., and Turnbull,B,W. (999) Group Sequential Methods with application to Clinical Trials. Chapman Hall/CRC. [], 0,. [] 0