How can i use e and power operation in python 2.7
<p>How can i write <code>x.append(1-e^(-value1^2/2*value2^2))</code> in python 2.7?</p>

<p>I don't know how to use power operator and e.</p>

<p>Refer <a href="https://docs.python.org/2/library/math.html" rel="nofollow">math</a> library of python. <code>exp(x)</code> function this library is same as <code>e^x</code>. Hence you may write your code as:</p>

<p>I have modified the equation by replacing <code>1/2</code> as <code>0.5</code>. Else we have to explicitly type cast the division value to <code>float</code> because Python round of the result of division of two <code>int</code>. (for example: <code>1/2 -&gt; 0</code> in python) </p>

<pre><code>import math
x.append(1 - math.exp( -0.5 * (value1*value2)**2))
</code></pre>

python math equation exp