-
-
Save gvitalie/5deec511abe94ddfaa20d188b450872c to your computer and use it in GitHub Desktop.
Fun
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 math | |
| >>> | |
| >>> def exp(x): | |
| ... a = 1 | |
| ... for i in range(1, 100): | |
| ... a += (x ** i) / math.factorial(i) | |
| ... return a | |
| ... | |
| >>> def ln(x): | |
| ... a = 0 | |
| ... for i in range(100): | |
| ... a += 2 * (x - exp(a)) / (x + exp(a)) | |
| ... return a | |
| ... | |
| >>> x = 3 | |
| >>> for i in range(3): | |
| ... x += math.sin(x) | |
| ... | |
| >>> x | |
| 3.141592653589793 | |
| >>> x/math.pi | |
| 1.0 | |
| >>> | |
| >>> exp(x * ln(x)) | |
| 36.46215960720795 | |
| >>> math.exp(math.pi * math.log(math.pi)) | |
| 36.4621596072079 | |
| >>> | |
| >>> exp(1/x * ln(x)) | |
| 1.4396194958475905 | |
| >>> math.exp(1/math.pi * math.log(math.pi)) | |
| 1.4396194958475907 | |
| >>> | |
| >>> # &• | |
| >>> | |
| me@amadeus:~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment