Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Charles R Harris
On 2/21/07, Charles R Harris <[EMAIL PROTECTED]> wrote: On 2/21/07, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > > > On 2/21/07, Charles R Harris < [EMAIL PROTECTED]> wrote: > > > > > > > > On 2/21/07, Robert Kern < [EMAIL PROTECTED]> wrote: > > > > > > Christopher Barker wrote: > > > > Rob

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Charles R Harris
On 2/21/07, Timothy Hochberg <[EMAIL PROTECTED]> wrote: On 2/21/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > > On 2/21/07, Robert Kern < [EMAIL PROTECTED]> wrote: > > > > Christopher Barker wrote: > > > Robert Kern wrote: > > >> Christopher Barker wrote: > > >>> I wonder if there are

Re: [Numpy-discussion] Distributing prebuilt numpy and other extensions

2007-02-21 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, Zachary Pincus <[EMAIL PROTECTED]> wrote: > Hello folks, > > I've developed some command-line tools for biologists using python/ > numpy and some custom C and Fortran extensions, and I'm trying to > figure out how to easily distribute them... > > For people us

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Timothy Hochberg
On 2/21/07, Charles R Harris <[EMAIL PROTECTED]> wrote: On 2/21/07, Robert Kern <[EMAIL PROTECTED]> wrote: > > Christopher Barker wrote: > > Robert Kern wrote: > >> Christopher Barker wrote: > >>> I wonder if there are any C math libs that do a better job than > you'd > >>> expect from standar

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Charles R Harris
On 2/21/07, Robert Kern <[EMAIL PROTECTED]> wrote: Christopher Barker wrote: > Robert Kern wrote: >> Christopher Barker wrote: >>> I wonder if there are any C math libs that do a better job than you'd >>> expect from standard FP? (short of unlimited precision ones) >> With respect to π and the z

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Timothy Hochberg
If none of the suggested methods turn out to be efficient enough due to copying overhead, here's a way to reduce the copying overhead by trading memory (and a bit of complexity) for copying overhead. The general thrust is to allocate M extra slices of memory and then shift the data every M time sl

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Anne Archibald
On 21/02/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Well, you can always use long double if it is implemented on your platform. > You > will have to construct a value for π yourself, though. I'm afraid that we > don't > really make that easy. If the trig functions are implemented at all, you

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Anne Archibald
On 21/02/07, Alexander Michael <[EMAIL PROTECTED]> wrote: > On 2/21/07, Mike Ressler <[EMAIL PROTECTED]> wrote: > > Would loading your data via memmap, then slicing it, do your job > > (using numpy.memmap)? ... > > Interesting idea. I think Anne's suggestion that sliced assignment > will reduce to

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Robert Kern
Christopher Barker wrote: > Robert Kern wrote: >> Christopher Barker wrote: >>> I wonder if there are any C math libs that do a better job than you'd >>> expect from standard FP? (short of unlimited precision ones) >> With respect to π and the zeros of sin() and cos()? Not really. I'll back off o

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Timothy Hochberg
On 2/21/07, Christopher Barker <[EMAIL PROTECTED]> wrote: Anne Archibald wrote: > Or, to see more clearly, try taking (on a pocket calculator, say) > sin(3.14) (or even sin(pi)). This is an interesting point. I took a class from William Kahan once (pass/fail, thank god!), and one question he po

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Alexander Michael
On 2/21/07, Mike Ressler <[EMAIL PROTECTED]> wrote: > Would loading your data via memmap, then slicing it, do your job > (using numpy.memmap)? ... Interesting idea. I think Anne's suggestion that sliced assignment will reduce to an efficient memcpy fits my needs a bit better than memmap because I'

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread David Goldsmith
I grew up a TI guy - my recollection is that they stated in the user manual that though the display could show "only" 10 decimal digits, memory saved and computations used 16; perhaps nowadays it is even more, but unless you're doing millions of sequential calculations (how often do you do that

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Christopher Barker
Robert Kern wrote: > Christopher Barker wrote: >> I wonder if there are any C math libs that do a better job than you'd >> expect from standard FP? (short of unlimited precision ones) > > With respect to π and the zeros of sin() and cos()? Not really. If > numpy.sin(numpy.pi) were to give you 0.0

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread David Goldsmith
Robert Kern wrote: > Christopher Barker wrote: > >> I wonder if there are any C math libs that do a better job than you'd >> expect from standard FP? (short of unlimited precision ones) >> > > With respect to π and the zeros of sin() and cos()? Not really. If > numpy.sin(numpy.pi) were to

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Robert Kern
Christopher Barker wrote: > I wonder if there are any C math libs that do a better job than you'd > expect from standard FP? (short of unlimited precision ones) With respect to π and the zeros of sin() and cos()? Not really. If numpy.sin(numpy.pi) were to give you 0.0, it would be *wrong*. numpy.

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Travis Oliphant
Anne Archibald wrote: >Discontiguous blocks are somewhat inconvenient; one of the key >assumptions of numpy is that memory is stored in contiguous, >homogeneous blocks. > Not to add anything really useful to this discussion, but I should correct this wording before it gives incorrect conception

