Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Benjamin Peterson
2011/11/16 Blaine frik...@gmail.com:
 Does anyone know of a pure python math library? I've been playing around
 with berp, which is a python3 to haskell translator and compiler, and it
 works great as long as you don't go crazy with C extensions. It's highly
 experimental but fun to play around with. The only thing that I really miss
 is being able to use the math module. I asked the maintainer if it is
 possible to map into haskell's math library, but in the mean time a pure
 python math library would fit nicely since it would be compiled along with
 the rest of the python.
 I'm looking for log, log10, ceil, and pow mostly for my personal needs.

Well, python has a math module too:

 import math
 math.log(23)
3.1354942159291497



-- 
Regards,
Benjamin
___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Blaine
I think that python's math module (which I use) is a compiled C extension,
right? I'm looking for pure python that berp can use.

Blaine


On Wed, Nov 16, 2011 at 12:25 PM, Benjamin Peterson benja...@python.orgwrote:

 2011/11/16 Blaine frik...@gmail.com:
  Does anyone know of a pure python math library? I've been playing around
  with berp, which is a python3 to haskell translator and compiler, and it
  works great as long as you don't go crazy with C extensions. It's highly
  experimental but fun to play around with. The only thing that I really
 miss
  is being able to use the math module. I asked the maintainer if it is
  possible to map into haskell's math library, but in the mean time a pure
  python math library would fit nicely since it would be compiled along
 with
  the rest of the python.
  I'm looking for log, log10, ceil, and pow mostly for my personal needs.

 Well, python has a math module too:

  import math
  math.log(23)
 3.1354942159291497



 --
 Regards,
 Benjamin

___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Benjamin Peterson
2011/11/16 Blaine frik...@gmail.com:
 I think that python's math module (which I use) is a compiled C extension,
 right? I'm looking for pure python that berp can use.

I'm not really sure why this is relevant to pypy.



-- 
Regards,
Benjamin
___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Blaine
Thanks Alex and Benjamin.
  I'm sorry - you're right it isn't exactly related to pypy. I hope I
didn't break any rules. I was hoping that someone else may have come across
this because the only time I've needed to port compiled modules to python
is when I wanted to use them with pypy.

Blaine


On Wed, Nov 16, 2011 at 12:29 PM, Alex Gaynor alex.gay...@gmail.com wrote:



 On Wed, Nov 16, 2011 at 12:26 PM, Blaine frik...@gmail.com wrote:

 I think that python's math module (which I use) is a compiled C
 extension, right? I'm looking for pure python that berp can use.

 Blaine



 On Wed, Nov 16, 2011 at 12:25 PM, Benjamin Peterson 
 benja...@python.orgwrote:

 2011/11/16 Blaine frik...@gmail.com:
  Does anyone know of a pure python math library? I've been playing
 around
  with berp, which is a python3 to haskell translator and compiler, and
 it
  works great as long as you don't go crazy with C extensions. It's
 highly
  experimental but fun to play around with. The only thing that I really
 miss
  is being able to use the math module. I asked the maintainer if it is
  possible to map into haskell's math library, but in the mean time a
 pure
  python math library would fit nicely since it would be compiled along
 with
  the rest of the python.
  I'm looking for log, log10, ceil, and pow mostly for my personal needs.

 Well, python has a math module too:

  import math
  math.log(23)
 3.1354942159291497



 --
 Regards,
 Benjamin



 ___
 pypy-dev mailing list
 pypy-dev@python.org
 http://mail.python.org/mailman/listinfo/pypy-dev


 It's a part of the standard library, it's implemented however the Python
 VM provides it.

 Alex

 --
 I disapprove of what you say, but I will defend to the death your right
 to say it. -- Evelyn Beatrice Hall (summarizing Voltaire)
 The people's good is the highest law. -- Cicero


___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Alex Gaynor
On Wed, Nov 16, 2011 at 12:26 PM, Blaine frik...@gmail.com wrote:

 I think that python's math module (which I use) is a compiled C extension,
 right? I'm looking for pure python that berp can use.

 Blaine



 On Wed, Nov 16, 2011 at 12:25 PM, Benjamin Peterson 
 benja...@python.orgwrote:

 2011/11/16 Blaine frik...@gmail.com:
  Does anyone know of a pure python math library? I've been playing around
  with berp, which is a python3 to haskell translator and compiler, and it
  works great as long as you don't go crazy with C extensions. It's highly
  experimental but fun to play around with. The only thing that I really
 miss
  is being able to use the math module. I asked the maintainer if it is
  possible to map into haskell's math library, but in the mean time a pure
  python math library would fit nicely since it would be compiled along
 with
  the rest of the python.
  I'm looking for log, log10, ceil, and pow mostly for my personal needs.

 Well, python has a math module too:

  import math
  math.log(23)
 3.1354942159291497



 --
 Regards,
 Benjamin



 ___
 pypy-dev mailing list
 pypy-dev@python.org
 http://mail.python.org/mailman/listinfo/pypy-dev


It's a part of the standard library, it's implemented however the Python VM
provides it.

Alex

-- 
I disapprove of what you say, but I will defend to the death your right to
say it. -- Evelyn Beatrice Hall (summarizing Voltaire)
The people's good is the highest law. -- Cicero
___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Benjamin Peterson
2011/11/16 Blaine frik...@gmail.com:
 Thanks Alex and Benjamin.
   I'm sorry - you're right it isn't exactly related to pypy. I hope I didn't
 break any rules. I was hoping that someone else may have come across this
 because the only time I've needed to port compiled modules to python is when
 I wanted to use them with pypy.
 Blaine

