Hi William, hi Mikie, On 19 Aug., 01:27, William Stein <wst...@gmail.com> wrote: > 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")
I am not sure if this is what Mikie had in mind. It seems like he wants a python function that has an argument x, and he wants to pass *this argument* (not just the string 'x') to maxima. Certainly I am not a maxima expert. But extrapolating from other interfaces, you could try to transform the argument x into maxima by xm = maxima(x) Of course, it depends both on the input and on the quality of the maxima interface whether this transformation works. In bad cases, you need to pre-process x before passing it to maxima. If you want to do computations with the maxima version xm of x, you could do it in a python way xm.method_name(arguments) or you could directly talk with maxima, by passing strings, as William explained above. Note that xm is known to maxima by the name xm.name (). So, again extrapolating from other interfaces, I think youcould do maxima.eval('p1:%s'%(xm.name())) whatever this means. Cheers, Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---