Cool.  I can do this in the next couple of days (also need to learn to use
git-rebase and clean up my branches so I can see the forest).

On Mon, Jun 8, 2009 at 1:53 PM, Ondrej Certik <ond...@certik.cz> wrote:

>
> On Mon, Jun 8, 2009 at 12:36 PM, Aaron S. Meurer<asmeu...@gmail.com>
> wrote:
> > I wouldn't bother checking.  If the expression is not a fraction, yes the
> > denom term will be 1, but the code I suggested will do nothing to it.
> >>>> (-x).could_extract_minus_sign()
> > True
> >>>> n,d = (-x).as_numer_denom()
> >>>> n
> > -x
> >>>> d
> > 1
> >>>> -n/-d
> > -x
> > One thing you might want to consider is that as_numer_denom() seems to
> pull
> > together Adds with a common denominator
> >>>> (x-y).as_numer_denom()
> > (x - y, 1)
> >>>> (x-y/(1-x)).as_numer_denom()
> > (-y + x⋅(1 - x), 1 - x)
> >>>> (x-y/(1-x)).could_extract_minus_sign()
> > True
> >>>> n, d = (x-y/(1-x)).as_numer_denom()
> >>>> -n/-d
> > -(y - x*(1 - x))/(1 - x)
> >>>> print simplify((x-y/(1-x)))
> > (x - y - x**2)/(1 - x)
> >>>> ((x - y - x**2)/(1 - x)).could_extract_minus_sign()
> > False
> > I would recommend putting the code at the end of simplify.  As you can
> see,
> > the above looks much nicer if you run it through simplify first.
>
>
> Yes -- consider maybe writing a new function that will just put a
> fraction into the canonical form (using the approach above) and then
> call it at the end of simplify.
>
> 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 sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to