I don't PyPy will be very helpful to you, since it uses the libc math functions.



-- 
Regards,
Benjamin
___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Alex Gaynor
On Wed, Nov 16, 2011 at 12:38 PM, Blaine frik...@gmail.com wrote:

 I imagine pypy uses libc math through ctypes, since pypy and ctypes play
 well together.

 Thanks for all the tips, I'll probably just wait to see what the
 maintainer thinks about mapping to haskell's math library.
 Blaine



 On Wed, Nov 16, 2011 at 12:36 PM, Benjamin Peterson 
 benja...@python.orgwrote:

 2011/11/16 Blaine frik...@gmail.com:
  Thanks Alex and Benjamin.
I'm sorry - you're right it isn't exactly related to pypy. I hope I
 didn't
  break any rules. I was hoping that someone else may have come across
 this
  because the only time I've needed to port compiled modules to python is
 when
  I wanted to use them with pypy.
  Blaine

 I don't PyPy will be very helpful to you, since it uses the libc math
 functions.



 --
 Regards,
 Benjamin



No, PyPy has an RPython math module which calls libc.

Alex

-- 
I disapprove of what you say, but I will defend to the death your right to
say it. -- Evelyn Beatrice Hall (summarizing Voltaire)
The people's good is the highest law. -- Cicero
___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Blaine
Oh, neat. I didn't know that. Thank you for the information, I didn't know
that was possible.

Blaine


On Wed, Nov 16, 2011 at 12:40 PM, Alex Gaynor alex.gay...@gmail.com wrote:



 On Wed, Nov 16, 2011 at 12:38 PM, Blaine frik...@gmail.com wrote:

 I imagine pypy uses libc math through ctypes, since pypy and ctypes play
 well together.

 Thanks for all the tips, I'll probably just wait to see what the
 maintainer thinks about mapping to haskell's math library.
 Blaine



 On Wed, Nov 16, 2011 at 12:36 PM, Benjamin Peterson 
 benja...@python.orgwrote:

 2011/11/16 Blaine frik...@gmail.com:
  Thanks Alex and Benjamin.
I'm sorry - you're right it isn't exactly related to pypy. I hope I
 didn't
  break any rules. I was hoping that someone else may have come across
 this
  because the only time I've needed to port compiled modules to python
 is when
  I wanted to use them with pypy.
  Blaine

 I don't PyPy will be very helpful to you, since it uses the libc math
 functions.



 --
 Regards,
 Benjamin



 No, PyPy has an RPython math module which calls libc.

 Alex

 --
 I disapprove of what you say, but I will defend to the death your right
 to say it. -- Evelyn Beatrice Hall (summarizing Voltaire)
 The people's good is the highest law. -- Cicero


___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Charlie Hui
http://en.literateprograms.org/Logarithm_Function_(Python)

ceil seems pretty easy to implement...
pow? Integer only?

--C



From: Blaine frik...@gmail.com
To: pypy-dev@python.org
Sent: Wednesday, November 16, 2011 9:21 AM
Subject: [pypy-dev] Pure Python Math Library


Does anyone know of a pure python math library? I've been playing around with 
berp, which is a python3 to haskell translator and compiler, and it works great 
as long as you don't go crazy with C extensions. It's highly experimental but 
fun to play around with. The only thing that I really miss is being able to use 
the math module. I asked the maintainer if it is possible to map into haskell's 
math library, but in the mean time a pure python math library would fit nicely 
since it would be compiled along with the rest of the python.

I'm looking for log, log10, ceil, and pow mostly for my personal needs.

It's funny now that things like pypy and berp exist. I find myself trying to 
locate pure python routines (like DFT) that would have no reason to exist with 
cpython, but make lots of sense with pypy.

Anyway, just wondering if anyone had heard of such a thing. How do you even 
implement log?

Thanks,
Blaine

___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Re: [pypy-dev] Pure Python Math Library

2011-11-16 Thread Blaine
Thanks Charlie, that's really helpful!

Yeah ceil is easy. Pow can be done if log() and exp() are available, and
exp() shouldn't be too hard I think.
def pow(x,y):
return exp(y*log(x))

Blaine


On Wed, Nov 16, 2011 at 1:03 PM, Charlie Hui cj...@yahoo.com wrote:

 http://en.literateprograms.org/Logarithm_Function_(Python)
 ceil seems pretty easy to implement...
 pow? Integer only?

 --C

 --
 *From:* Blaine frik...@gmail.com
 *To:* pypy-dev@python.org
 *Sent:* Wednesday, November 16, 2011 9:21 AM
 *Subject:* [pypy-dev] Pure Python Math Library

 Does anyone know of a pure python math library? I've been playing around
 with berp https://github.com/bjpop/berp/wiki, which is a python3 to
 haskell translator and compiler, and it works great as long as you don't go
 crazy with C extensions. It's highly experimental but fun to play around
 with. The only thing that I really miss is being able to use the math
 module. I asked the maintainer if it is possible to map into haskell's math
 library, but in the mean time a pure python math library would fit nicely
 since it would be compiled along with the rest of the python.

 I'm looking for log, log10, ceil, and pow mostly for my personal needs.

 It's funny now that things like pypy and berp exist. I find myself trying
 to locate pure python routines (like DFT) that would have no reason to
 exist with cpython, but make lots of sense with pypy.

 Anyway, just wondering if anyone had heard of such a thing. How do you
 even implement log?

 Thanks,
 Blaine

 ___
 pypy-dev mailing list
 pypy-dev@python.org
 http://mail.python.org/mailman/listinfo/pypy-dev



___
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev