Hi Nathann,

On Mon, Aug 31, 2009 at 5:59 AM, Nathann
Cohen<nathann.co...@gmail.com> > Is there a way in Sage to define a
Formal sum ? Something like
> sum( a_i, i \in [0,...5] ) or even worse, sum(a_e, e\in g.edges()) for
> g a graph, etc.

For formal or symbolic sum, you  need to make it a SFunction sub-class
of new symbolics. Unfortunately, it is yet to be implemented/ported
to the new symbolics and it would be great if you could do this,

See this ticket for related discussion

http://trac.sagemath.org/sage_trac/ticket/3587


I think, symbolic sum implementation would be very similar to
symbolic "integrate" implementation. Please have a look at the
patch

http://trac.sagemath.org/sage_trac/ticket/6465


> I insist it should be a "formal sum",  as it should not return sum
> ( [a_i for i in range(6) ] ) or sum( [a_e for e in g.edges() ] ) , but
> rather an abstract formula for this. It could be evaluated at any
> moment, giving different results if the a_i have changed or if the
> graph has changed meanwhile.


In the _eval_ method of the new class, you can decide on the
situation where you want to evaluate explicitly or leave it symbolic.
If you want to leave it symbolic then just "return None" .


Cheers,
Golam

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an 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