[Numpy-discussion] cos -- NameError: global name 'cos' is not defined

Wayne Watson sierra_mtnview@sbcglobal....
Mon Dec 21 11:40:36 CST 2009


In this code,
===========start
import math
import numpy as np
from numpy import matrix
def sinD(D): # given in degrees, convert to radians
    return sin(radians(D))
def cosD(D):
    return cos(radians(D))   <<--------------
def acosD(D):
    acos(radians(D)) 
    return=====end
the << line produces, "NameError: global name 'cos' is not defined", but 
the sin() above it does not? They are both built-in functions.


-- 
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet  
                
             "... humans'innate skills with numbers isn't much
              better than that of rats and dolphins." 
                       -- Stanislas Dehaene, neurosurgeon 
 
                    Web Page: <www.speckledwithstars.net/>



More information about the NumPy-Discussion mailing list