Created
March 11, 2013 03:14
-
-
Save uniphil/5131660 to your computer and use it in GitHub Desktop.
just... don't do this.
This file contains 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
In [1]: class RaiseEWithCaret(object): | |
...: def __xor__(self, exponent): | |
...: from math import exp | |
...: return exp(exponent) | |
...: | |
In [2]: e = RaiseEWithCaret() | |
In [3]: e^1 | |
Out[3]: 2.718281828459045 | |
In [4]: decay = lambda k, t: e^(-k * t) | |
In [5]: [decay(0.25, t) for t in range(10)] | |
Out[5]: | |
[1.0, | |
0.7788007830714049, | |
0.6065306597126334, | |
0.4723665527410147, | |
0.36787944117144233, | |
0.2865047968601901, | |
0.22313016014842982, | |
0.17377394345044514, | |
0.1353352832366127, | |
0.10539922456186433] | |
In [6]: e^1 * 0 | |
Out[6]: 1.0 | |
In [7]: ummmmmmmm... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment