unfortunately, I don't have the code with me right now (I could give
you on monday), but I'm pretty sure it is something REALLY
straightforward and not optimized, like this:

def coll(expr,s):
    import sympy as sp
    spexpr = sp.sympify(expand(expr))
    temp = sp.collect(spexpr,s)
    return temp._sage_()

var('a b c s')
prova = a*s + (b+s)*c

coll(prova,s)
                (c + a)*s + b*c


the very clear problem is that the result will be expanded exept for
the collected variable. any suggestion is welcome, this is the result
of 5 minute thinking! :)


On 21 Feb, 01:03, David Joyner <wdjoy...@gmail.com> wrote:
> On Fri, Feb 20, 2009 at 6:34 PM, Maurizio <maurizio.gran...@gmail.com> wrote:
>
> ...
>
>
>
> > Example: it seems to me that there is no built-in implementation of
> > the "collect()" function in SAGE, though there is a (seemingly)
> > working one in SymPy. So I wrote myself a very simple function whose
> > argument is a SAGE Symbolic Expression, that transforms it into a
> > SymPy object (via sympify), does the collect with respect to the
> > desired variable, and returns the desimpified object (using the _sage_
> > () function). What do you think about this approach? Do you prefer to
> > keep the number of built-in function small, and to let the user to
> > import the right packages when needed?
>
> This sounds pretty interesting to me. Could you please give an example?
>
>
>
> > Regards
>
> > Maurizio
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to