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
3
votes
1 answer

The command "nb = NotebookCreate[]" fails within Mathematica?

If I open a notebook in Mathematica, and type "nb=NotebookCreate[]", it creates a new notebook window, as expected. However, if I try the same command from within C#, it fails, and doesn't open a new notebook window: IKernelLink ml =…
Contango
  • 76,540
  • 58
  • 260
  • 305
2
votes
2 answers

Is it possible to run VB windows applications which used Mathematica .NET/Link, without mathematica?

I want to develop a program using VB.Net 2010, and I want to use Mathematica 3DPlot functions via .NET/Link. My problem is that is it possible to run that program in another computer without Mathematica installed?. Thanks
2
votes
2 answers

Mathlink memory usage accumulation

I use MathLink to send and receive independent mma expressions from a C++ application as strings. std::string expression[N]; // ... for(int i = 0; i < N; ++i) { MLPutFunction(l, "EnterTextPacket", 1); MLPutString(l, expression[i].c_str()); …
bbtrb
  • 4,065
  • 2
  • 25
  • 30
2
votes
1 answer

Is it possible to load a C++ shared library to Mathematica 8.0?

I'm trying to load a C++ function compiled to a shared library from Mathematica 8.0. I did manage to use a C function using MathLink but MathLink does not seem to support C++ functions. So I tried to create a shared library and load it through…
2
votes
2 answers

Passing lists from Mathematica to c++ (Mathlink)

I simply want to pass a list of integers to a function written in C++. I've set up the template (.tm) file and all, and I can successfully call a test function whith scalar arguments. Calling the function with the list argument behaves as though the…
Batox
  • 574
  • 1
  • 4
  • 16
1
vote
1 answer

REPL (Read–eval–print loop) with Mathlink (Wolfram Mathematica)

I'm new to Mathlink, and before integrating it in my code I tried to write a small REPL to get accustomed to it. The code is as follows (irrelevent parts omitted, and sorry for the horrible blend of C and C++): int main(int argc,char **argv) { …
zakk
  • 375
  • 1
  • 4
  • 14
1
vote
1 answer

Mathlink and delayed evaluation/variables

I have a scalar function written in Fortran that I'm using in Mathematica via a small mathlink module. I want this function to behave as close to a native Mathematica function as possible, including its handling of symbolic constants. A lot of times…
crasic
  • 1,918
  • 2
  • 18
  • 29
1
vote
2 answers

How to put options into functions in MathLink

This is sort of related to my earlier question, but different. I can't figure out how to give MathLink function options without using Evaluate(), etc. For example, I have the following C#…
PrinceBilliard
  • 181
  • 1
  • 17
1
vote
1 answer

Getting data from MathLink connections

I'm trying to create a C# library (DLL) that calls Mathematica 8 using the .NET/Link protocol. Specifically, I'm using it for things like FFTs, etc. Right now I'm using EvaluateToOutputForm and parsing the resulting string for doubles. Anytime I try…
PrinceBilliard
  • 181
  • 1
  • 17
1
vote
0 answers

MathLinkException C# - Mathematica

Please help me to resolve below issue. I am getting Mathlink Exception, while calling Wolfram Mathematica from Visual Studio2012 using C#. Please see code below. It also shows "Error code: 1012. protocol unavailable" private void…
1
vote
1 answer

Chain of packets in MathLink: are the packets always strictly ordered?

The Documentation does not state clear the order of packets returned by slave kernel via MathLink. It is natural to suppose that (when sending an input expression with head EnterExpressionPacket and working in standard mode): 1) the last packet…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
1
vote
1 answer

Computing derivatives in Mathematica/Mathlink

I'm trying to figure out how to use Mathematica from C via Mathlink. If I just want to compute the value of a built-in function, I can do MLPutFunction( lp, "RiemannSiegelZ", 1L); MLPutDouble(lp, val); and all is fine. Now, if I…
Eugene Smith
  • 9,126
  • 6
  • 36
  • 40
1
vote
0 answers

Dyld crash with MathLink framework

I am trying to call a C program from within Mathematica. I have compiled the addtwo.c example provided by Wolfram Research with fayard@Speed:MathLink$…
InsideLoop
  • 6,063
  • 2
  • 28
  • 55
1
vote
0 answers

Compiling Mathlink Code in Visual Studio 2010 Express LNK2019 Error

I'm attempting to compile a simple C file for use with Mathematica. (Note: I did follow the rest of the instructions, creating the empty addtwotm.c file and adding addtwo.tm) #include "mathlink.h" extern int addtwo( int i, int j); int addtwo( int…
JT Cho
  • 263
  • 1
  • 4
  • 11
0
votes
1 answer

How to create C code using Mathlink

I have studied examples of using mathlink from Visual Studio. The question is, I have a mathematica notebook file where the needed calculations are done. Now I want to make the same things but from my C program using Mathlink. Is there an automatic…
maximus
  • 4,201
  • 15
  • 64
  • 117