REVIEW
A Basic Introduction on Math-Link in Mathematica
Mathematical Software · Submitted 1 Mar 2006 · 5 references
Pith's verdict: A beginner Mathematica tutorial that calls a Fortran program through a shell pipe but presents itself as MathLink; the central claim is mislabeled and unverified.
T0 · AI review
Why Pith says this
Highlight any text to comment on it.
Referee report
The paper
The paper claims
This paper shows that a Fortran-90 program can be linked into a Mathematica notebook using two commands, Export and ReadList with a shell redirect.
The reading
What carries the argument
The central mechanism is the command pair Export["mat3.dat", output] and ReadList["!mat <mat3.dat", Number, RecordLists -> True]. Export writes the matrix order followed by the two input matrices as plain text; the '!' prefix tells Mathematica to execute the external command 'mat' with the file redirected as its standard input; the Fortran program reads the order n, reads matrices a and b, computes c = matmul(a,b), and prints the result; ReadList parses those printed numbers back into a flat list, and Partition reassembles them into the product matrix. The work of carrying the data is done entirely by a text file and standard input/output, which is why no C-level MathLink programming is needed.
Extended reading notes
Core claim
The paper's discovery is that the Mathematica command ReadList["!mat <mat3.dat", Number, RecordLists -> True] completes a working bridge between a notebook and a separately compiled Fortran-90 executable. In the worked example, Mathematica builds two square matrices, inserts a leading row containing the matrix order, exports the result to mat3.dat, invokes the external program 'mat' through the '!' shell escape, and reads back the product matrix, which is then partitioned and passed to Eigenvalues. The article presents this as a general recipe: with the right compiler command, the same Export/ReadList pattern links Fortran 77 and Fortran 95 programs as well. The surrounding tutorial material on starting Mathematica, writing programs, and local versus global variables is preparation for this main mechanism.
Load-bearing premise
The load-bearing premise is that the numbers written to mat3.dat line up exactly with the Fortran program's READ(*) sequence: first the matrix order n, then all n×n entries of a, then all n×n entries of b; the paper never verifies this ordering against the file it actually exports.
Editorial extensions
If this is right
- For a fixed compiled executable, changing the single parameter ns in the notebook cell regenerates the data file and produces eigenvalues for matrices of that order.
- The same Export/ReadList recipe can be reused for other Fortran programs (F77 or F95) by compiling with the appropriate command, such as xlf, f77, or xlf95.
- A user can keep the executable in a separate directory and connect to it with SetDirectory, then restore the original directory with ResetDirectory.
- Because the bridge uses only a text file and standard input/output, no knowledge of the MathLink C API is required to use the example.
Reading between the lines
- The described 'mathlink' is actually a text-file pipe: if a future version changes Mathematica's Export formatting or the Fortran READ order, the link breaks silently; a formal MathLink interface would not have that fragility.
- The same stdin/stdout handoff should work for any compiled numerical program, not only Fortran, so the recipe generalizes to C, C++, or command-line programs that read numbers and print numbers.
- A direct timing comparison between Mathematica's built-in matrix multiplication and the linked Fortran executable for large ns would make the speed claim testable; the paper reports no such measurement.
Original abstract
Starting from the basic ideas of mathematica, we give a detailed description about the way of linking of external programs with mathematica through proper mathlink commands. This article may be quite helpful for the beginners to start with and write programs in mathematica. In the first part, we illustrate how to use a mathemtica notebook and write a complete program in the notebook. Following with this, we also mention elaborately about the utility of the local and global variables those are very essential for writing a program in mathematica. All the commands needed for doing different mathematical operations can be found with some proper examples in the mathematica book written by Stephen Wolfram \cite{wolfram}. In the rest of this article, we concentrate our study on the most significant issue which is the process of linking of {\em external programs} with mathematica, so-called the mathlink operation. By using proper mathlink commands one can run very tedious jobs efficiently and the operations become extremely fast.
The compiled record
The paper's own sentences, arranged, kept beside the review and separate from it. Each label is drawn from a closed vocabulary; the number beside it is the probability the classifier gave that label. Numbers in the tables are the authors', checked by code. No sentence in this record was written by a model.
The abstract, sentence by sentence
Starting from the basic ideas of mathematica, we give a detailed description about the way of linking of external programs with mathematica through proper mathlink commands. This article may be quite helpful for the beginners to start with and write programs in mathematica. In the first part, we illustrate how to use a mathemtica notebook and write a complete program in the notebook. Following with this, we also mention elaborately about the utility of the local and global variables those are very essential for writing a program in mathematica. All the commands needed for doing different mathematical operations can be found with some proper examples in the mathematica book written by Stephen Wolfram \cite{wolfram}. In the rest of this article, we concentrate our study on the most significant issue which is the process of linking of {\em external programs} with mathematica, so-called the mathlink operation. By using proper mathlink commands one can run very tedious jobs efficiently and the operations become extremely fast.
background contribution method result interpretation main claim
| # | sentence | role | the authors' own work | states the main conclusion | strength |
|---|---|---|---|---|---|
| s0 | Starting from the basic ideas of mathematica, we give a detailed description about the way of linking of external programs with mathematica through proper mathlink commands. | contribution 0.88 | 0.55 | 0.12 | asserted 0.99 |
| s1 | This article may be quite helpful for the beginners to start with and write programs in mathematica. | interpretation 0.71 | 0.07 | 0.08 | hedged possibility 1.00 |
| s2 | In the first part, we illustrate how to use a mathemtica notebook and write a complete program in the notebook. | contribution 0.44 | 0.49 | 0.03 | asserted 1.00 |
| s3 | Following with this, we also mention elaborately about the utility of the local and global variables those are very essential for writing a program in mathematica. | contribution 0.41 | 0.20 | 0.03 | asserted 0.99 |
| s4 | All the commands needed for doing different mathematical operations can be found with some proper examples in the mathematica book written by Stephen Wolfram \cite{wolfram}. | background 1.00 | 0.04 | 0.03 | asserted 0.96 |
| s5 | In the rest of this article, we concentrate our study on the most significant issue which is the process of linking of {\em external programs} with mathematica, so-called the mathlink operation. | contribution 0.90 | 0.27 | 0.13 | asserted 0.96 |
| s6 | By using proper mathlink commands one can run very tedious jobs efficiently and the operations become extremely fast. | interpretation 0.36 | 0.14 | 0.39 | asserted 0.62 |
What was examined, and what was not
- arXiv listing abstract v4
- full text
- figures and tables
- references and citing sentences
- relations to other papers
- P abstract
- S sections
- T body sentences
- C citations
- R cross-paper relations
Figures
Figures reproduced from arXiv:cs/0603005 by the authors.
References
Discussion
Disagree with the review, or know something it missed? Leave a comment, highlight any passage above to comment on it, or challenge this review formally.