Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [fortran]

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

1
vote
0answers
62 views

Can we link Mathematica and Fortran with WSTP? [closed]

How to link Mathematica and Fortran with WSTP?
1
vote
2answers
171 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 ...
0
votes
1answer
61 views

Printing all elements of table in Fortran form

Let's say I have some Table object. The elements of this table are accessed as Table[[i,j,k]]. For each element in the array I ...
0
votes
2answers
64 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 ...
3
votes
0answers
118 views

How to import a binary data generated by Fortran? [closed]

I have a unformatted binary data file generated by gfortran. However, when the binary data is imported by Mathematica, a correct result is not obtained. This is my fortran code: ...
0
votes
0answers
70 views

Calling FORTRAN function with fixed length Character

Following this example, I have tried to call subroutines written in FORTRAN which uses a fixed length character like "Character*255" (here 255 is an example). If the character length is given as ...
1
vote
0answers
98 views

Fortranform output in double precision

I want to take the output in fortran form but written in double precision notation. For example, exp=1 + 8*as^2*Log[2*x] which gives ...
2
votes
1answer
72 views

Replacement Patterns in FortranForm

I have recently asked a question concerning string replacement rules for FortranForm. This question has been answered by Carl Woll - thanks for that! Now as I was ...
0
votes
1answer
143 views

how to include conditional statements in FortranForm?

how to to include following formula in the FortranForm in a correct format? ...
3
votes
1answer
134 views

Converting subscript in fortranform

i have a matrix like this: F := Table[Subscript[f, i, j], {i, 3}, {j, 3}] c=F.F my question is that how to convert the components of c to this form Subscript[f, ...
1
vote
0answers
75 views

possibility of using `f2py` for interoperability with Fortran

Although interoperability with Fortran could be realised by using LibraryLink (e.g., Linking FORTRAN with Librarylink), the approach is not so straight forward, in ...
3
votes
2answers
173 views

Import .ini file with text and numbers

I have faced a quite simple problem, but, honestly, I don't know what would be better to do. I have a .ini file generated by a Fortran program with with this type of data: ...
3
votes
0answers
110 views

FORTRAN complex number passing to Mathematica through NETLink

I used to use NETLink to call FORTRAN functions or subroutines compiled into a dll file. This works very well until now that I want to call a function which has complex arguments and returns a complex ...
1
vote
0answers
134 views

Call NAG subroutine in Mathematica 10

Is there any package or any other way to call or use NAG library? It was possible in old mathematica?
2
votes
2answers
153 views

Problem with Dot and FortranForm

I am trying to convert some set of equations to a form that will be easy for Python to evaluate numerically, hence I am using Mathematica's FortranForm My problem ...
3
votes
1answer
302 views

Running a Fortran program and getting the results

I'm trying to figure how to make Mathematica interact with a Fortran program that takes 2 parameters in a first input line, 3 parameters in a second input line and produces two lines as outputs. Below ...
0
votes
1answer
193 views

Importing a large number of complex matrices from a .DAT file and then numerically analyzing them one by one

I have a .DAT file generated by Fortran in which I have data for $2 \times 2$ matrices. For example, the file takes the form (when I open it in the excel): I have added a snippet beacause the real ...
0
votes
0answers
198 views

Integrate fortran function into Mathematica

I was trying to use Fortran function in Mathematica. I was following mainly this answer . My Fortran code looks like this: ...
3
votes
0answers
79 views

weird behaviour of Listable fortran Librarylink function: different result each evaluation

I am working with fotran librarylink function currently. In this post, I will show some weird result of Listable fortran librarylink generated by intel compiler under windows (I tried gcc on linux the ...
1
vote
0answers
157 views

Using .Net link with fortran DLL created by Intel Fortran [closed]

I am following unstable's wonderful answer on .NET and fortran. I can reproduce his result using gfortran without problem. But I want to use Intel Fortran, because gfortran generates slower code on ...
1
vote
1answer
356 views

What is the equivalent of FORTRAN 77 COMMON BLOCK in Mathematica?

I am in the process of converting a FORTRAN 77 program to Wolfram Language. I have several COMMON BLOCK statements in FORTRAN 77. My question is how to deal with them in Wolfram Language? My ...
5
votes
1answer
126 views

Customized FortranForm output

Let's take the following example V = (-G*Mn)/Sqrt[x^2 + y^2 + z^2 + cn^2]; Vx = D[V, x]; FortranForm[Vx] The result is ...
8
votes
0answers
368 views

Where is f2mma.zip, Fortran to Mathematica converter?

I want to convert the SOFA libraries to Mathematica, and found out about f2mma, a Fortran to Mathematica converter. Google points to many papers about f2mma, but the only link to the software ...
1
vote
1answer
231 views

How to get output in a specified format

In Fortran, we can easily get the stardard and easy output format. Now, we only focus on the Integer output. See here How to realize this kind of output as formatted text file using Mathematica ? (...
3
votes
1answer
682 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 ...
1
vote
1answer
351 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*...
4
votes
2answers
205 views

How to show Output of matrix in FortranForm with “&” character?

I have a matrix. and i have shown the output of matrix one by one element in FortranForm. the problem is i want to put "&" continuation charater in output because when i am copying the data into ...
0
votes
2answers
286 views

How to show output of a matrix in m(1,1)=a11 m(1,2)=a12 …in this way…i have 50 *50 size matrix

How to show output of a matrix in m(1,1)=a11 m(1,2)=a12 ...in this way......i have 50 *50 size matrix so i want to do it efficiently. output to be shown like m(1,1)=a11 (in fortranForm) m(1,2)=a12 ...
0
votes
2answers
376 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 ...
0
votes
3answers
1k views

Formatting Fortran complex number output for use in Mathematica

Here is a list that was orignially output from Fortran. {{"(0.277336296055697, 0.120000000000000E+000)"}, {"(-1.489297392708939E-002, 0.340000000000000E+000)"}} ...
2
votes
1answer
611 views

Using FortranForm

I need to use in Fortran, matrices that I create in Mathematica, therefore, I need to format them, so that Fortan can understand them. I focus on the simplest example: Let's say I have tha matrix A ...
2
votes
2answers
287 views

ToExpression and Fortran notation

ToExpression["9.0E-03"] interprets the string as 9*e - 3 instead of what I am expecting: ...
6
votes
0answers
239 views

Output most efficient Fortran code by mathematica

I am trying to output most efficient Fortran code by mathematica 9.0 with the method Simon provided: How can I get Mathematica to produce better Fortran code? The expressions is as follows: ...
1
vote
1answer
568 views

Latest Mathematica 9.0 can't use Format.m to generate optimized Fortran code [closed]

Before updating to Mathematica 9.0, I have successfully generated beautiful Fortran code using Mark Sofroniou's Format.m package, which is posted on MathSource. ...
11
votes
1answer
728 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 ...
9
votes
3answers
2k 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 ...
13
votes
6answers
11k 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: ...
25
votes
2answers
3k 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 ...
5
votes
1answer
692 views

How to create FORTRAN Cell?

I want to create a FORTRAN cell in Mathematica. ...
42
votes
1answer
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, ...