Origin 2017 Support communicate with individual instance of Mathematica

ORG-2968 - Getting issue details... STATUS

To communicate with 64-bit MathKernel.exe, Origin 2017 Beta1 updated Sequencer.exe and renamed it to OSequencer.exe. Origin 2017 is therefore able to communicate with individual instance of Mathematica.

Launching the Mathematica Link Tool

Before launching the tool, you will need to set up the Kernel configuration in Mathematica to link to Origin's kernel OSequencer.exe

Note: If you installed Mathematica in the system disk, e.g. C:\Program Files\Wolfram Research\Mathematica\, before doing the following steps, you will need to copy & paste OSequencer.exe to Mathematica's installation folder manually.

  1. Start Mathematica, select Evaluate: Kernel Configuration Options from Mathematica main menu to open a dialog.
  2. Click Add button to bring up the Kernel Properties dialog.
  3. Set Arguments to MLOpen as -LinkName "OSequencer -mathlink -noicon".

    The kernel named "OSequncer" is added to the list.

You can then launch the Mathematica Link tool in Origin.

  1. Select from Origin main menu Tools: Mathematica Link, Origin will ask for Mathematica's Kernel for the first time. 
  2. Locate the exe folder of Mathematica, and then select MathKernel.exe.
  3. The Origin Link for Mathematica dialog is then open.

Note: You can then go to User Files Folder and open the OMAthLinkConfig.INI file.

[MathKernelExecutable]
Location=C:\Program Files\Wolfram Research\Mathematica\11.0\MathKernel.exe

Check if the path points to the correct Mathematica installation folder to which you want Origin to communicate. It is especially important when you installed more than one version of Mathematica. If not, you can

  • Change the path directly and re-save ORIGINML.INI. Then re-start Origin

Or

  • Delete ORIGINML.INI and then re-start Origin. Origin will ask for the Kernel again.

Exchange Data between Origin and Mathematica

You can send and receive data between an Origin worksheet/Matrix book and Mathematica by using the Origin Link for Mathematica dialog.

  • Go to Column tab to send and receive worksheet data to and from Mathematica.
  • Go to Matrix tab to send data and receive matrix data to and from Mathematica.
  • Go to Function tab to create and plot Origin datasets using Mathematica functions.
  • Go to Evaluate tab to evaluate any Mathematica expression that resolves to a scalar.

Examples

Before attempting the examples, please launch the Mathematica Link in Origin using the procedure in the previous section.

Example 1

  1. Open <exe folder>/Samples/Matrix Conversion and Gridding/2D Gaussian.ogm.
  2. Go to the Origin Link for Mathematica dialog and activate the Matrix tab. In the Send Matrix group, set as below

    Click Send button
  3. Go to Mathematica and execute the following script

    invmat = Inverse[mat] 


  4. Go back to Origin. In the Matrix tab, set the Receive Matrix group as follow:
  5. Click Receive button, you will get the inverse of the original matrix to replace the original one.

Example 2

  1. Open Mathematica if not already started.,Create a new notebook. Select menu  menu Evaluation: Notebook's Kernel, make sure the kernel "OSequencer" is selected.. Now the current notebook of Mathematica can communicate with Origin.
  2. Define a function as follow: 
    f1[x_] := (FresnelS[x] + 1/2)^2 + (FresnelC[x] + 1/2)
  3. Go back to Origin. In the Function tab of Origin Link for Mathematica dialog, type the following formula in f(x) = edit box:
    f1[x^2+2]Then specify the curve range and number of data points

  4. Click Plot button. You will get a new graph.