ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 03 Jan 2019 03:11:12 +0100Calling Sage from Javahttps://ask.sagemath.org/question/44853/calling-sage-from-java/Hello,
I am looking for a way to call Sage functions, such as constructing Polyhedra, from Java (on Windows).
In more detail, I want to do the following:
1. Input to Sage from Java: P1 = Polyhedron(vertices = [[0,2], [-1,0], [1,0], [0,0]])
2. Retrieve in Java the Sage output: P1.Hrepresentation()
It would be optimal if I could call Sage directly somehow, but if it's necessary, I think a python wrapper could also work. It would be very kind if somebody could point me in the right direction, maybe with code snippets, as I am very new to the Sage Environment.
Thank you.CupOfCoffeeThu, 03 Jan 2019 03:11:12 +0100https://ask.sagemath.org/question/44853/invoke external programhttps://ask.sagemath.org/question/9222/invoke-external-program/What is the proper way to call external applications in my programs? Specifically, pdfLaTeX compiler. When I invoke `os.system("pdflatex foo.tex")` in Sage's CLI console, the command executes as expected. However, when I embedded this into my code and run this code, TeX asks for another input:
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(/tmp/foo.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
)
* [blinking cursor here]
Am I missing something or why doesn't this work?
P. S. My original post may have been confusing. When I wrote:
> However, when I embedded this into my code and run this code,
I meant embedding into "my_code.sage" source code, which is consequently attached and run in Sage's CLI.
P. P. S. When use it in my "foo.sage" code as below:
os.system("pdflatex -interaction=batchmode foo.tex")
following log is produced:
(/tmp/foo.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
)
! Emergency stop.
<*> /tmp/foo.tex
*** (job aborted, no legal \end found)
However, written explicitly in Sage's console and even in bash console, everything compiles correctly. Does this mean something? Just FYI, I did end my source file with `\end{document}`MathemageFri, 10 Aug 2012 16:10:26 +0200https://ask.sagemath.org/question/9222/