# Tag Info

## Hot answers tagged interoperability

39

Here is a package which does what you want: https://github.com/arnoudbuzing/webunit Clone the repository from github, and place the WebUnit folder under $UserBaseDirectory/Applications To use it: Needs["WebUnit"] InstallWebUnit[] (* launches chromedriver.exe *) StartWebSession[] (* launches Chrome web browser, assuming you have that installed *) ... 37 You can use the binary format to speed up the process: python side import numpy as np array = np.random.rand(100000000); array.astype('float32').tofile('np.dat') Mathematica side data = BinaryReadList["np.dat", "Real32"]; // AbsoluteTiming (* {2.56679, Null} *) data // Dimensions (* {100000000} *) 35 Get all the files here. .NET Mathematica Word Library You will need to use a Microsoft library to open word documents. In a language such as .Net it is very easy; just open Visual Studio, reference the Microsoft.Office.Interop.Word .NET DLL (for Words) and the C:\Program Files\Open XML SDK\V2.5\lib\DocumentFormat.OpenXml.dll (for Formulas in the MathML ... 34 Updated answer with Dockerfile After the release of wolfram engine I thought it is a good time to revisit this old answer and refine it a bit. First install docker on your machine. Follow docker setup from old answer. Dockerfile Create a file named Dockerfile with following content. FROM ubuntu LABEL version = "1.0" LABEL description = "Docker image ... 33 Mathematica 12.0 brings two new features that make this easier to do than it was before: ExternalFunction Wolfram Client for Python Below we implement a function nxFunction that automatically handles translating Mathematica expressions of interest to Python, as well as converting the results back. The usage will be nxFunction["someNetworkxFunction"][... 32 This is a good application for the highly underused Splice function which has been in Mathematica since version 1 (I don't recall it ever being used on this site). Create a file called main.mtex with the following text: \documentclass[preview,border=12pt,12pt]{standalone} \usepackage{amsmath} \def\f(#1){(#1)^2-5*(#1)+6} \begin{document} \section{Problem}... 25 Since this answer was originally posted, the Blender software package has undergone significant revision causing the Python scripts to break. I have modified the scripts so that they should work from v2.79b to v2.93LTS. Updated Blender scripts Note: I added an update below to import position and orientation transformations and view the 3D simulation results ... 24 I assume you have Maple to use. If so, Simply open Maple and type the Mathematica command itself directly into Maple using the FromMma package built-into Maple, like this: restart; with(MmaTranslator); #load the package (*[FromMma, FromMmaNotebook, Mma, MmaToMaple]*) and now can use it FromMma(Integrate[Cos[x],x]); One can also use Maple convert ... 22 You can install the LiveWeb plugin for PowerPoint which allows to embed a live webpage into a slide. Now you should prepare an HTML page with emdedded CDF object (here and here you can find old instructions how to do this, but probably there is easier way now) and embed it into a PowerPoint slide. People say that it works surprisingly well and you maintain ... 22 The Run command returns the exit code of the program being run. In your case, the program is "!ls" which probably doesn't exist on your system (If you try sh -c '!ls -la$HOME' you'll also get an error). Why it returns 32512 instead of 127 (which is the return value I get by the shell) I don't know; however I notice that $32512 =127\cdot 256$, so I guess ...

20

Building off of @M.R.'s idea, it is possible to set up an interactive python shell using StartProcess as opposed to RunProcess, allowing for much more flexible connectivity between Python and Wolfram without as much overhead. In it's simplest form, one can open a connection, interact with it, and close it using the following example: path = "e:\\Programs\\...

19

