Using Mathematica in Conjunction with LyX. Path Issues?



I am attempting make life easier, and, instead of using Mathematica at the same time that I'm using LyX (a front end for LaTeX), I was hoping that I could just use LyX and use the CAS option to do some of the simple algebraic computations that Mathematica can handle so powerfully.

Of course, this has been a headache for me, as I am not very comfortable with anything Unix related. I already know where to locate Mathematica, its absolute path name, and can put it inside the "PATH prefix" that LyX demands of me. But, even doing that, I cannot get an output on the simplest of computations.

Path for Mathematica's kernel that I entered in LyX

Is anyone familiar with this, because I'm up against a wall. I have no idea what to do. I've been trying for hours.

By the way, as is evident from the picture, I am on a Mac, I don't know if that makes a significant difference.



Here is some more information about something that I'm asking LyX to do, in a picture:

The Option to Use Mathematica

LyX Tries to Communicate with LyX and Fails to Produce an Answer to a Simple Addition


Posted 2014-02-23T21:30:05.310

Reputation: 51

Would you elaborate ? Because I don't really see a question being asked here.. Also, any kind of error log is more than welcome :) – Sektor – 2014-02-23T21:51:05.313

Certainly. I'm wondering why LyX and Mathematica aren't communicating. I've pointed LyX (with what I assume is the correct path) towards Mathematica and basically said, 'OK, now do some basic calculations when I ask you to.' But, this is not the case, LyX and Mathematica don't seem to understand that I wish for them to interact.

Whenever I make LyX do a calculation with Mathematica, nothing happens. LyX says that it is going to get Mathematica, it pops up saying "math-extern Mathematica", but nothing happens! Even though I've pointed LyX towards Mathematica! So that's where the issue lies. :) – Matthew – 2014-02-23T22:05:54.993

These posts might be useful, they mention a batch script to set the path (they don't actually mention when to run it though). link

– Ymareth – 2014-02-24T09:08:15.687



There is a solution described here, where the relevant part is:

...define a wrapper script in your PATH, e.g., /usr/local/bin/math. In this executable script, I have only two lines:

/Applications/ "$@"

I have Mathematica 9.0.1 and Lyx on OS X 10.9.1, and after creating the above "math" script in /usr/local/bin (BTW, I had to do "chmod 755 math" as well) I tested it using the following steps in Lyx:

  1. Insert / Math / Inline Formula
  2. Type "Expand[(x+y)^2]" - then leave the cursor just after the "]"
  3. Edit / Math / Use Computer Algebra System / Mathematica

Lyx and Mathematica then cooperate to fill in the rest of the equation to give "Expand[(x+y)^2] = x^2 + 2 x y + y^2".

Stephen Luttrell

Posted 2014-02-23T21:30:05.310

Reputation: 4 689

Is there any similar solution for those who work in windows 10? – Yorgos – 2018-01-30T15:22:38.613