Etienne Rivard | 29 May 16:21

Using functions from the math or numpy modules

Dear Fipy users,

After considering many possible solutions for my problem, I am now back 
to FiPy. I could find almost every tool I need in FiPy, but there is at 
least one problem remaining.

The manual of FiPy says that functions such as "exp", etc. are available 
from "fipy.tools.numerix", I've tried that and as the attached script 
shows, it works perfectly. However, if "exp" is taken from the "math" or 
the "numpy" module, FiPy gives an error.

That's a problem for me because I want to use functions such as 
"scipy.integrate.quadrature" and "scipy.special.gamma" in my PDEs.

I noticed, for example, that the output of "math.exp" is a "float" 
object and the output of "fipy.tools.numerix.exp" is a "numpy.float64" 
object. I tried converting so that my function returns this type of 
object, but I haven't had much success with that method.

Is there anything I missed?

Many thanks,

Etienne Rivard

Btw., fans of matlab's pdepe solver should recognize the example in the 
script.

(Continue reading)

Jonathan Guyer | 29 May 21:32

Re: Using functions from the math or numpy modules


On May 29, 2008, at 10:22 AM, Etienne Rivard wrote:

> After considering many possible solutions for my problem, I am now  
> back to FiPy.

We win!

> I could find almost every tool I need in FiPy,

Great to know.

> but there is at least one problem remaining.

Quelle dommage!

> The manual of FiPy says that functions such as "exp", etc. are  
> available from "fipy.tools.numerix", I've tried that and as the  
> attached script shows, it works perfectly. However, if "exp" is  
> taken from the "math" or the "numpy" module, FiPy gives an error.

Correct. That's what we mean by "Warning: Generally, things will not  
work as expected if the equivalent function is used from the Numeric  
library." (although we need to update that warning to reflect that we  
use NumPy now).

Clearly more explanation of *why* is in order, though.

The "math" module provides a rudimentary set of functions to operate  
on *single* (floating point) numbers. Everything about FiPy is  
(Continue reading)


Gmane