[SciPy-user] possible to get INF in divide by zero ?
Fri Aug 29 12:36:13 CDT 2008
thank you all for the explanations.
I'm a practical engineer, who almost never divide by zero.
But the question came from my son,
familiar with python and a little with scipy.
After his first lesson in MatLab, he said:
Oh what a beautiful environment is MatLab, it's even capable to divide
by zero without errors.
So for the moment probably MatLab is better suited for educational purposes.
I'll ask him again to compare scipy and Matlab, after a few weeks ;-)
Pauli Virtanen wrote:
> Thu, 28 Aug 2008 09:56:36 +0200, Stef Mientki wrote:
>> another observation:
>> >>> a=numpy.array([2,3])
>> >>> a/0
>> array([0, 0])
> Division in Numpy preserves the data types: in this case you have an
> integer array divided by an integer, so the output is also an integer.
> But Inf is not one of integers so something must be substituted; and it
> is zero. There probably was some reason for this choice...
> If you change your seterr configuration frmo divide='ignore' you should
> get a warning, see
More information about the SciPy-user