Hey Ondrej,

While the correspondence is not exact, this should be enough to work:

sage: e = x*y
sage: type(e)
<class 'sage.calculus.calculus.SymbolicArithmetic'>
sage: e._operands
[x, y]
sage: e._operator
<built-in function mul>
sage: e = exp(y)
sage: e._operands
[exp, y]
sage: type(e)
<class 'sage.calculus.calculus.SymbolicComposition'>
sage: var('z')
z
sage: f = x+y*z
sage: f._operands
[x, y*z]
sage: (y*z)._operands
[y, z]
sage: sin(y*z)._operands
[sin, y*z]

--Mike

On 9/30/07, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> > sage: limit((sin(2*x)/x)**(1+x), x=0)
> > ---------------------------------------------------------------------------
> > <type 'exceptions.TypeError'>             Traceback (most recent call last)
>
> BTW in SymPy:
>
> In [1]: from sympy.series.limits2 import compare, mrv, rewrite,
> mrv_leadterm, limit
>
> In [2]: limit((sin(2*x)/x)**(1+x), x, 0)
> Out[2]: 2
>
>
> I am playing with the limit algorithm in SymPy, since we have made
> some changes in the core and it stopped working, because it relies
> heavily on the series facility. Some expression are quite difficult to
> check by hand, so I used to check them in Maple, but it would be
> better if I could check them in SAGE so I'd like to port the limit
> algorithm to SAGE as well, so that I can check more easily, where
> exactly the bug is. It shouldn't be difficult, the whole code is here:
>
> http://sympy.googlecode.com/svn/trunk/sympy/series/limits2.py
>
> and tests:
>
> http://sympy.googlecode.com/svn/trunk/sympy/series/tests/test_limit2.py
>
> However, I didn't figure out in the manuals how I can translate this
> from SymPy to SAGE:
>
> In [1]: e = x*y
>
> In [2]: isinstance(e, Mul)
> Out[2]: True
>
> In [3]: isinstance(e, exp)
> Out[3]: False
>
> In [4]: e = exp(y)
>
> In [5]: isinstance(e, exp)
> Out[5]: True
>
> In [6]: isinstance(e, Mul)
> Out[6]: False
>
> It must be something trivial. I would also need to access attributes, like 
> this:
>
> In [1]: e = sign(x**2)
>
> In [2]: e[:]
> Out[2]: (x**2,)
>
> In [3]: e[0]
> Out[3]: x**2
>
> In [4]: (x+y*z)[:]
> Out[4]: (x, y*z)
>
> In [5]: (y*z)[:]
> Out[5]: (y, z)
>
> In [6]: sin(y*z)[:]
> Out[6]: (y*z,)
>
> I would expect either this notation, or some .ops, or .args or
> something. The only thing that I found is
>
> sage: e = x*y*exp(z)
> sage: e.variables()
> (x, y, z)
>
> but that doesn't exactly do what I want:
>
> In [1]: e = x*y*exp(z)
>
> In [2]: e[:]
> Out[2]: (x, y, exp(z))
>
>
> Besides this there shouldn't be a major problem.
>
> To motivate you why it is good for SAGE: besides having a better
> algorithm than Maxima has, the limit algorithm is very good at
> discovering bugs and thoroughly testing the underlying series
> facility. We always discovered many subtle bugs in SymPy using limits.
> Also it would be good for me to see all the differences between SAGE
> and SymPy so that we can try to converge more to the same interface.
>
> Ondrej
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to