Does this do the job? links = Import[ "http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/2005/", "Hyperlinks"] {"http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/2005/?C=N;O=D", "http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/2005/?C=M;O=A", "http://www1.ncdc.noaa.gov/pub/data/cmb/drought/weekly-palmers/...

18

If you need to achieve the best possible quality I strongly recommend against using the Clipboard for transferring graphics. Under Windows the clipboard will contain a Windows Metafile generated with display resolution fidelity! This is the reason why you see jaggies. The same is true for the vector graphics files generated by Mathematica's Save Selection ...

18

I consider this question pretty much answered by @MarcoB, as follows: Mathematica 10 apparently forces rasterization by default when exporting 3D graphics to PDF, even when one adds the option "AllowRasterization" -> False to Export. The only way to disable it is to use the Inset workaround suggested by Jens: Export["PDFTestExport.pdf", Graphics[Inset[g,...

17

Here is a more robust solution using Process: Clear[runPython]; runPython::badCommand ="Python code failed to run with message StandardError"; $pyimports="from random import randint "; runPython[str_String, imports_:$pyimports] := Module[ {pyscrpt = ToString[$pyimports<>str, CharacterEncoding->"ASCII"], file=CreateTemporary[], res}, ... 16 To overcome some limitations of RLink with regard to performance and parallelizability, I also created a LibraryLink based interface to igraph: IGraph/M Since the original release, IGraph/M has grown into a large package of ~300 functions that is not only an igraph interface, but also provides many unique functions for working with graphs in Mathematica. ... 16 In terms of loading C++ functions, I would strongly suggest LibraryLink. It is a great tool except that it requires you to write sometimes intimidating C code. To make LibraryLink easier to use, I have developed a package called wll-interface, available in this github repository. It is a header-only library written in C++, doing only one thing—... 16 You can open a whole Mathematica notebook in Maple using its Open... menu, and all expressions in the notebook will be converted to Maple representation: 16 You create metafiles every time when you copy graphics from Mathematica FrontEnd and paste it in MS Word because it is native format for exchanging vector graphics under Windows. So your question is actually about corrupted metafiles in MS Word document opened on a machine without Mathematica fonts installed. This behavior is expected because unlike PDF and ... 15 Since 11.2 Mathematica has supported ExternalEvaluate and since 11.3 this functionality has been conveniently available simply by beginning an input cell with > which produces an external code cell: The output of these cells is a Wolfram Language expression that you can then compute with. 14 There is a package called LTemplate that automates writing some of the boilerplate code for LibraryLink: How to simplify writing LibraryLink code? I consider this less effort than writing standard LibraryLink code. In this sense it is a fitting answer for this question. However, I do recommend familiarizing yourself with the standard way of using ... 14 Update It's probably easier to use Edit -> Copy As -> Bitmap from the menubar. Changing the magnification of the notebook will change the size of the image that gets sent to the clipboard Previous answer There's likely a better answer out there, but I use a hack of the SEUploader to do this. toclipboard2[] := If[ MemberQ[Hold[{},$Failed, ...

14

Here is a template to read a numpy binary ".npy" file created simply by numpy.save(filename,array) this file format has the array structure encoded as a python string that we need to parse.. {'descr': '<f8', 'fortran_order': False, 'shape': (3, 4, 5), } the byte order is also encoded so that this format is portable across hardware. all of this code is ...

14

.fits method One possible way is to use the .fits format... Export["~/Dropbox/tensor.fits", tensor] from astropy.io import fits hdul= fits.open("/home/cosnett/Dropbox/tensor.fits") np.array([hdul[i].data for i in range(1)]) .hdf5 method as suggested below Export["~/Dropbox/planet.hdf5", tensor, "HDF5"] from numpy ...

14

We have developed a C library to support BinarySerialize/BinaryDeserialize. I confirm that we plan to open-source it as well. The library is built around a struct, called WXFExpr, that can represent any WXF types. It decodes a stream of WXF bytes into a stream of WXFExpr, which can be seen as an intermediary representation, ensuring the encoding is ...

14

No, this is not built-in and I have been waiting quite long for such a feature. PardisoLink With the help of Szabolcs's package "LTemplate" I had written such an interface for the Intel MKL Pardiso that is shipped with Mathematica a couple of years ago. I spent all day to bring it into a shape that has at least a small chance to run on a computer ...

12

You can't. You can combine CDFs and content generated by other tools on web pages, though. From Frequently Asked Questions about the Computable Document Format (CDF) (Wolfram Research): Do CDFs plug in to Microsoft Office documents or PDFs? Currently, the CDF Player plugin only supports web browsers. We are exploring the same capabilities for a number of ...

12

MATLink 1.x is based on the MATLAB Engine interface, which sets its limitations and possibilities. What you are asking for is possible on Windows, but not on Mac or Linux. By default MATLink will start a new instance of MATLAB in the background. On Windows and Mac you can see this instance appear in the taskbar or dock. All MATLAB commands are evaluated ...

12

The problem lies in the declaration of the DLL function acumSumR. It is declared to return a double[] but the Haskell return type is IO () which corresponds to C void. So the declaration should read: acums = DefineDLLFunction["acumSumR" , "c:\\temp\\SumRoots.dll" , "void" (* <-- "void" instead of "double[]" *) , {"int*"...

11

Convert Maple expressions to Mathematica: Through latex： Through free form input：

Only top voted, non community-wiki answers of a minimum length are eligible