[Python-ideas] Fix some special cases in Fractions?

Neil Girdhar mistersheik at gmail.com
Thu Aug 30 05:25:04 EDT 2018


On Thu, Aug 30, 2018 at 5:11 AM Jonathan Fine <jfine2358 at gmail.com> wrote:

> Hi Neil
>
> We wrote
>
> >> This gives the same results as Python's Fraction, except for your
> >> example [6]. There, it gives the Fraction(0) you ask for.
> >>
> >> If the smart mathematicians and computer scientists that wrote gp/pari
> >> get the same answers, it suggests to me that improvement would be
> >> hard.
>
> > That's because these are just floating point numbers.  These are not
> being
> > processed symbolically.  Wolfram Alpha gives all three roots, including
> the
> > real root.
>
> I've not used Wolfram Alpha, nor I think have many people on this
> list. Please copy and paste the input and output from Alpha, so we can
> see for ourselves (and so there's a record on this list).
>

It's online for everyone to use:
http://www.wolframalpha.com/input/?i=(-1)+%5E+(1%2F3)


>
> If anyone has time and ready access, it would help to know what
> https://www.sympy.org/en/index.html does with this.
>
> Perhaps your innocent request conceals a request for symbolic handling
> of simple algebraic numbers.
>

Well, rational numbers.  Although an algebraic number type would be
interesting.  And, the way I see it, Fraction is the type corresponding to
the field of rational numbers.


>
> --
> best regards
>
> Jonathan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180830/cf06e4ba/attachment.html>


More information about the Python-ideas mailing list