
I'm announcing the release of the new exact-pi package. It provides a type that exactly represents all rational multiples of integer powers of pi. Because it's closed under multiplication and taking of reciprocals, it's useful for computing exact conversion factors between physical units. In order to provide full Num and Floating instances there is also a representation for approximate values. I'm not sure if this will be of use to anyone else, but it is nice and self-contained so I thought I would put it out there. -Doug McClean

Why is this hard-coded to pi? Is there a particular reason it cannot be
used for any irrational number?
On Thu, Apr 9, 2015 at 12:36 PM, Douglas McClean
I'm announcing the release of the new exact-pi package.
It provides a type that exactly represents all rational multiples of integer powers of pi. Because it's closed under multiplication and taking of reciprocals, it's useful for computing exact conversion factors between physical units. In order to provide full Num and Floating instances there is also a representation for approximate values.
I'm not sure if this will be of use to anyone else, but it is nice and self-contained so I thought I would put it out there.
-Doug McClean
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

You could definitely use the same approach for any one irrational number
you were interested in. With a tuple of integers you could track a handful
of irrationals. If you need more than that you would probably be better
served by something like the cyclotomic package.
The reason it is hard-coded to pi is twofold. First, that's the one I need
to track, because it appears in conversion factors between units of angle.
Second, because pi appears in the Floating instance, which makes it
notationally more convenient to have the type specialized for pi.
If you have a use case for the extra generality, I could see an approach
where its parametrized by a Symbol. It would still be convenient to have
the Floating instance specialized for the type that tracks pi, but that
would be achievable.
On Thu, Apr 9, 2015 at 7:50 PM, Andrew Gibiansky wrote: Why is this hard-coded to pi? Is there a particular reason it cannot be
used for any irrational number? On Thu, Apr 9, 2015 at 12:36 PM, Douglas McClean <
douglas.mcclean@gmail.com> wrote: I'm announcing the release of the new exact-pi package. It provides a type that exactly represents all rational multiples of
integer powers of pi. Because it's closed under multiplication and taking
of reciprocals, it's useful for computing exact conversion factors between
physical units. In order to provide full Num and Floating instances there
is also a representation for approximate values. I'm not sure if this will be of use to anyone else, but it is nice and
self-contained so I thought I would put it out there. -Doug McClean _______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe --
J. Douglas McClean
(781) 561-5540 (cell)

About exact manipulation of PI and its powers... Le 10/04/2015 02:04, Douglas McClean a écrit :
You could definitely use the same approach for any one irrational number you were interested in. With a tuple of integers you could track a handful of irrationals.
There are many differences between "just" *irrational* and *transcendental* numbers. The work with algebraic / transcendental extensions is a bit different. No polynomial of PI with rational coefficients will vanish. If you replace PI by sqrt(2), well, you know the answer. Jerzy Karczmarczuk
participants (3)
-
Andrew Gibiansky
-
Douglas McClean
-
Jerzy Karczmarczuk