
Preview onto version 0.3.4
Here you can do some experiments with Rascal. The computation time is
restricted to about 10 secs to prevent high load on server.
Have a look at the documentation or at the examples. If you see wrong plots reload may help.
You job is cancelled as soon someone else accesses this page, so consider a
local installation.
Rascal-toolbox-0.3.4 (C) 2001,2002 Sebastian Ritterbusch
Enter 'help' for help or 'licence' for information about licence and warranty.
"rascal.rc loaded, predefined e, i, pi"
>" Numerical Integration Methods ";
>
>Hull(a,b)=Interval(a)|Interval(b);
>
>ITrapez(f,a,b)=(b-a)/2*(f(a)+f(b))-sqr(b-a)*(b-a)/12*f''(Hull(a,b));
>ISimpson(f,a,b)=(b-a)/6*(f(a)+4*f((a+b)/2)+f(b))-sqr(sqr(b-a))*(b-a)/(90*32)*f''''(Hull(a,b));
>ITaylor2(f,a,b)=(b-a)*f((a+b)/2)+sqr(b-a)*(b-a)*f''((a+b)/2)/(2*4*3)+sqr(sqr(b-a))*(b-a)*f''''(Hull(a,b))/(24*5*16);
>ITaylor4(f,a,b)=(b-a)*f((a+b)/2)+sqr(b-a)*(b-a)*f''((a+b)/2)/(2*4*3)+sqr(sqr(b-a))*(b-a)*f''''((a+b)/2)/(24*5*16)+sqr(sqr(b-a))*sqr(b-a)*(b-a)*f''''''(Hull(a,b))/(6!*7*64);
>
>p=2*X;
>f(x)=p(x);
>Precision(1,-4);
>
>" Integration of k*X^(k-1) from 0 to 1 ";
>" [k Integrand Trapez Simpson Taylor2 Taylor4] ";
>for(n=1;n<=9;n++) [n p=(n+1)*(X^n) ITrapez(f,0,1) ISimpson(f,0,1) ITaylor2(f,0,1) ITaylor4(f,0,1)]
[1 2*X 1 1 1 1]
[2 3*X^2 [0.9999,1.0001] [1,1] [1,1] [1,1]]
[3 4*X^3 [-5E-016,2] [1,1] [1,1] [1,1]]
[4 5*X^4 [-2.5001,2.5000] [0.9999,1.0001] [1,1] [1,1]]
[5 6*X^5 [-7.0001,3.0000] [0.8749,1.1250] [0.8125,1.1875] [1,1]]
[6 7*X^6 [-14.0001,3.5000] [0.3645,1.2396] [0.6562,1.9688] [1,1]]
[7 8*X^7 [-2.4001E+001,4.0000] [-0.9584,1.3750] [0.5,4.0] [0.9375,1.0625]]
[8 9*X^8 [-3.7501E+001,4.5000] [-3.7266,1.5235] [0.3632,8.2383] [0.8554,1.4180]]
[9 10*X^9 [-5.5001E+001,5.0000] [-8.8204,1.6797] [0.2539,1.6004E+001] [0.7460,2.6211]]
>
>
>" Now [0,1] is split in 4 parts and rules are iterated ";
>D(I,f,a,b)=I(f,a,3*a/4+b/4)+I(f,3*a/4+b/4,a/2+b/2)+I(f,a/2+b/2,a/4+3*b/4)+I(f,a/4+3*b/4,b);
>p=2*X;
>" [k Integrand Trapez Simpson Taylor2 Taylor4] ";
>for(n=1;n<=9;n++) [n p=(n+1)*X^n D(ITrapez,f,0,1) D(ISimpson,f,0,1) D(ITaylor2,f,0,1) D(ITaylor4,f,0,1)]
[1 2*X 1 1 1 1]
[2 3*X^2 [0.9999,1.0001] [1,1] [1,1] [1,1]]
[3 4*X^3 [0.9843,1.0157] [1,1] [1,1] [1,1]]
[4 5*X^4 [0.9570,1.0352] [0.9999,1.0001] [1,1] [1,1]]
[5 6*X^5 [0.9101,1.0665] [0.9998,1.0002] [0.9998,1.0002] [1,1]]
[6 7*X^6 [0.8361,1.1096] [0.9995,1.0004] [0.9994,1.0008] [1,1]]
[7 8*X^7 [0.7272,1.1648] [0.9986,1.0010] [0.9985,1.0021] [0.9999,1.0001]]
[8 9*X^8 [0.5756,1.2319] [0.9968,1.0020] [0.9970,1.0048] [0.9999,1.0001]]
[9 10*X^9 [0.3725,1.3101] [0.9934,1.0037] [0.9945,1.0100] [0.9999,1.0001]]
>
Questions, Problems, Bugs? Please use this form.