On Sun, Jun 8, 2008 at 6:13 AM, Mark Dewing <[EMAIL PROTECTED]> wrote:
>
> Several expression forms seem be reduced to a canonical form (both in
> the representation and in the pretty printed output).  Examples:
> 1. Factorial  vs. Gamma function
> 2. Sqrt(radical) vs.  a**(1/2)
>
> Is there any way to control what form is used?

In the cases above -- currently no.

>
> Another case, (i*j)**(1/2) is represented as i**(1/2)*j**(1/2).   Is
> there some way to collect the bases under the sqrt ?

Also no.

Would any or all of the above be useful for you? If you look at the
definition of sqrt:

def sqrt(arg):
    arg = sympify(arg)
    return arg**S.Half

so it has the advantage that things are simple. As to factorials and
gamma, unfortunately currently have two implementations that I think
should be merged to one (gamma) and then we could have something like:

def factorial(arg):
    arg = sympify(arg)
    return gamma(arg+1)

or something similar.

However, I think it could be useful to tell sympy --- rewrite all
gamma to factorials, or rewrite all a**(1/2) to Sqrt (note that we
don't have any Sqrt class in SymPy, but we could introduce one).

Maybe a solution would be to have "sqrt" and "factorial" the simple
functions above, and Sqrt and Factorial to be classes for representing
the sqrt and factorial (not automatically evaluating them to a**(1/2)
and gamma) and then we could enhance the rewrite functions in SymPy to
be able to convert between these. Anyone interested in implementing
this?

If you would like to give it a shot, I (and I am sure others too) will
be at hand to help you with the patch.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to