I am working on 1.4 part II homework, and am a little confused about how to handle the square and quadratic roots. I know there is a math.sqrt() function but is there an operator for the square root? And what can i do for the quadratic root besides take two square roots?
Oh i also realized i can take something to the 1/2 or .25 power, but am still curious if there is an explicit way of taking roots.
http://www.tutorialspoint.com/python/python_basic_operators.htm has a pretty nice list of built in python operators. There is no operator syntax for taking like what I think you are asking about, but exponentiation works just fine e.g. x**(0.5). I'm not sure how its implemented but if I had to guess math.sqrt() probably implements some sort of fast square root algorithm and might be faster than x**(0.5), but thats just my guess.
AFAIK (and that’s not much here), unless you import NumPy module, you’re stuck with `x**(0.5)`
alright, i just wanted to make sure i wasn't missing anything.
pow(x, y) x ** y
Join our real-time social learning platform and learn together with your friends!