On 9/9/07, Ondrej Certik <[EMAIL PROTECTED]> wrote:
> On 9/9/07, Pablo De Napoli <[EMAIL PROTECTED]> wrote:
> > 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).

Actually SAGE is mostly already this way.  The calculus functionality
is the one part of SAGE that isn't that way, and that's on purpose to
make things straightforward and not complicated.

> > 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

Actually, in SAGE you can specify that x is a positive real number:

sage: assume(x>0)
sage: abs(x^2)
x^2

This assume command allows one to pass some information on
to Maxima.   Type assume? for more info.  Maxima also supports
assuming that variables are integers, but I think we haven't
made an interface to that in the SAGE calculus package yet.

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

Thanks for posting, which prodded me to post the above.

> [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 [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

SAGE can also do this sort of thing, but it's
more structured/complicated/less symbolic:

sage: R.<x,y> = FreeAlgebra(QQ, 2)
sage: (x+y)^2
x^2 + x*y + y*x + y^2

 -- William

--~--~---------~--~----~------------~-------~--~----~
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