Serving the Quantitative Finance Community

 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

I LOVE FORTRAN

February 3rd, 2015, 3:21 pm

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.
Last edited by Cuchulainn on February 2nd, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
gelfand
Posts: 14
Joined: July 14th, 2002, 3:00 am

I LOVE FORTRAN

March 9th, 2015, 7:16 pm

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.
Last edited by gelfand on March 8th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

I LOVE FORTRAN

March 10th, 2015, 9:19 am

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.
 
User avatar
gelfand
Posts: 14
Joined: July 14th, 2002, 3:00 am

I LOVE FORTRAN

March 27th, 2015, 6:18 pm

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.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

I LOVE FORTRAN

March 30th, 2015, 9:50 am

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.
 
User avatar
Polter
Posts: 1
Joined: April 29th, 2008, 4:55 pm

I LOVE FORTRAN

April 6th, 2015, 2:01 pm

Cuch: here goes, have fun! ;-)ARCHER TechForum Mar 2015 Not-so-old Fortran
Last edited by Polter on April 5th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: I LOVE FORTRAN

May 23rd, 2020, 1:25 pm

Ask Professor Fortran
«Энциклопедия профессора Фортрана»


http://blog.katichka.ru/scans/entsiklop ... trana.html

Image
 
User avatar
tags
Posts: 3162
Joined: February 21st, 2010, 12:58 pm

Re: I LOVE FORTRAN

June 17th, 2020, 9:36 am

A Fortran-Keras Deep Learning Bridge for Scientific Computing

Multiple generations can live under one roof.
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: I LOVE FORTRAN

June 17th, 2020, 2:27 pm

 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: I LOVE FORTRAN

June 17th, 2020, 3:02 pm

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

Image
 
User avatar
Cuchulainn
Topic Author
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Re: I LOVE FORTRAN

February 12th, 2024, 5:02 pm

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