Re: X root Operator help

2007-04-18 Thread Michael Hoffman
[Michael Hoffman] >> For x root use y**(1/x) [Steve Holden] > >>> 3.14159 ** (1/3) > 1.0 > >>> > > So the cube root of pi is 1? I don't think so. > > For generic roots use y ** (1.0 / x) Yes, good point. :) -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: X root Operator help

2007-04-18 Thread Steve Holden
Michael Hoffman wrote: > lucidparadox wrote: >> I'm currently new to Python and I haven't been able to find the >> operator/math function to find the square root or even the x root of a >> number. > > For square root, use math.sqrt(y) > > For x root use y**(1/x) > [...] >>> 1/3 0 >>> 3.1415

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
[Michael Hoffman] >> In floating point arithmetic, the naive way of calculating both roots >> always using the formula (-b +/- sqrt(b**2 - 4*a*c))/2*a will give you >> inaccurate results sometimes. See >> . [lucidparadox] > Tha

Re: X root Operator help

2007-04-18 Thread lucidparadox
On Apr 18, 8:52 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > lucidparadox wrote: > > I'm currently new to Python and I haven't been able to find the > > operator/math function to find the square root or even the x root of a > > number. > > For square root, use math.sqrt(y) > > For x root use y*

Re: X root Operator help

2007-04-18 Thread Michael Hoffman
lucidparadox wrote: > I'm currently new to Python and I haven't been able to find the > operator/math function to find the square root or even the x root of a > number. For square root, use math.sqrt(y) For x root use y**(1/x) > I'm rewriting a program that I wrote in BASIC that does the > mat

Re: X root Operator help

2007-04-18 Thread Tim Golden
lucidparadox wrote: > I'm currently new to Python and I haven't been able to find the > operator/math function to find the square root or even the x root of a > number. Without ever having used it, I would guess it's the sqrt function in the math module. (Possibly also of interest: the pow func

X root Operator help

2007-04-18 Thread lucidparadox
I'm currently new to Python and I haven't been able to find the operator/math function to find the square root or even the x root of a number. I'm rewriting a program that I wrote in BASIC that does the math of a quadratic equation (user puts in a, b, and c values) and tells the user whether it ha