Wrong formulas (#470)

The correct formulas for complex trigonometry require
cos(z) = (exp(iz) + exp(-iz)) / 2
sin(z) = (exp(iz) - exp(-iz)) / (2i)
This commit is contained in:
kushagra-1809 2026-03-18 12:28:23 +05:30 committed by GitHub
parent 984c0eefcc
commit 7614bdcc4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -134,10 +134,10 @@ def atan(z: complex):
return 1j / 2 * log((1 - 1j * z) / (1 + 1j * z)) return 1j / 2 * log((1 - 1j * z) / (1 + 1j * z))
def cos(z: complex): def cos(z: complex):
return (exp(z) + exp(-z)) / 2 return (exp(1j * z) + exp(-1j * z)) / 2
def sin(z: complex): def sin(z: complex):
return (exp(z) - exp(-z)) / (2 * 1j) return (exp(1j * z) - exp(-1j * z)) / (2 * 1j)
def tan(z: complex): def tan(z: complex):
return sin(z) / cos(z) return sin(z) / cos(z)