FriCAS and Lyx
Richard Kimberly Heck
rikiheck at lyx.org
Tue Apr 13 14:54:07 UTC 2021
On 4/13/21 7:07 AM, Pavel Sanda wrote:
> On Tue, Apr 13, 2021 at 11:08:24AM +0200, Ralf Hemmecke wrote:
>>> On the other hand if you are looking for someone who would write LyX part
>>> I am not much optimistic. Based on the minimal code flow and users
>>> feedback to this forgotten area (CAS integration) I think the devel/user
>>> base is rather tiny.
>> Yes, maybe the user base is tiny, but to grow it. It would be
>> interesting to learn what Lyx actually intends with this connection.
> I don't think there is any intention. That code was not fundamentally touched
> for more than a decade and I doubt it's because it matured :)
> Currently you can type some statement in math editor, trigger in menu CAS,
> which will evaluate it & put the result back behind '=' in math editor.
> Relevant part of the code where one could start and check how diffcult
> the implementation might be is in mathed/MathExtern.cpp.
As Pavel suggests, you would basically just need to mimic the existing
code for the other engines. The whole process starts at
InsetMathHull::doExtern, which calls pipeThroughExtern in
MathExtern.cpp, which calls one of pipeThroughMaple, etc, as is
appropriate. That then calls the methods octave(), maxima(), maple(),
and mathematica(), which each math inset has, and which output the
appropriate code for the relevant CAS. You really only need to touch
pipeThroughExtern, write pipeThroughFriCAS, and write the friCAS() methods.
There's also a way to use an external script to parse the 'normalized'
representation of the math inset and return a value. See here
We would then need a menu entry to call the new routines. We can
certainly do that part!
More information about the lyx-devel