On Aug 8, 2008, at 1:05 PM, franck kalala wrote:
I am trying to solve the diffusive equation (u)_t=D(u)_xx with this
initial value
phi(x)=infinity for x>0 and ph(x)=1 for x>0
how do i set infinity value in PYTHON?, fipy?
The literal answer to your question is:
>>> from fipy import numerix
>>> numerix.inf
or
>>> from fipy import *
>>> inf
This value is defined in the underlying NumPy library, however you
should always use fipy.numerix, rather than numpy, when you are using
FiPy.
*** HOWEVER ***
1. This may not work on Windows. I believe that Windows does not
consistently or reliably support IEEE NaN and Inf values, at least
within Python.
2. Even if you manage to set this initial condition, it is guaranteed
not to do anything meaningful. FiPy is a numerical PDE solver. While
infinity has a precise mathematical definition, and a value with many
of the appropriate numerical properties is defined in IEEE numerics,
infinity is not generally a useful or meaningful value in a numerical
context. If it doesn't fail even sooner, FiPy will calculate an
infinite flux at x=0 as a result of this infinite gradient. The
resulting solution matrix will almost certainly be singular or
otherwise fail to solve.
In short, "inf" is a sign that your solution has gone astray, not
something you should be striving to represent.