I’m trying to find out what is going on inside the core math functions of python, trig functions like cos, sin, tan and all those. Anyone know where they are? I have been searching all over my python lib with no luck. I want to know what makes them tick, for example when cos takes in it’s argument I want to see what it’s doing to return the number. I haven’t been able to find this info with any other languages either.
They’re probably in a compiled *.pyd module. More than likely you’d have to download the Python source code to see their logic.
well it seems you have to get set up as a developer and hook into the repository, or I’m just not smart enough to find it. Either way, I hit up Ruby to see if they had something and sure enough they have the code right on the website here : Module: Math (Ruby 1.9.3)
EDIT*: Never mind, the ruby doc just shows examples too :(:
http://python.org/ftp/python/3.2.2/Python-3.2.2.tgz
The source is available from the python.org download site. Alternatively you can look at PyPy whgich probably has the same functions but in pure python.