On Thu, Mar 26, 2009 at 6:45 PM, Gael Varoquaux
<[email protected]> wrote:
>
> Hey guys,
>
> We are sitting at a sprint, trying to use sympy to implement a clean way
> of generation of numpy vectors.
>
> What we want is to specify formulas for these vectors, and at the end of
> the day, we sample these formulas on a given set of values. It is
> important for us to seprate the specification from the sampling. All the
> rest (incuding the fact the sympy is able to compute closed form
> formulas or not) does not matters, as long as we can get numerical
> values.
>
> Where this fails is when we try to do some convolutions: I can't figure
> out a way of using lambdify with none evaluated integrals. I don't see
> why sympy shouldn't be abe to cal scipy.integrate to get numerical values
> for these integrals. We don't actually need to use lambdify: we are going
> to evaluate these functions on vector of length < 1000.
>
> What is the right strategy here? (I guess my e-mail is unclear, if I need
> to ask the question like this).
>
> A side question: subs is not working the way I thought it would on
> 'Integral' objects:
>
> In [1]: f = Lambda(x, exp(-x**2))
>
> In [2]: conv = Integral(f(x-y)*f(y), (y, -oo, oo))
>
> In [3]: conv
> Out[3]:
> ∞
> ⌠
> ⎮      2          2
> ⎮   - y  - (x - y)
> ⎮  ℯ                dy
> ⌡
> -∞
>
> In [4]: conv.subs({x:0})
> Out[4]:
> ∞
> ⌠
> ⎮      2          2
> ⎮   - y  - (x - y)
> ⎮  ℯ                dy
> ⌡
> -∞
>
> I would like 'Out[4]' to have x substituted :). I can see why it is hard
> (sympy is probably not tracking that the integration variable does not
> depend on x), but I'd still like it :).


This is now fixed in the latest sympy:

In [1]: f = Lambda(x, exp(-x**2))

In [2]: conv = Integral(f(x-y)*f(y), (y, -oo, oo))

In [3]: conv
Out[3]:
∞
⌠
⎮      2          2
⎮   - y  - (x - y)
⎮  ℯ                dy
⌡
-∞

In [4]: conv.subs({x:0})
Out[4]:
∞
⌠
⎮       2
⎮   -2⋅y
⎮  ℯ      dy
⌡
-∞



Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to