On Tue, Aug 18, 2009 at 2:30 PM, Mikie<thephantom6...@hotmail.com> wrote: > > Yes, that works. > However, I am trying to create a function that has Maxima functions in > it and I can't seem to pass values to it. I am using a Python > function. > > Something like this > ----------------------- > def Subs(x,y): > y1=maxima("float(x);");y1 > maxima("p1:y1;");print maxima("p1;") > a1=maxima("s3:x*y;"); > return a1 > ------------------------- > Is it possible to pass the variables into Maxima function?
If you do maxima.eval("foo") it is exactly like typing foo at the command line in Maxima. You can do anything with that. E.g., above do maxima.eval("p1:y1") to set p1 to y1 in maxima. William > > > On Aug 18, 5:30 am, Minh Nguyen <nguyenmi...@gmail.com> wrote: >> Hi Mikie, >> >> On Tue, Aug 18, 2009 at 7:16 AM, Mikie<thephantom6...@hotmail.com> wrote: >> >> > How do I load Maxima? I using a Python script. >> >> If you want to access the Sage library from your Python script, you >> need to run that script using the version of Python that comes with >> Sage. The command "sage -python /path/to/my/python/script.py" should >> do the trick. To access the functionalities of Maxima from that >> script, you can pass all Maxima commands to the function maxima(). For >> example, say I have a Python script as follows and Sage is in my PATH: >> >> [mv...@sage mvngu]$ which sage >> /usr/local/bin/sage >> [mv...@sage mvngu]$ pwd >> /scratch/mvngu >> [mv...@sage mvngu]$ cat demo.py >> from sage.all import * >> >> print maxima("2 + 3;") >> >> I would then run the Python script "demo.py" as follows: >> >> [mv...@sage mvngu]$ sage -python demo.py >> 5 >> >> and the answer 5 is the output of the version of Maxima that's bundled >> with Sage. >> >> -- >> Regards >> Minh Van Nguyen > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---