Recent update
The Answer of My Introduction Mathemathical for Physicist (Jawaban ujian Fismatku)
November 29th, 2008 by nugnux
I use fortran to generate x n y position:
below is the code
PROGRAM Grafik
IMPLICIT NONE
REAL :: gaya,ygaya,k,ky,a,ay,m,v,vy,t,x,y,z
REAL :: sbx,sby,sbz,g,fx,fy,fz
REAL :: r,dt,dx,dy,dz,dv,dvy,theta,phi
INTEGER :: i,j,n
r =100
g =10
n =50
k =10000
ky =1000
t=0
dt=0.001
OPEN (80, FILE = ‘data.dat’, STATUS = ‘NEW’, FORM = ‘FORMATTED’)
WRITE(80,*) ‘ i t x y’
CLOSE(80)
OPEN(80, ACCESS = ‘APPEND’, FILE = ‘data.dat’, FORM = ‘FORMATTED’)
DO i=-n,n
x=i
x=x/10
IF (x .NE. 1) THEN
!y=(2+x-x*x)/(x-1)/(x-1)
z=2-x-x*x
vy=(x-1)*(x-1)
y=z/vy
END IF
WRITE(80,81) x,y
8¹FORMAT(e14.7,’ ‘,e14.7)
END DO
CLOSE(80)
END PROGRAM Grafik
compile using:
$gfortran grafik.f90
that syntax has output a.out
run using:
$./a.out
It’ll create file named data.dat and generate number of f(x)=(2-x-x^2)/(x-1)^2
plot using kst :
$kst -x ¹-y 2 data.dat
It means kst will plot a graph using 1st column as x-axis and 2nd column as y-axis of data.dat
to simplify that procedure, I create text file named run.sh contain:
rm *.dat
gfortran grafik.f90
./a.out
kst -x ¹-y 2 data.dat
make run.sh executable
then run:
$./run.sh
………dan mereka hidup bahagia berdua selamanya.
Posted in fortran | | |
Leave a reply
Categories
- computer (1)
- crazyness (8)
- diary (27)
- fortran (2)
- internet (2)
- linux (1)
- music (8)
- Physicist (5)
- Uncategorized (85)
Archives
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- February 2007
Blogroll

