Discussion:
Use Computer Algebra System with LyX
Andreas Karlsson
2007-08-01 12:05:27 UTC
Permalink
Dear LyX developers,

Under the Edit > Math menu in LyX there is an entry Use Computer Algebra System.

Does this menu entry works? I have tried it but not got it to work. Is there any plans to develop this feature?

Compared with LyX's commercial counterpart Scientific WorkPlace, which is integrated with the CAS software MuPAD, a working CAS is one of the few features missing in LyX. What are your thoughts about this?

Ideally, there should be an open source CAS that is integrated and bundled together with LyX just as Scientific WorkPlace and MuPAD are integrated and bundled together, but still could be used independently.

One possible candidate for this is the Yacas (http://yacas.sourceforge.net/) CAS, which is written in C++, just as LyX is, and has the same license (GNU GPL) as LyX. There may be other good candidates, but this is the most advanced open source CAS I have found that is written in C++ just as LyX is, which is a great advantage.

Best regards,
Andreas Karlsson
_________________________________________________________________
Ta en titt på de nya onlinetjänsterna på Windows Live Betas -- så nya att de ännu inte har lanserats officiellt.
http://get.live.com/betas
Pavel Sanda
2007-08-01 12:10:38 UTC
Permalink
Post by Andreas Karlsson
Does this menu entry works? I have tried it but not got it to work. Is there any plans to develop this feature?
i remember some time ago i used it with maxima and it worked for me.

pavel
Andre Poenitz
2007-08-01 16:55:06 UTC
Permalink
Post by Andreas Karlsson
Does this menu entry works?
I works for toy problems only.

Andre'
Helge Hafting
2007-08-02 09:24:42 UTC
Permalink
Post by Andreas Karlsson
Dear LyX developers,
Under the Edit > Math menu in LyX there is an entry Use Computer Algebra System.
Does this menu entry works? I have tried it but not got it to work. Is there any plans to develop this feature?
It works to some extent if you have one of the software packages
LyX supports. I have tested with the free packages maxima and octave.
Unfortunately, only simple stuff will actually work.

Helge Hafting
Gregor Gorjanc
2007-08-02 13:17:41 UTC
Permalink
Post by Andreas Karlsson
Dear LyX developers,
Under the Edit > Math menu in LyX there is an entry Use Computer Algebra System.
...

There is a way to use yacas from R via R package Ryacas [1] so it could
be possible to use this in LyX via Sweave (noweb like system using R
as a program and LaTeX for documentation). I tried this on my fresh
Windows box:

1. Installed LyX 1.4.5 and dependencies

2. Installed R 2.5.1
http://cran.at.r-project.org/bin/windows/base/R-2.5.1-win32.exe

3. Installed Ryacas package (enables easy install of yacas)
- started R
- launched the following code from within R

install.packages('Ryacas', dep = TRUE)
library(Ryacas)
yacasInstall()

4. Tweaked my preferences file to

# FORMATS SECTION #############################
#

\format "literate" "Rnw" "Sweave" "" "editor" "editor"
\format "r" "R" "R/S code" "" "editor" "editor"
\format "latex" "tex" "LaTeX (plain)" "" "editor" "editor"
\format "pdflatex" "tex" "LaTeX (pdflatex)" "" "editor" "editor"

#
# CONVERTERS SECTION ##########################
#

\converter "literate" "r" "R CMD Stangle $$i" ""
\converter "literate" "latex" "R CMD Sweave $$i" ""
\converter "literate" "pdflatex" "R CMD Sweave $$i" ""

5. Copied contents of the following links to layouts subdirectory
in user library (please note that each URL should be one line, but
gmane is limiting me to 80 chars per line)

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-article.layout

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-book.layout

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-report.layout

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-scrap.inc

6. Added R TeX stuff to search path

- added R subfolder in C:/*/MikTeX/tex/latex

- copied contents from C:/*/R/R-2.5.1pat/share/texmf to
C:/*/MikTeX/tex/latex/R

- updated TeX database (MikTeX Settings --> Refresh FNDB)

- checked if TeX can find Sweave.sty- launch in the command tool
the following

findtexmf Sweave.sty

7. Start LyX and reconfigure

8. Created new document

- went to Document --> Settings menu and choose document class that
has (Sweave noweb) string beside

- started new environment scrap and typed the following (watchout,
you must use SHITF+ENTER for newline)

<<myFirstChunk>>=
1+1
@

- saved and previewed PDF to make sure that Sweave is working OK
within LyX

- added the following chunk of code to check Ryacas

<<ryacasChunk>>=
library(Ryacas)
exp1 <- yacas(expression(Factor(x^2 - 1)))
Eval(exp1, list(x = 4))
@

Voila!

[1] http://code.google.com/p/ryacas/

Loading...