oste-popp
oste-popp

Reputation: 190

Python math module grad

I am trying to use the basic sin, cos, arctan, etc function from numpy, but I want to use gradians. I have search the doc without success, and search for other python modules without luck. Any suggestion on a python module i could use?

Or a function that will work. I have tried different methods to convert grad to rad and back to grad again, but no-one is working.

Upvotes: 1

Views: 1812

Answers (1)

farbiondriven
farbiondriven

Reputation: 2468

This one should be fine !

def gradFromRad(rad):
    return 200*rad/math.pi
def radFromGrad(grad):
    return math.pi*grad/200

Upvotes: 4

Related Questions