So, I think the installation is more or less ok now. The running of the test
programs seems to work.
But, now, I have no idea of how to do to generate some graphs from data
files?...
I am appending below a very small Pascal program that draws some
graphs of some functions using GRX. Of course, instead of
calculating them you can always read the x and y values from a data
file using something like
Assign (F, 'filename.dat');
Reset (F);
while not eof (F) do
begin
ReadLn (F, x, y);
Plot (x, y, Color)
end;
Close (F)
--
http://home.pages.de/~Peter.Gerwinski/ - G-N-U GmbH:
http://www.g-n-u.de
Maintainer GNU Pascal -
http://home.pages.de/~GNU-Pascal/ - gpc-20000705
GnuPG key fingerprint: 9E7C 0FC4 8A62 5536 1730 A932 9834 65DB 2143 9422
keys:
http://www.gerwinski.de/pubkeys/ - AntiSpam:
http://spam.abuse.net
Program fGraphs;
(**************************************************************************)
(* *)
(* fGraphs 1.0, a demo program for GNU Pascal and GRX20 which displays *)
(* the graphs of some Bessel functions. *)
(* *)
(* Copyright (C) 1997 Peter Gerwinski, Essen, Germany *)
(* peter.gerwinski@uni-essen.de *)
(*
http://home.pages.de/~peter.gerwinski/ *)
(* *)
(* This program is free software; you can redistribute it and/or modify *)
(* it under the terms of the GNU General Public License, version 2, as *)
(* published by the Free Software Foundation. You can use parts of *)
(* this program in your own programs under the terms of the GNU Library *)
(* General Public License, version 2. *)
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU General Public License *)
(* and the GNU Library General Public License along with this program; *)
(* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, *)
(* Cambridge, MA 02139, USA. *)
(* *)
(**************************************************************************)
(*$X+*)
uses
GRX; (* Portable Graphics library *)
Const
xMin = -8;
xMax = 8;
yMin = -1.1;
yMax = 1.1;
xStep = 0.001;
Var
CoordColor, ScreenWidth, ScreenHeight: Integer;
JColor, YColor: array [ 0..5 ] of Integer;
i: Integer;
x: Real;
(* Use the Bessel functions from the C library. *)
Function BesselJ0 ( x: Real ): Real; AsmName 'j0';
Function BesselJ1 ( x: Real ): Real; AsmName 'j1';
Function BesselJ ( n: Integer; x: Real ): Real; AsmName 'jn';
Function BesselY0 ( x: Real ): Real; AsmName 'y0';
Function BesselY1 ( x: Real ): Real; AsmName 'y1';
Function BesselY ( n: Integer; x: Real ): Real; AsmName 'yn';
Procedure Plot ( x, y: Real; Color: Integer );
begin (* Plot *)
if ( x >= xMin ) and ( x <= xMax ) and ( y >= yMin ) and ( y <= yMax ) then
GrPlot ( Round ( ScreenWidth * ( x - xMin ) / ( xMax - xMin ) ),
ScreenHeight - Round ( ScreenHeight * ( y - yMin ) / ( yMax - yMin ) ),
Color );
end (* Plot *);
begin
GrSetMode ( gr_biggest_noninterlaced_graphics, 0, 0, 0, 0, 0 );
CoordColor:= GrAllocColor ( 0, 0, 255 );
for i:= 0 to 5 do
JColor [ i ]:= GrAllocColor ( 255 - 40 * i, 0, 0 );
for i:= 0 to 5 do
YColor [ i ]:= GrAllocColor ( 191 - 40 * i, 191 - 40 * i, 0 );
ScreenWidth:= GrScreenX + 1;
ScreenHeight:= GrScreenY + 1;
x:= xMin;
repeat
Plot ( x, BesselJ0 ( x ), JColor [ 0 ] );
Plot ( x, BesselJ1 ( x ), JColor [ 1 ] );
for i:= 2 to 5 do
Plot ( x, BesselJ ( i, x ), JColor [ i ] );
if x > 0 then
begin
Plot ( x, BesselY0 ( x ), YColor [ 0 ] );
Plot ( x, BesselY1 ( x ), YColor [ 1 ] );
for i:= 2 to 5 do
Plot ( x, BesselY ( i, x ), YColor [ i ] );
end (* if *);
Plot ( x, 0, CoordColor );
x:= x + xStep;
until x > xMax;
GrLine ( ScreenWidth div 2, 0, ScreenWidth div 2, ScreenHeight - 1, CoordColor );
readln;
GrSetMode ( gr_default_text, 0, 0, 0, 0, 0 );
end.