Ask Your Question

Andriy's profile - activity

2023-05-31 12:25:19 +0200 received badge  Famous Question (source)
2023-05-23 05:57:51 +0200 received badge  Notable Question (source)
2019-11-27 03:19:15 +0200 received badge  Popular Question (source)
2017-09-30 19:24:32 +0200 received badge  Student (source)
2017-06-22 22:21:24 +0200 commented answer Running Sage from other languages with high(er) performance?

change the last import to sage.repl.preparse in newest version

2017-06-22 21:15:22 +0200 asked a question Keep Sage running in background linux

I need to be able to execute sage commands via the command line without opening the Sage shell. I am currently doing this through "sage -c 'cmd'". The issue I have is that this forces all of sage to boot up, run the command, and then shutdown. Something simple as "sage -c "print(derivative(5*x,x))" takes 3-4 seconds to run. How would I speed this up? My idea was to somehow run Sage in the background and be able to feed it input but I am not sure how to do that. I am feeding the command line input from an external program.

EDIT: I found something that may be useful here: https://ask.sagemath.org/question/23431/running-sage-from-other-languages-with-higher-performance/ (https://ask.sagemath.org/question/234...)

The solution this user provides is creating a python socket server to constantly be running sage and pass along input for evaluation into it. The code isn't exactly daemonized so I will attempt to do that later. I will report on if I got it to work.