This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| me@amadeus:~$ python3 -q | |
| >>> | |
| >>> import cmath | |
| >>> | |
| >>> a = 3 | |
| >>> for i in range(3): | |
| ... a -= cmath.exp(a * 1j).imag/cmath.exp(a * 1j).real | |
| ... | |
| >>> | |
| >>> print(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| me@amadeus:~$ python3 -q | |
| >>> | |
| >>> import cmath | |
| >>> | |
| >>> a = 3 | |
| >>> for i in range(3): | |
| ... a += cmath.exp(a * 1j).imag | |
| ... | |
| >>> print(a) | |
| 3.141592653589793 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| def sin(x): | |
| a = 0 | |
| for i in range(30): | |
| a += ((-1) ** i) * (x ** (2*i+1)) / math.factorial(2*i+1) | |
| return a | |
| a = 3 | |
| for i in range(3): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| me@amadeus:~$ python3 -q | |
| >>> | |
| >>> from math import sin | |
| >>> | |
| >>> a = 3 | |
| >>> for i in range(3): | |
| ... a += sin(a) | |
| ... | |
| >>> print(a) | |
| 3.141592653589793 |