Thanks; I don't quite understand what's broken, but I think I have a workaround.

sage: normal(x,av,sd)=((1/(sd*sqrt(2*pi)))*exp(-(x-av)^2/(2*sd^2)))
sage: f(x,y)= x*y^3*normal(y,1,2)
sage: g = f.integrate(y,-2,2)
sage: g
(x, y) |--> 1/4*sqrt(2)*x*integrate(y^3*e^(-1/8*(y - 1)^2), y, -2, 2)/sqrt(pi)

(note that sage seems to think `g`

is a function of `x`

and `y`

, even though it shouldn't be)

sage: h(x) = f.integrate(y,-2,2)
sage: h
x |--> 1/4*sqrt(2)*x*integrate(y^3*e^(-1/8*(y - 1)^2), y, -2, 2)/sqrt(pi)

(this is looking better, but still doesn't work . . . the problem seems to be the `integrate`

command in the definition of `h`

)

sage: plot(h,0,5)
...
ValueError: free variable: y

(the first way I could think of to get Sage to evaluate the integral was to use the `numerical_approx`

method; maybe there's a better way, but this works :)

sage: k = lambda x: h(x).numerical_approx()
sage: plot(k,0,5)

(graph is shown!)

Note that, unfortunately, the following does not work:

```
k(x) = h(x).numerical_approx()
...
TypeError: cannot evaluate symbolic expression numerically
```

Unless someone knows better, I'm inclined to think this should be filed as a Trac ticket.

EDIT: after writing all this, I think the problem is the "symbolic expression" `integrate(...)`

. The following works as expected:

```
sage: k(x) = 1/4*sqrt(2)*x*(integrate(y^3*e^(-1/8*(y - 1)^2), y, -2,2).numerical_approx())/sqrt(pi)
sage: plot(k,0,5)
```

Is this a case of not declaring symbolic variables with var()?

ValueError is documented in python as an exception thrown when the domain of the passed argument doesn't match the function domain if I read the docs correctly.

I'd like to try to help, but I don't find `normal` as a builtin function. Do you import it, or have you defined it yourself? The error comes from Sage trying to use `fast_float` to evaluate your function and apparently finding two variables somehow. Maybe post your whole session?

See below.