FriCAS and Lyx
ralf at hemmecke.org
Tue Apr 13 16:34:10 UTC 2021
On 13.04.21 16:54, Richard Kimberly Heck wrote:
> 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.
Being inexperienced with lyx, I somehow managed to type an expression,
select it with my mouse and then right-click CAS->Mathematica.
The expression was
according to the console, this is what Mathematica sees.
TeXForm[ D [ Si n[ x ] ,x ]]
Surely, this is nonsense. But I cannot say whether it is just me being
unable to input correctly.
>> 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.
First of all, thanks a lot for pointing me directly to the relevant
I had a quick look over the code in that file. I would say that writing
a pipeThroughFriCAS function would be pretty simple (assuming that what
I have to provide to mathed_parse_cell is pure latex code.
But I somehow fear the whole idea of how LyX connects to a CAS is not
very much useful. As Pavel experienced, when working with a CAS, then
one usually has a lot of expressions and the CAS remembers the results
in its session memory. In other words the CAS must be running
side-by-side with LyX only gets requests from Lyx and gives back the
respective LaTeX output. Everything else is not really interesting from
a CAS point of view. Just imagine that you want to write a paper that
describes the flow of computation that you do in the CAS? That is TeX
mixed with computation results and not just evaluation of some simple
I guess, LyX aims at other users. Fair enough.
Contact the fricas-devel mailinglist if ever LyX sees some benefit of
being a frontend to computer algebra systems.
Anyway, thank you for your feedback. I wish you a prospering future for LyX.
More information about the lyx-devel