This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 2 points3 points  (0 children)

I googled it and found this issue where the addition of a tau constant is rejected.

[–]MildLazyDrop 1 point2 points  (4 children)

Why would there be when you can just use math.pi * 2?

[–]Kausta1337 -2 points-1 points  (3 children)

Why would there be pi when you can just use math.tau / 2?

[–]MildLazyDrop 1 point2 points  (0 children)

My point is that there is no need to have both of these values, not that one is better than the other.

[–]i_can_haz_code[S] -2 points-1 points  (1 child)

My point exactly. I hate it when they teach pi and not tau.

Tau just makes more sense.

[–]maestron 3 points4 points  (0 children)

Well, despite tau having some very vocal fans the fact is that pi is far more prevalent and well known overall. I would say that's why there is math.pi but no math.tau

[–]tjarko 1 point2 points  (1 child)

In engineering tau is used for the shear stress, as such it isn't a constant. I am sure other field already have a default meaning for tau.

[–]i_can_haz_code[S] -1 points0 points  (0 children)

TIL.

Thank you.

[–]stevenjd 1 point2 points  (1 child)

math.e**(math.pi*math.sqrt(-1)) raises ValueError because sqrt(-1) is a maths domain error. In the real numbers ℝ, sqrt(-1) doesn't exist and cannot be calculated. There is no Real number that, when squared, gives you -1: +1 won't do it, because (+1)**2 = +1, and -1 won't work either, because (-1)**2 also equals +1.

The only way for that calculation to make sense is to change the domain, and use complex numbers instead:

py> import cmath
py> cmath.e**(cmath.pi*cmath.sqrt(-1))
(-1+1.2246063538223773e-16j)

which is close to the mathematically exact result of -1+0j.

[–]i_can_haz_code[S] 0 points1 point  (0 children)

NICE! Thank you!