Skip to main content

Questions tagged [fortran]

Questions about interfacing Mathematica and Fortran. This also includes conversion of Fortran style numbers to Mathematica style.

Filter by
Sorted by
Tagged with
19 votes
6 answers
15k views

How to export data files using specific number format

Very often, I have to export data files from Mathematica. These output files contain several columns and hundreds of lines with data. For the sake of the question let's create a sample list: ...
Vaggelis_Z's user avatar
  • 8,830
45 votes
1 answer
3k views

Linking FORTRAN with Librarylink

FORTRAN code can be called using MathLink or .NET/Link (see the link for a worked examples). But as mentioned in a talk by T.Gayley and J.Klein in Wolfram Technology Conference 2011, LibraryLink, ...
unstable's user avatar
  • 1,507
27 votes
2 answers
4k views

How can I get Mathematica to produce better Fortran code?

I am new to Mathematica and I am trying to get to it to produce some expressions in Fortran code. However, it seems that Mathematica will output duplicated expressions, that is, expressions the need ...
Tang Laoya's user avatar
22 votes
2 answers
3k views

Import Fortran unformatted binary

I have an unformatted binary file generated using the Compaq Visual Fortran compiler (big endian). Here's what the little bit of documentation states about it: The binary file is written in a ...
kale's user avatar
  • 11k
13 votes
1 answer
983 views

How to load FORTRAN libraries through Librarylink

First, the main reference is the thread Linking FORTRAN with Librarylink, which teaches how to make the link between a FORTRAN subroutine and a Mathematica code, by using Librarylink. This must done ...
fcpenha's user avatar
  • 738
3 votes
1 answer
949 views

Using FortranForm for d0 notation? [duplicate]

When I use FortranForm, it changes 2*a^2 into 2*a**2 which is fine, but if I want the expression in a form such as, 2.d0*a**2 which represents an integer to be ...
Amandeep's user avatar
  • 195
2 votes
1 answer
780 views

How to convert integer value into real value like 2 into 2.d0 in output of matrix in FortranForm?

...
Amandeep's user avatar
  • 195
0 votes
2 answers
144 views

Replacing all integers in a string

Let's say I have some expression like, expr = 1*a + 2*b +3*c + 4*d I want to write this to a string that I can then use in some other Fortran script. I want all ...
user1887919's user avatar
20 votes
1 answer
944 views

Is it possible to use the DGEEV and DSYEV LAPACK subroutines in Mathematica?

Here is my problem: I'm diagonalizing some matrices using Eigensystem[] to obtain eigenvalues and eigenvectors and I'm diagonalizing the same matrices using a ...
User3000's user avatar
  • 311
9 votes
3 answers
3k views

How to change an expression to Fortran90 form?

I have a large expression produced by Mathematica. To use this expression in my Fortran program I need to change it to a Fortran90 form. I am not satisfied with the ...
Orders's user avatar
  • 1,247
2 votes
1 answer
518 views

Insert a linebreak and character repeatedly into a matrix output which is in fortranForm

Suppose I have a very long string which is a11 element of matrix a11=2*gopsv-2*Bgopsvw+2*acgmops*v+2*cgmopsv*B-2*acgmopsvB+3*gmopsvB-3*BgmopsvwB+m*w2*B +5*acgm2 +opsvB -ac*m2*w2*B +cgm2*opsvB* - 3*...
Amandeep's user avatar
  • 195
2 votes
2 answers
476 views

Mathematica code in fortran [closed]

I have an integral in which the integrand is a combination of ratio of modified bessel function of second kind. I am able to find the solution of this integral with mathematica Nintegrate module with ...
Prabhakar Namdev's user avatar
0 votes
2 answers
669 views

Output of matrix in FortranForm

matr2 = Table[FortranForm[matr[[i, j]]], {i, 4}, {j, 6}] but i want output to be more like this matrix(1,1)=a11 output in ...
Amandeep's user avatar
  • 195