#16592: bug in evaluation of maxima function with product/quotient/power
argument
------------------------------+------------------------
Reporter: rws | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.3
Component: interfaces | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
------------------------------+------------------------
Comment (by kcrisman):
This really was intended to have actual functions on the inside, as all
the documentation examples have.
{{{
cmd = '%s(%s) := %s'%(name, args, defn)
self._eval_line(cmd)
}}}
That's basically the code, where `name` is just the next `sage0, sage1` or
whatever is available. In Maxima:
{{{
(%i1) sage0(x) := f;
(%o1) sage0(x) := f
(%i3) sage0(x);
(%o3) f
(%i5) sage0(0);
(%o5) f
(%i7) sage0(f x);
stdin:28571:incorrect syntax: X is not an infix operator
sage0(f x)
^
}}}
The other errors seem to be something where the line passed by Sage isn't
what is sent to Maxima, somehow.
So I guess what would have to happen is for that `*` to be sent in. Not
sure why it isn't. Note that `F(f*x)` in your example returns `f` as
expected.
----
{{{
sage: F.__call__??
<snip>
if len(args) == 1:
args = '(%s)'%args
return P('%s%s'%(self.name(), args))
}}}
Got it. This is part of the problem that symbolic expressions have
length.
{{{
sage: len(k*x)
2
}}}
Here is why it is different.
{{{
sage: def g(*args):
....: return '%s'%args
....:
sage: g(f*x)
'f*x'
sage: g(k*x)
' f x'
}}}
Yikes!
{{{
sage: print k*x
f x
sage: print f*x
f*x
sage: type(f*x)
<type 'sage.symbolic.expression.Expression'>
sage: type(k*x)
<class 'sage.interfaces.maxima.MaximaElement'>
}}}
I'm not sure what the best way to fix this is; presumably we print Maxima
things this way because Maxima itself does, so changing that would be
unwise:
{{{
(%i1) f*x;
(%o1) f x
}}}
But I don't know that not just using the string rep of the expression is
any better...
--
Ticket URL: <http://trac.sagemath.org/ticket/16592#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.