Newbie question - Advanced math functions available under Windows?

Brian Jones mojobojo at gmail.com
Fri Jul 2 18:42:04 EDT 2004


If you are working from the python shell, you will want to import the
math module first:

>>> import math

then call the functions like so:

>>> math.sqrt(10)
3.1622776601683795

Hope that helps,

-- Brian Jones

On Fri, 02 Jul 2004 18:31:58 -0400, The Toad <the.toad at trashcanistan.ca> wrote:
> 
> 
> I'm completely new to Python and just installed it on my Win 2000
> machine.  I was planning to use it for quick-and-dirty numerical
> programming.  The sort of thing people did in QuickBasic before DOS
> was replaced by Windows.
> 
> When I try to use numerical functions like sqrt() or sin(), I get
> error messages like
> 
> >>> x = sqrt(10)
> Traceback (most recent call last):
>   File "<pyshell#0>", line 1, in -toplevel-
>     x = sqrt(10)
> NameError: name 'sqrt' is not defined
> >>>
> 
> The math module documentation says that these math functions are "thin
> wrapers" around the platform C library funtions.  This seems to assume
> a Unix/Linux system platform.
> 
> Does this mean that math functions like sqrt(), etc. are not available
> in Python when running on Windows based systems?   Thanks in advance.
> 
> DB
> 
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>




More information about the Python-list mailing list