Hi Cristóvão!
On 25 Okt., 03:30, Cristóvão Sousa cris...@gmail.com wrote:
...
It just has a minor bug when the operator has more than two operands,
like x+y+z, but I'll try to fix it as I got the picture now.
Yes, to my surprise, the add operator only accepts two arguments,
but the list of
Hi Simon,
On Mon, 25 Oct 2010 00:41:07 -0700 (PDT)
Simon King simon.k...@nuigalway.ie wrote:
@symbolic experts (Burcin et al):
Is it really necessary that x.operator() returns None and x.operands()
returns []? What about an identity operator?
The operator and operands don't have a meaning if
Hi Burcin,
On 25 Okt., 11:04, Burcin Erocal bur...@erocal.org wrote:
I suggest we raise a ValueError when there is no operator or operands.
This is already done for iterators of symbolic expressions in #7537:
http://trac.sagemath.org/sage_trac/ticket/7537
Can you open a ticket to do the
Hi Simon,
On Mon, 25 Oct 2010 05:09:06 -0700 (PDT)
Simon King simon.k...@uni-jena.de wrote:
I only opened one ticket, namely #10169, aiming at making
s==s.operator()(*s.operands()) work uniformely.
I don't think this makes sense for variables, numeric objects, or
constants, in other words,
Hi Burcin!
On 25 Okt., 14:39, Burcin Erocal bur...@erocal.org wrote:
If we return an identity operator for these cases, how do you plan to
test for it in your code:
Something like this:
L = x.operands()
if len(L)1:
return x.operator()(*map(lambda ..., L))
else:
try:
return
PS:
I know that testing is None is faster than len(L)1 and wouldn't
insist that there *has* to be an identity operator. One has to
consider two different cases anyway.
However, if there *is* an operator, s==s.operator()(*s.operands())
should hold.
Cheers,
Simon
--
To post to this group, send
Hi Simon,
On Mon, 25 Oct 2010 06:09:16 -0700 (PDT)
Simon King simon.k...@uni-jena.de wrote:
On 25 Okt., 14:39, Burcin Erocal bur...@erocal.org wrote:
If we return an identity operator for these cases, how do you plan
to test for it in your code:
Something like this:
L = x.operands()
Hi Burcin,
On 25 Okt., 15:26, Burcin Erocal bur...@erocal.org wrote:
This initializes a list with a single element for objects which return
None for operator() now. IMHO, this approach is inefficient. In this
case, you should act on the object directly.
I didnt claim that it was efficient -
I made a modification so it can take 1, 3, 4, ... number of operands
nicely.
def symround(x, ndigits=0):
if hasattr(x,'operator') and x.operator():
o = map( lambda y : symround(y,ndigits=ndigits) , x.operands() )
r = o[0]
for i in xrange(1,x.nops()):
r =
Hi Cristóvão!
On 24 Okt., 00:50, Cristóvão Sousa cris...@gmail.com wrote:
But, is there any way of round reals even if they are inside a symbolic
expression?
I guess it would be needed to define a recursive function for that
purpose, using operator and operands of a symbolic expression. Such
On Oct 24, 12:34 pm, Simon King simon.k...@nuigalway.ie wrote:
I guess it would be needed to define a recursive function for that
purpose, using operator and operands of a symbolic expression. Such
as:
sage: def symround(x, ndigits=0):
: if hasattr(x,'operator') and x.operator():
11 matches
Mail list logo