A symbolic toolbox that provides MATLAB users with all of the symbolic and high-precision numeric capabilities of Mathematica. It uses the MathLink communication standard supplied with Mathematica and the MEX facility of MATLAB. In addition, since MathLink can pass native MATLAB matrices (and not just strings) between Mathematica and MATLAB, it is quick and easy to construct matrices in either system and pass them to the other. One can freely mix Mathematica code and MATLAB code without the bother of writing M-files to convert matrices into strings and back. The Mathematica Symbolic Toolbox for MATLAB is implemented as a single MEX-file and the source code is included. Precompiled linux and windows executables are included. Installation instructions for MACs are included in the README.Version 2.0 has been updated from:http://library.wolfram.com/infocenter/MathSource/624 to work with MATLAB R2007b and Mathematica 6.0.
The readme file's "libML.a" is "libML64i3.a" for me, so I needed to type:
mex -Iinclude_path -Llibrary_path -lML64i3 math.c
For point 3), I just added the whole folder by adding the following to my startup.m file (not sure how bad that is):
addpath(genpath('/usr/local/Wolfram/Mathematica/10.0/Executables/'));
Even after exporting the LD_LIBRARY_PATH the shared libraries were not being found. After much time spent with nothing helping, doing the following worked:
create a file in /etc/ld.so.conf.d called, say, mathematica.conf containing library_path, i.e. for me the line:
/usr/local/Wolfram/Mathematica10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions
save the file and then type:
/sbin/ldconfig
If you then type the command:
/sbin/ldconfig -p | grep libML64i3.so
its presence should be shown along with the path to it
I hope that saves someone some of the time I lost!
Successfully compiled under Windows7 x86-64 with MATLAB R2014b and Mathematica 10.0.0.0 using the default math.c (not the one from 'math_windows.zip') and ml64i3m.lib instead of ml32i1m.lib.
Compiler: Microsoft Visual C++ 2010 (C)
The compiled file 'math.mexw64' seems to work mostly fine on my machine (quick test with the examples from the README - only thing that didn't work was the command 'diag(hilbert)')
I get quite a few compiling errors when producing the mex file. I am using Microsoft Visual C++ 2010 Express and MATLAB Version 7.11.0.584 (R2010b). After adding folders to path, I get:
LINK : warning LNK4044: unrecognized option '/lkernel32'; ignored
Creating library C:\Users\FRANCE~1\AppData\Local\Temp\mex_v3XQyS\templib.x and object C:\Users\FRANCE~1\AppData\Local\Temp\mex_v3XQyS\templib.exp
math.obj : error LNK2019: unresolved external symbol MLClose referenced in function CloseMathLink
math.obj : error LNK2019: unresolved external symbol MLNewPacket referenced in function WaitForReturnPacket
math.obj : error LNK2019: unresolved external symbol MLDisownString referenced in function WaitForReturnPacket
math.obj : error LNK2019: unresolved external symbol MLGetByteString referenced in function WaitForReturnPacket
math.obj : error LNK2019: unresolved external symbol MLNextPacket referenced in function WaitForReturnPacket
math.obj : error LNK2019: unresolved external symbol MLClearError referenced in function HandleMathLinkError
math.obj : error LNK2019: unresolved external symbol MLErrorMessage referenced in function HandleMathLinkError
math.obj : error LNK2019: unresolved external symbol MLEndPacket referenced in function OpenMathLink
math.obj : error LNK2019: unresolved external symbol MLPutString referenced in function OpenMathLink
math.obj : error LNK2019: unresolved external symbol MLPutFunction referenced in function OpenMathLink
math.obj : error LNK2019: unresolved external symbol MLOpen referenced in function OpenMathLink
math.obj : error LNK2019: unresolved external symbol MLPutDoubleArray referenced in function PutArrayToMathematica
math.obj : error LNK2019: unresolved external symbol MLPutSymbol referenced in function PutArrayToMathematica
math.obj : error LNK2019: unresolved external symbol MLDisownDoubleArray referenced in function GetArrayFromMathematica
math.obj : error LNK2019: unresolved external symbol MLGetDoubleArray referenced in function GetArrayFromMathematica
math.obj : error LNK2019: unresolved external symbol MLCheckFunction referenced in function GetArrayFromMathematica
math.obj : error LNK2019: unresolved external symbol MLGetType referenced in function GetArrayFromMathematica
math.mexw64 : fatal error LNK1120: 17 unresolved externals
C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'math.mexw64' failed.
I've used this for a few years and find it works very well. I'm trying now to compile it on a Mac running OS 10.7.5
I'm using the command
mex -I/usr/include/ -lMLi3 math.c
and get
if: Expression Syntax.
ld: library not found for -lMLi3
collect2: ld returned 1 exit status
mex: link of ' "math.mexmaci64"' failed.
The library file is definitely in the directory I'm specifying. I see a note in the README that the library path needs to be on the (DY)LD_LIBRARY_PATH - could this be the problem? Any advice would be appreciated
I have the same problem when trying to install the packet. I am using Matlab2011b (64bit), Mathematica, 8.0 Windows 7. When I run "mex - setup" from Matlab, it shows
C:\PROGRA~1\MATLAB\2011B\BIN\MEX.PL: Error: '–setup' not found.
Error using mex (line 206)
Unable to complete successfully.
I have troubles with installing this toolbox. After choosing Microsoft Visual C/C++, Mex-setup gives me an error:
mex-setup
Usage:
MEX [option1 ... optionN] sourcefile1 [... sourcefileN]
[objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN]
Use the -help option for more information, or consult the MATLAB API Guide.
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: No file names given.
Undefined function or variable 'setup'.
I have no idea what I'm doing wrong, so if anyone can help me I'll be really grateful. Thanks.
Hello,
I liked this toolbox very much. I used it successfully with Matlab R2010a and Mathematica 7.0. But now it won't start anymore. I get following error:
"MathLink connection unexpectedly NULL!"
I additionally installed Mathematica 8.0. Is this problem or is it because of some windows updates?
This works under x64 environment;
Mathematica 7.0 win64, MATLAB win64 7.10, Visual Studio 2008, Vista x64.
You have to use mldev64\include and lib\ml64i3m.lib instead of 32bits one.
Be careful not to use Visual Studio Express edition.
I failed to compile mex at first, as they have no x64 libs.
Thx.
As usual from this author, a great addition to MATLAB. Quick note for those compiling on OS X - make sure you edit math.c line 227 as suggested in the comments below it, but don't worry about setting the library path. Your mex line should be something like:
mex -I/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/ -L/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/ -lMLi3 math.c
hello guys.
I just installed Matlab 2009a but it dosen't include symbolic toolbox. I downloaded this file "Mathematica Symbolic Toolbox for MATLAB--Version 2.0" but I didn't know what to do later. how can
i add the symbolic tool to my matlab ?
Hi,
I downloaded this package but got a segmentation violation when running the supplied precompiled math.dll. I am using Matlab 2008a and Mathematica 6.0. Then I copied the mathlink.h and the ml32i1m.lib from the Mathematica directory and tried compiling math.c. However, when I run the mathrun.m script on Matlab I get this error:
C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: 'and' not found.
??? Error using ==> mex at 207
Unable to complete successfully.
I try to install it on Mac OS 10.4.
I cannot compile math.c with mex, i get a parse error the following error:
In file included from math.c:35:
/Applications/Mathematica 5.2.app/AddOns/MathLink/DeveloperKit/Darwin/CompilerAdditions/mathlink.h:92: error: parse error before 'yet'
/Applications/Mathematica 5.2.app/AddOns/MathLink/DeveloperKit/Darwin/CompilerAdditions/mathlink.h:408: error: syntax error before 'enum'
math.c: In function 'MathLinkStringEval':
math.c:332: warning: passing argument 3 of 'MLGetByteString' from incompatible pointer type
math.c: In function 'WaitForReturnPacket':
math.c:566: warning: passing argument 3 of 'MLGetByteString' from incompatible pointer type
Can anybody help me?
Thanks
Comment only
06 Oct 2008
a s
In case anyone gets here b/c they're having the same problem I was, I figured out how to fix the problem.
The issue is that when you do: -lML the compiler looks for a library named libML.a. However, on my machine the library is named libMLi3.a.
Therefore if I run:
/Applications/MATLAB74/bin/mex -I/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/ -L/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/ -lMLi3 math.c
Then everything works out hunky dory.
Thanks,
AS
Comment only
29 Sep 2008
a s
I can't get this to compile on my Mac (OS 10.5.5).
I changed the math.c file as instructed in the readme. When i compile I get an error:
$ /Applications/MATLAB74/bin/mex -I/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/ -L/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/ -lML math.c
ld: library not found for -lML
collect2: ld returned 1 exit status
mex: link of 'math.mexmac' failed.
----
Anyone have any suggestions as to why that is not working?
Thanks,
AS
Comment only
03 Dec 2007
shisen du
optical laser
Comment only
24 Nov 2007
arash paivar
dear ben do you know why i recieved incorrect result by this:
k=sym('k','positive');
z1=1.21+0.008*i
k1=((z1-k))^(1/2);
t=2*pi*k/(imag(k1))
s=int(t,k);
Comment only
31 May 2006
John Szumiloski
Not thoroughly tested, but so far appears to do just what the help files say. This is an invaluable tool to supplement the numeric and application-specific capabilities of MATLAB with the symbolic and programming (Map[], Apply[], etc.)strengths of Mathematica. Just what I needed. Fantastic! (Note: MathSource link is not right as of 2006-05-31. should be space between final '624/' and 'to'.)
08 May 2006
Indrid Cold
Wow! Appreciate this a lot.
27 Feb 2006
Matt W.
Awesome! you saved me from coding MathieuC, thank you
04 Sep 2005
Walid Maghroum
Hi,
Thank you for updating the archive to work with matlab 7.0.
Could you please check the .tar archive?The I could not open the archive because it seems to be corrupted.
thanks a lot
Walid
Updates
28 Oct 2004
Title should be 2.0, slightly updated mex file and README file.
29 Nov 2004
Now including windows dll. Updated description.
12 May 2005
updated help for windows users
20 Oct 2005
Updated with MAC installation instructions.
25 Oct 2005
Better packaging.
03 Mar 2006
better windows support
06 Mar 2006
better windows support
06 Mar 2007
Documentation link fix.
19 Dec 2007
Doc update. New binary. Recompiled to work with most recent versions.