Page 2 of 2
I LOVE FORTRAN
Posted: February 3rd, 2015, 3:21 pm
by Cuchulainn
QuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaIf the core grammar and atoms of C++ are best suited to a certain style of programmingAnd that style(s) is?"Complicated"LOL edit: it is becoming like a Swiss army knife.
I LOVE FORTRAN
Posted: March 9th, 2015, 7:16 pm
by gelfand
QuoteTL;DR: If you have higher ease of use, popularity, performance (without having to pay extra for it), and interoperability -- what do you need Fortran for?If you like Matlab, Python with Numpy, or R because operations on whole arrays and array sections are convenient, and because allocating and passing multidimensional arrays to functions is simple, then when you need a compiled language, why not choose one that also has those features? Modern Fortran does.
I LOVE FORTRAN
Posted: March 10th, 2015, 9:19 am
by Cuchulainn
QuoteOriginally posted by: gelfandQuoteTL;DR: If you have higher ease of use, popularity, performance (without having to pay extra for it), and interoperability -- what do you need Fortran for?If you like Matlab, Python with Numpy, or R because operations on whole arrays and array sections are convenient, and because allocating and passing multidimensional arrays to functions is simple, then when you need a compiled language, why not choose one that also has those features? Modern Fortran does.AFAIK Matlab seems to be built atop Fortran.In the past one reason for moving away from Fortran (e.g. graphics and CAD) to C was the latter's inability to support upcoming OSs like UNIX, DOS and OS/2.
I LOVE FORTRAN
Posted: March 27th, 2015, 6:18 pm
by gelfand
For people who know Python, one way to get a sense of modern Fortran is to look at the Python Fortran Rosetta Stone
http://www.fortran90.org/src/rosetta.html .QuotePython with NumPy and Fortran are very similar in terms of expressiveness and features. This rosetta stone shows how to implement many common idioms in both languages side by side.
I LOVE FORTRAN
Posted: March 30th, 2015, 9:50 am
by Cuchulainn
QuoteOriginally posted by: gelfandFor people who know Python, one way to get a sense of modern Fortran is to look at the Python Fortran Rosetta Stone
http://www.fortran90.org/src/rosetta.html .QuotePython with NumPy and Fortran are very similar in terms of expressiveness and features. This rosetta stone shows how to implement many common idioms in both languages side by side.Any OO examples? Just curious. I looked at OO Fortran, looks complicated.
I LOVE FORTRAN
Posted: April 6th, 2015, 2:01 pm
by Polter
Cuch: here goes, have fun! ;-)ARCHER TechForum Mar 2015 Not-so-old Fortran
Re: I LOVE FORTRAN
Posted: May 23rd, 2020, 1:25 pm
by Cuchulainn
Ask Professor Fortran
«Энциклопедия профессора Фортрана»
http://blog.katichka.ru/scans/entsiklop ... trana.html

Re: I LOVE FORTRAN
Posted: June 17th, 2020, 9:36 am
by tags
Re: I LOVE FORTRAN
Posted: June 17th, 2020, 2:27 pm
by Cuchulainn
Re: I LOVE FORTRAN
Posted: June 17th, 2020, 3:02 pm
by Cuchulainn
I lost interest in FORTRAN when they got rid of HOLLERITH cards. Good old days.
www.youtube.com/watch?v=pfskp4R53Q0
This is a 21st century computer room

Re: I LOVE FORTRAN
Posted: February 12th, 2024, 5:02 pm
by Cuchulainn
The Black Scholes option pricer in Fortran95
// DJD
real*8 Function pdf(x)
real*8 x,A
A = 1.0/Sqrt(2.0*3.1415)
pdf = A * Exp(-0.5*x*x)
return
end
real*8 Function cdf(x)
real*8 DPI,x,L,k,a1,a2,a3,tmp,pdf
a1 = 0.4361836
a2 = -0.1201676
a3 = 0.9372980
DPI = 3.1415926535897932
L = Abs(x)
k = 1. / (1. + 0.33267*x)
tmp = a1*k+ a2 * k**2. + a3 * k**3.
cdf = 1.0 - pdf(x)*tmp
if(x.lt.0.) then
cdf = pdf(x)*tmp
end if
return
end
real*8 Function BlackScholes(S, X, T, r, v)
! Put
real*8 S,X,T,r,v
real*8 d1, d2
d1 = (Log(S / X) + (r + v**2. / 2.) * T) / (v * Sqrt(T))
d2 = d1 - v * Sqrt(T)
BlackScholes = X * Exp(-r * T) * cdf(-d2) - S * cdf(-d1)
Return
End
! A fortran95 program for BS option
! By djd
!
program main
implicit none
integer anyKey
real*8 S,K,T,r,v
real*8 BlackScholes
real*8 price
S = 60.0
K = 65.0
T = 0.25
r = 0.08
v = 0.3
price = BlackScholes(S,K,T,r,v)
write(*,*) price
anyKey = system("pause")
end