You haven't provided enough information about your environment, but it is generally feasible to acquire data in Maxima from a file or a socket or a stream. Or compute numerical stuff, generate random numbers, read from a keyboard, web page...etc.
Given that you are familiar with a particular programming language (here, Python) that is not a symbolic math system your approach probably is structured as follows: Your (mostly already written?) python program does stuff A then somehow calls your symbolic math program as a subroutine on data B <your inquiry about Sage> then does something with the returned answer C . There are a few questions here: your program must format something to be input to the symbolic math program. It could be a string, or maybe something that looks like a tree with pointers, or lisp list. Any of these forms may be tricky to produce correctly. You need to know about the symbolic math pgm. Later, your program must receive an answer from the symbolic program. Maybe it is just "true" or 43. But if it is a symbolic expression, then it is maybe a string or a tree with pointers. Or maybe you are just displaying it?? Anyway, you may need to know even more about the symbolic math pgm. Generally, it may be tricky for your program to accept the answer. (this is really a standard question for the ages -- Physicist: can you do symbolic math for me. <discussion> Computer scientist: OK, we can compute "sin(x)*exp(x^2)" What are you going to do with this in your Fortran program? Physicist: uh, evaluate it at x=.1, .2, .3 ... Computer scientist: you mean to call a compiler?? you can just let the symbolic math program do the evaluation, write it into a file, or just plot the curve directly.. Physicist: You can do all that? But my program runs ... < excuses...> ) So you are possibly committing yourself to writing a parser, a string output display, calling a compiler??? ... what else? Here's another structure: Start up Maxima and load a program that does "stuff A". It might even do "stuff A" by calling Python. Maxima is written in Lisp, and there are ways of calling Python. Or the code could be written in Lisp (compiled, maybe faster than Python?) or in the Maxima language. Any of these languages can acquire info from a user, if that is what is in your task. Error checking of symbolic formula input is already written. Having done stuff A, the symbolic part is ready to roll.. What to do with the answer? Whatever. Maxima can decompose the answer, or display it or write to a file ... If it is necessary to run in Python, it is again possible to call Python. (And hand it a string or lisp/maxima structure). If python is called, It can return to Maxima, and Maxima can loop back for the next iteration. ............. If you absolutely have to have Python as "the boss" you could still do this: Start up a python system that does almost nothing but initialize Maxima and call it. Then use the structure outlined above. For what it is worth, I have directly called python library routines (interfaces to multiple-precision arithmetic, as it happens) from lisp. Whether this approach is feasible is probably not a technical question -- just depends on what you are comfortable doing. It may be too late to consider this kind of change, and it may be a bad fit for your application for some other reason. In which case maybe think about this for your next project. If you insist on calling the symbolic math program as a subroutine, perhaps the simplest interface is to invoke Maxima on some input from a command line. If your task is simple enough. RJF On Sunday, May 24, 2020 at 3:49:18 PM UTC-7, Jonathan wrote: > > Although a good idea, I don't think I can make it simple enough to set up > inside a data acquisition environment that depends on Python. This would > require installing Maxima and all the connector software. The people using > this are unlikely to do anything that requires more than a `pip > install...`. Once Sagemath can cleanly install using pip, this problem will > be solved on systems with enough processing power and memory. I've almost > get everything needed working already. I will post a link to the github > repository as soon as I post the first version. > > Thanks to all for the suggestions. > Jonathan > > On Sunday, May 24, 2020 at 12:00:00 PM UTC-5, rjf wrote: >> >> It seems to me that the obvious thing is not to extract parts from >> SageMath, but >> just use Maxima, which is a part, but also an entire symbolic math >> system, >> >> Your example looks like this: ( assignment is ":" equations use "=". >> a command is terminated by ";" ) >> >> eq1 : p*V = n*r*t ; >> eq1/V; >> >> returns p = (n*r*t)/V >> >> RJF >> >> On Friday, May 22, 2020 at 5:47:35 PM UTC-7, Samuel Lelievre wrote: >>> >>> Le samedi 23 mai 2020 02:14:58 UTC+2, Dima: >>> > >>> > Conda does have Sagemath available. >>> > Not 100% sure how it works on Windows, though. >>> >>> One can install SageMath from Conda on Linux and macOS. >>> Not on Windows. >>> >> -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/46aeea2a-7a47-4db2-8f9d-a4d3d2825791%40googlegroups.com.