Questions tagged [mathlink]

MathLink is an API provided by Wolfram that allows programs to expose functionality to Mathematica and/or utilize the power of Mathematica's kernel.

"Extensively used within the Mathematica system itself, MathLink is Mathematica's unique high-level symbolic interface standard for interprogram communication. With convenient bindings for a variety of languages, MathLink immediately allows arbitrary symbolic objects—representing data, programs, or any other construct—to be efficiently exchanged between programs, on one computer or across a heterogeneous network." - MathLink API

36 questions
14
votes
1 answer

How to use FORTRAN subroutines or functions in Mathematica?

I'm interested in calling fortran codes in a Mathematica session. I learn that Mathlink offers a way to do that. But I have little knowledge on C and nothing on C++. Is anybody willing to give me a detailed example? I'm using with Mathematica 8, MS…
unstable
  • 441
  • 4
  • 10
12
votes
1 answer

CheckAbort inside MathLink functions?

I just found that such MathLink functions as LinkWrite and LinkRead have something like its own internal CheckAbort that absorbs any aborts, and does not propagate them further. This can be easily shown with LinkRead: link =…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
10
votes
2 answers

How to use Mathematica functions in Python programs?

I'd like to know how can I call Mathematica functions from Python. I appreciate a example, for example, using the Mathematica function Prime. I had search about MathLink but how to use it in Python is a little obscure to me. I tried to use a…
GarouDan
  • 3,743
  • 9
  • 49
  • 75
8
votes
1 answer

Understanding Kernel-FrontEnd communication -- Why does my Front End freeze?

EDIT: Just a confirmation whether you can reproduce this or not would be useful. Only a single computer is needed to try this (no remote connection necessary). Update It seems other can't reproduce this on Mac or Win7, so it's either WinXP-specific…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
8
votes
3 answers

Mathematica: MathLink error messages

I think I am starting to understand how to link functions written in C/C++ to Mathematica. The problem I'm facing is that I don't know how to send error messages from my C wrapper to Mathematica. After searching in google I found this MathLink…
jmlopez
  • 4,853
  • 4
  • 40
  • 74
8
votes
3 answers

Executing code in v.5.2 kernel from within v.7.01 session through MathLink

I have Mathematica 7.01 and Mathematica 5.2 installed on the same machine. I wish to be able to evaluate code in the v.5.2 kernel from within Mathematica 7.01 session. I mean that running Mathematica 7.0.1 standard session I wish to have a command…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
7
votes
3 answers

How to make external Mathematica functions interruptible?

I had an earlier question about integrating Mathematica with functions written in C++. This is a follow-up question: If the computation takes too long I'd like to be able to abort it using Evaluation > Abort Evaluation. Which of the technologies…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
5
votes
1 answer

Install MathLink program with arbitrary PATH environment

Is it possible to use Install[] to start a MathLink program with a custom PATH environment variable? I am trying to use mEngine to connect Mathematica to MATLAB on Windows. It only works if mEngine.exe is launched when the PATH environment variable…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
5
votes
5 answers

Possible to use Mathematica from other programming languages (python/C#)?

Is it possible to use Mathematica's computing capabilities from other languages? I need to do some complex operations (not necessarily symbolic, btw), and it'd be pretty sweet to be able to just call Mathematica's functions or running Mathematica's…
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
4
votes
2 answers

How to kill slave kernel securely?

LinkClose[link] "does not necessarily terminate the program at the other end of the connection" as it is said in the Documentation. Is there a way to kill the process of the slave kernel securely? EDIT: In really I need a function in Mathematica…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
4
votes
2 answers

Changing behavior of General::stop and the main loop

On the Documentation page for General::stop we read: This message is generated after the indicated message has been generated for the third time in a single evaluation. Messages are suppressed to prevent redundant or repetitive messages…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
4
votes
1 answer

Compiling Pythonika on MacOS

I'm compiling Pythonika on Snow Leopard and the errors I get suggest that I'm missing some standard flag, any idea what's missing? Another post suggests I need -lrt flag, but that's not available on MacOS cc…
Yaroslav Bulatov
  • 57,332
  • 22
  • 139
  • 197
3
votes
1 answer

Incorrect $SystemID in Mathematica

I am trying to link Mathlink libraries in mathematica. I am using a x86_64-suse-linux OS, but when I check $SystemID in Mathematica, it tells me I am using 'Linux' instead of 'Linux-x86-64'. This is a problem because if I try to link the library as…
drjrm3
  • 4,474
  • 10
  • 53
  • 91
3
votes
3 answers

How to make an analog of InString[]?

I have discovered that InString[] does not work in MathLink mode when sending input with EnterExpressionPacket header. So I need to define my own function that returns previous input line. One way I have developed here does not work in some…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
3
votes
2 answers

(MathLink) Correct handling of Messages generated by slave kernel

When working through MathLink with slave kernel I have a problem with correct parsing TextPackets. In particular when such packet corresponds to a Message generated by the slave kernel I do not understand how to handle it correctly at all. I need…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
1
2 3