[SciPy-User] maping a float to a function value
nicky van foreest
Thu Dec 10 14:22:01 CST 2009
Thanks for your suggestions. I guess my reaction below is a bit too
off-topic for the rest of the community...
> I think you may be going about this the wrong way around.
Ok. I did not think of this point up to now, but you're right.
> integral equations is generally hard, so you should be thinking about
> the algorithm you will use. Whatever algorithm you choose will imply a
> representation of gamma(x), necessarily in some finite amount of
> space. I would worry less about how "natural" your representation is
> than about whether it suits how you want to solve the problem.
> In this particular case, gamma(x) can be written entirely in terms of
> c(x) and values of gamma(z) for z<x. So I imagine you will build gamma
> from left to right (hopefully you have some sort of "initial
> conditions" that allow this).
Interestingly, the function G against which I integrate gamma(x-y) has
some particular properties that I can take nearly any function as a
start for gamma. The function G is a probability density and the
factor lambda in front of the integral is smaller than 1, hence any
"history" at the left of some x becomes exponentially less important
(to put it heuristically).
> In any case, I think the representation you choose will depend heavily
> on the algorithm you plan to use. If you choose to use a
> representation in terms of pairs (x,gamma(x)), allow me to recommend
> using a pair of arrays, xi, gamma(xi), with the xi sorted. This is
> much more space-efficient than a dictionary and quite fast to search
> using searchsorted; in the very likely case that you are looking up an
> x value that is not already in the array, you have easy access to the
> neighbors if you want some form of interpolation.
This is also a good idea. However, for the moment it suffices to use a
fixed grid and compute gamma on this grid. I don't need intermediate
As a matter of fact, I just want to make a plot to show that it is
possible, in principle. to carry out some computations, the rest of
the paper is strictly mathematical, and nobody will worry about the
numerical stability of my implementation.
Anyway, thanks again.
> SciPy-User mailing list
More information about the SciPy-User