On 9/9/07, Pablo De Napoli <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I've submitted a patch
>
> http://sagetrac.org/sage_trac/ticket/628
>
> for making "binomial" work as one would
> expect for symbolic expressions, in cases like this:
>
> sage: n=var('n')
> sage: binomial(n+1,n-1)
> n*(n + 1)/2
>
> by defining binomial(x,m)=binomial(x,x-m) whenever x-m is an
> integer.
>
> This would be consistent with the way in which Maxima defines the
> binomial function.
>
> http://maxima.sourceforge.net/docs/manual/en/maxima_31.html#SEC126
>
> is it reasonable to treat the symbolic variable n  as an integer?. In
> this case, I think that this will give the results that one would
> exprect.
>
> However, in gemeral, I think that having domains for symbolic
> variables would be essential for performing symbolic calculations, and
> get correct results (but certainly could make a CAS much more
> complex).
>
> Currently Sage does not have a way to specify
> that a symbolic variable belongs to a certain domain (for example that
> n is a symbolic variable
> representing an integer). I think that, the calculus package
> implicitly assumes that symbolic variable represents a real number.
> [In fact, I think that Axiom is the only free CAS with this feature,
> but I'm not sure about that]
>
>
> Consider for example the expression
>
> sqrt(x**2)
>
> If x is a real number, it can be simplified to
>
> abs(x)
>
> However, if x where known to be a positive real number, it could be
> simplified to
>
> x
>
> On the other hand, if x is a complex number, that expression could be
> problematic (since it depends on choosing a branch for the square root)
>
> Another classical example is the binomial  (x+y)^2=x^2 + 2xy + y^2
> that holds if x and y commute. If one wants to build a CAS that can operate
> on non commuting objects, it is essential to have domains for symbolic
> variables.
>
> just to share some ideas on that...
>

For inspiration, those are things that already work in SymPy:

[EMAIL PROTECTED]:~/sympy$ bin/isympy
Python console for SymPy.

In [1]: sqrt(x**2)
Out[1]: abs(x)

In [2]: x = Symbol("x", positive=True)

In [3]: sqrt(x**2)
Out[3]: x

In [4]: ((x+y)**2).expand()
Out[4]: x**2 + y**2 + 2*x*y

In [5]: x = Symbol("x", commutative=False)

In [6]: y = Symbol("y", commutative=False)

In [7]: ((x+y)**2).expand()
Out[7]: x**2 + y**2 + x*y + y*x


Ondrej

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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