FortranForm

FortranForm[expr]

prints as a Fortran language version of expr.

Details

  • Standard arithmetic functions and certain control structures are translated.
  • FortranForm acts as a "wrapper", which affects printing, but not evaluation.
  • The width of output lines must be set explicitly by giving the option PageWidth->n for the relevant output stream.
  • SetOptions[$Output,PageWidth->72] uses a line width of 72 characters for standard Wolfram Language output.
  • No declarations are generated.

Examples

open allclose all

Basic Examples  (1)

A Fortran language version of a polynomial:

In[1]:=
Click for copyable input
Out[1]//FortranForm=

A mixed numeric and symbolic expression:

In[2]:=
Click for copyable input
Out[2]//FortranForm=

Scope  (1)

Applications  (1)

Properties & Relations  (2)

Possible Issues  (1)

See Also

CForm  Compile

Tutorials

Introduced in 1988
(1.0)