Thanks, for the help. Here are the functions I created and they
work. I needed one that solved equations for a floating pt. solution
and a definite integral and work in a Python script.
----------------------------------
def MaxIntegrate(x,y,beg,end_):
y1=maxima(x);x1=maxima(y)
a5=maxima.integrate(x,y,beg,end_);a6=maxima.float(a5);
return a6
-------------------------------------------
def MSolve(r1,val1):
a1=maxima.solve(r1,val1);a3=maxima.float(a1)
return a3
---------------------------------------
On Aug 18, 5:47 pm, Simon King <[email protected]> wrote:
> Hi William, hi Mikie,
>
> On 19 Aug., 01:27, William Stein <[email protected]> wrote:
>
>
>
>
>
> > On Tue, Aug 18, 2009 at 2:30 PM, Mikie<[email protected]> 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- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---