How can I set infinity as an element of a matrix in python(numpy)?
<p>This is the program</p>

<pre><code>import numpy as n
m = complex('inf')
z=n.empty([2,2] , dtype = complex)
z=n.array(input() , dtype = complex )
</code></pre>

<p>but in the console when i give 'm' as an input i get the following error massage:
'NameError: name 'm' is not defined'</p>

<p>Infinity in python can be typed as:</p>

<p>float('inf') / float('-inf')</p>

<p>or simply as a number</p>

<p>1e500 (+inf)</p>

<p>-1e500 (-inf)</p>

python numpy user-input infinity