home *** CD-ROM | disk | FTP | other *** search
- PROGRAM d5r6(input,output);
- (* driver for routine CHINT *)
- LABEL 10,99;
- CONST
- nval=40;
- pio2=1.5707963;
- TYPE
- glcarray=ARRAY [1..nval] OF real;
- VAR
- a,b,x : real;
- i,mval : integer;
- c,cint : glcarray;
-
- FUNCTION func(x: real): real;
- BEGIN
- func := sqr(x)*(sqr(x)-2.0)*sin(x)
- END;
-
- FUNCTION fint(x: real): real;
- BEGIN
- fint := 4.0*x*(sqr(x)-7.0)*sin(x)
- -(sqr(sqr(x))-14.0*sqr(x)+28.0)*cos(x)
- END;
-
- (*$I MODFILE.PAS *)
- (*$I CHEBFT.PAS *)
-
- (*$I CHEBEV.PAS *)
-
- (*$I CHINT.PAS *)
-
- BEGIN
- a := -pio2;
- b := pio2;
- chebft(a,b,c,nval);
- (* test integral *)
- 10: writeln;
- writeln('How many terms in Chebyshev evaluation?');
- write('Enter n between 6 and ',nval:2,
- '. (n := 0 to end). ');
- readln(mval);
- IF ((mval <= 0) OR (mval > nval)) THEN GOTO 99;
- chint(a,b,c,cint,mval);
- writeln;
- writeln('x':9,'actual':14,'Cheby. integ.':16);
- FOR i := -8 to 8 DO BEGIN
- x := i*pio2/10.0;
- writeln(x:12:6,fint(x)-fint(-pio2):12:6,
- chebev(a,b,cint,mval,x):12:6)
- END;
- GOTO 10;
- 99:
- END.
-