Re: [Numpy-discussion] installation documentation

2007-02-21 Thread Travis Oliphant
Toon Knapen wrote: >Hi all, > >Is there detailed info on the installation process available. > >I'm asking because in addition to installing numpy on linux-x86, I'm >also trying to install numpy on aix-power and windows-x86. So before >bombarding the ml with questions, I would like to get my han

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Christopher Barker
Anne Archibald wrote: > Or, to see more clearly, try taking (on a pocket calculator, say) > sin(3.14) (or even sin(pi)). This is an interesting point. I took a class from William Kahan once (pass/fail, thank god!), and one question he posed to us was: How many digits of pi is used in an HP calcu

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread David Goldsmith
Anne Archibald wrote: > On 21/02/07, Zachary Pincus <[EMAIL PROTECTED]> wrote: > > >> A corrolary: in general do not two floating-point values for equality >> -- use something like numpy.allclose. (Exception -- equality is >> expected if the exact sequence of operations to generate two numbers >

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Alexander Michael
On 2/21/07, Mike Ressler <[EMAIL PROTECTED]> wrote: > Would loading your data via memmap, then slicing it, do your job > (using numpy.memmap)? ... Interesting idea. I think Anne's suggestion that sliced assignment will reduce to an efficient memcpy fits my needs a bit better than memmap because I'

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread David Goldsmith
As far as a computer is concerned, those numbers are "around" zero - "growing-up" w/ Matlab, e.g., one quickly learns to recognize these numbers for what they are. One way to return zero for numbers like these is if numpy.allclose(x, 0): return 0 (or 0*x to assure that 0 is the same type as x

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Mike Ressler
On 2/21/07, Alexander Michael <[EMAIL PROTECTED]> wrote: > ... T is to large to fit in memory, so I need to > load up H, perform my calculations, pop the oldest N x P slice and > push the newest N x P slice into the data cube. What's the best way to > do this that will maintain fast computations al

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Zachary Pincus
It's true -- blindly using allclose isn't a lot better than blindly using equality testing. (Though given the choice between blindly using one and blindly using the other, I'd still probably vote for allclose... it won't get you quantum mechanics, but it'll do fine for a lot of other things

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread WolfgangZillig
Anne Archibald schrieb: > On 21/02/07, WolfgangZillig <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I'm quite new to numpy/scipy so please excuse if my problem is too obvious. >> >> example code: >> >> import numpy as n >> print n.sin(n.pi) >> print n.cos(n.pi/2.0) >> >> results in: >> 1.22460635382e-016

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Anne Archibald
On 21/02/07, Zachary Pincus <[EMAIL PROTECTED]> wrote: > A corrolary: in general do not two floating-point values for equality > -- use something like numpy.allclose. (Exception -- equality is > expected if the exact sequence of operations to generate two numbers > were identical.) I really can't

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Anne Archibald
On 21/02/07, WolfgangZillig <[EMAIL PROTECTED]> wrote: > Hi, > > I'm quite new to numpy/scipy so please excuse if my problem is too obvious. > > example code: > > import numpy as n > print n.sin(n.pi) > print n.cos(n.pi/2.0) > > results in: > 1.22460635382e-016 > 6.12303176911e-017 > > I've expecte

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Zachary Pincus
Your results are indeed around zero. >>> numpy.allclose(0, 1.22460635382e-016) True It's not exactly zero because floating point math is in general not exact. You'll need to check out a reference about doing floating point operations numerically for more details, but in general you should

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Robert Kern
WolfgangZillig wrote: > Hi, > > I'm quite new to numpy/scipy so please excuse if my problem is too obvious. > > example code: > > import numpy as n > print n.sin(n.pi) > print n.cos(n.pi/2.0) > > results in: > 1.22460635382e-016 > 6.12303176911e-017 > > I've expected something around 0. Can an

Re: [Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread Charles R Harris
On 2/21/07, WolfgangZillig <[EMAIL PROTECTED]> wrote: Hi, I'm quite new to numpy/scipy so please excuse if my problem is too obvious. example code: import numpy as n print n.sin(n.pi) print n.cos(n.pi/2.0) results in: 1.22460635382e-016 6.12303176911e-017 I've expected something around 0. C

Re: [Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Anne Archibald
On 21/02/07, Alexander Michael <[EMAIL PROTECTED]> wrote: > I'm new to numpy and looking for advice on setting up and managing > array data for my particular problem. I'm collecting observations of P > properties for N objects over a rolling horizon of H sample times. I > could conceptually store t

[Numpy-discussion] what goes wrong with cos(), sin()

2007-02-21 Thread WolfgangZillig
Hi, I'm quite new to numpy/scipy so please excuse if my problem is too obvious. example code: import numpy as n print n.sin(n.pi) print n.cos(n.pi/2.0) results in: 1.22460635382e-016 6.12303176911e-017 I've expected something around 0. Can anybody explain what I am doing wrong here?

Re: [Numpy-discussion] [Matplotlib-users] [matplotlib-devel] Unifying numpy, scipy, and matplotlib docstring formats

2007-02-21 Thread Chris Barker
There's probably a better forum for this conversation, but... Barry Wark wrote: > Perhaps we should consider two use cases: interactive use ala Matlab > and larger code bases. A couple key points -- yes, interactive use is different than larger code bases, but I think it's a "Bad Idea" to promit

Re: [Numpy-discussion] Greek Letters

2007-02-21 Thread Chris Barker
Andrew Straw wrote: > Here's one that seems like > it might work, but I haven't tried it yet: > http://software.jessies.org/terminator Now if only there was a decent terminal emulator for Windows that didn't use cygwin... -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Respons

[Numpy-discussion] Managing Rolling Data

2007-02-21 Thread Alexander Michael
I'm new to numpy and looking for advice on setting up and managing array data for my particular problem. I'm collecting observations of P properties for N objects over a rolling horizon of H sample times. I could conceptually store the data in three-dimensional array with shape (N,P,H) that would a

[Numpy-discussion] installation documentation

2007-02-21 Thread Toon Knapen
Hi all, Is there detailed info on the installation process available. I'm asking because in addition to installing numpy on linux-x86, I'm also trying to install numpy on aix-power and windows-x86. So before bombarding the ml with questions, I would like to get my hands on all doc available (I

Re: [Numpy-discussion] New release of pycdf package ported to NumPy

2007-02-21 Thread George Nurser
Hi Andre, I've downloaded bpycdf and it works very nicely with numpy; thanks very much for all your effort. One small problem; I'm probably being stupid, but I cannot see how to set a _Fillvalue as Float32. regards, George Nurser. On 12/02/07, Andre Gosselin <[EMAIL PROTECTED]> wrote: > A small