linear, inverse, logarithmic by 바죠

inv, lin, log
Inv, Lin, Log
INV, LIN, LOG






# lin
1.000000000000000
12.00000000000000
23.00000000000000
34.00000000000000
45.00000000000000
56.00000000000000
67.00000000000000
78.00000000000000
89.00000000000000
100.0000000000000
&
# inv
1.000000000000000
1.123595505617978
1.282051282051282
1.492537313432836
1.785714285714286
2.222222222222222
2.941176470588236
4.347826086956522
8.333333333333334
99.99999999999991
&
# log
1.000000000000000
1.668100537200059
2.782559402207125
4.641588833612779
7.742636826811271
12.91549665014884
21.54434690031884
35.93813663804627
59.94842503189411
100.0000000000000
-------------------------------


!234567890
implicit none
integer npoint,i
real*8 x_start,x_finish
real*8, allocatable :: array_g(:)
CHARACTER(3) cdivid

cdivid='log'
! cdivid='inv'
! cdivid='lin'
npoint=10
allocate(array_g(npoint))

x_start=1.
x_finish=100.

call arb_grid(cdivid,npoint,x_start,x_finish,array_g)

do i=1,npoint
write(6,*) array_g(i)
enddo

deallocate(array_g)
stop
end
SUBROUTINE arb_grid(cdivid,npoint,x_start,x_finish,array_g)
! Written by In-Ho Lee, KRISS, April 25 (2004)
IMPLICIT NONE
CHARACTER(3) cdivid
INTEGER npoint
REAL(8) x_start,x_finish,array_g(npoint)
REAL(8) delta
INTEGER i

if(npoint == 1)then
array_g(1)=x_start
RETURN
endif

if(cdivid == 'lin' .or. cdivid =='LIN')then
delta=(x_finish-x_start)/float(npoint-1)
do i=1,npoint
array_g(i)=x_start+delta*float(i-1)
enddo
elseif(cdivid == 'inv' .or. cdivid == 'INV')then
delta=(1.d0/x_finish-1.d0/x_start)/float(npoint-1)
do i=1,npoint
array_g(i)=1.d0/(1.d0/x_start+delta*float(i-1))
enddo
elseif(cdivid == 'log' .or. cdivid == 'LOG')then
delta=dlog(x_finish/x_start)/float(npoint-1)
do i=1,npoint
array_g(i)=exp(dlog(x_start)+delta*float(i-1))
enddo
else
write(6,*) 'input error, check cdivid'
STOP
endif

RETURN
END



  1.000000000000003E+016
  1.623776739188723E+016
  2.636650898730374E+016
  4.281332398719409E+016
  6.951927961775613E+016
  1.128837891684696E+017
  1.832980710832442E+017
  2.976351441631321E+017
  4.832930238571780E+017
  7.847599703514639E+017
  1.274274985703144E+018
  2.069138081114801E+018
  3.359818286283793E+018
  5.455594781168562E+018
  8.858667904100876E+018
  1.438449888287668E+019
  2.335721469090141E+019
  3.792690190732271E+019
  6.158482110660284E+019
  1.000000000000008E+020




덧글

댓글 입력 영역

최근 포토로그



MathJax