[SciPy-User] maping a float to a function value

Peter Combs peter.combs@berkeley....
Wed Dec 9 16:03:02 CST 2009

Since you don't have a problem with modifying classes, what about overriding the list class so that it a) stores information about the bounds of your integral and the spacing of the points, and b) uses those to automatically convert from a value passed into __getitem__ to the nearest point for which it has data?

Peter Combs

On Dec 9, 2009, at 1:57 PM, nicky van foreest wrote:

>> The question is: why do you want to use floats as keys in a dictionary?
> One argument is that I like it conceptually.  The technical argument
> is as follows. I need the (numerical) solution of the  integral
> equation
> gamma(x) = c(x) + \int_0^\infty gamma(x-y) G(y) dy,
> for given functions c(x) and G(x). (There are some technical
> conditions on G and c such that I can prove that the integral equation
> has a solution.)  Now I like to store the values gamma(x) as keys of
> x, as it feels natural. Moreover, I need gamma in a second integral
> equation. Sure I can store gamma as an array, but then I have to
> convert the index i to the key x, and I dislike this, as it is less
> elegant, and requires extra code.
> I hope the above clarifies my point, but I am not quite sure...
> Nicky
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list