NB. Integral test require 'numeric trig plot' require '~system/packages/math/integrat.ijs' require '~addons/stats/base/random.ijs' simpson0=: 1 : 0 NB. moving average type NB. usage: ^&3 simpson0 3 4 100 dh=: 1r6 * (-/1 0 { y) % {:y NB. delta dh * +/ ; +/ (L:0) 1 4 1 * (L:0) u (L:0) 3<\ xn=. steps y ) simpson1=: 1 : 0 NB. weight is 1 4(odd) 2(even) 1 NB. 'A0 B0 N0'=. y NB. kukan a b and n NB. xn =: A0, A0+ (B0-A0)* (>: i. N0) % N0 NB. xn is n+1 dh=: (-/ 1 0 { y) % {: y NB. delta tmp=: dh * u xn=. steps y +/ 1r3 * tmp * 1,((<: {: y)$ 4 2),1 ) NB. --------------------------- daikei=: 1 : 0 NB. Newton_Cotes Method 'A0 B0 N0'=. y xn =: A0, A0+ (B0-A0)* (>: i. N0) % N0 dh=: ((B0-A0)% N0) * 1r2 NB. delta dh* +/({. tmp),(+: +/ }. }: tmp),{: tmp=: u xn ) daikei_digital=: 4 : 0 NB. Newton_Cotes Method NB. x is 1 or dh dh=. x tmp=: ;(+/%#) (L:0) 2<\y NB. mean of both side +/ dh*tmp ) simpson_digital=: 4 : 0 tmp=. (({.y), {:y) , 2* ;(+/ % #)(L:0) 0 2 { (L:0) 3<\y -: +/ x * tmp ) sabun0=:3 : ';(+/%#) L:0 |.(L:0) 2<\ y' NB. --------------------- NB. ito_integral NB. Kobayashi p83 ito_integral_0=: 3 : 0 NB. u I0 SA=. ;-/ &|.( L:0) 2<\ y +/(}. y)*SA ) NB. same avove ito_integral_2=: 3 : '+/ (}.y)* -/"1 tmp=: }: (}.y,0),.y' NB. Lieman Stieltjes Integral NB. Kobayashi p83 ls_integral0=: 1 : ' +/ (u {."1 y) * {:"1 y' NB. fx is ^&2 NB. varphi is LS0 NB. Lieman Stieltjes Integral NB. Kobayashi p83 LS0=: 1 2 5 6,. 2 3 1 1 NB. ans is 75 winner0=: 3 : 0 NB. Winner integral NB. Usage: plot winner0 0 1 256 //256=2^8 inverse(%)=2^_8 dh=: %: (-/1 0{ y) % {: y NB. Delta_h --> use sqrt(h) +/\ dh * normalrand {: y NB. normalrand mean=0 sd=1 ) NB. ---------------------- NB.DATA Block I0=:DK0=:0 0.55 0.84 _0.8 1.03 _0.04 1.41 _0.56 0.66 1.78 _0.45