Ask Your Question

fho's profile - activity

2021-02-03 15:27:29 +0200 received badge  Student (source)
2015-09-02 02:33:05 +0200 commented question Can I define a function over many "external" constants?

@nbruin: yep I tried that. And that actually brought me a step closer to the solution. Basically I could extrapolate the real integral from several different ns ;)

2015-08-31 23:41:09 +0200 commented question Can I define a function over many "external" constants?

That's a shame :(

2015-08-31 19:30:59 +0200 received badge  Editor (source)
2015-08-31 18:30:17 +0200 asked a question Can I define a function over many "external" constants?

Basically I have a function that needs to access "external" but constant values. For example, simplified:

image description

The as are constant but I don't know n beforehand. My goal is to use SAGE to calculate the integral and derivative of a larger function. I know that there is a symbolic sum function, but I am not sure if it is possible to use the index to refer to something undefined and "external" to the function.

By now I have stumbled over the function ... function which I misuse to serve my purpose (can I link a sagecloud notebook here?):

%var x, y, z, i, n
ai = function('ai')
xi = function('xi')
yi = function('yi')
zi = function('zi')

gauss(a,x,y,z) = a * e^(-(x^2+y^2+z^2)/2)
f(x,y,z) = (sum(  gauss(ai(i),x-xi(i), y-yi(i), z-zi(i))  ,i,1,n))^2

integral(integral(integral(f,x),y),z)

Which results in:

(x, y, z) |--> integrate(integrate(integrate(sum(ai(i)*e^(-1/2*x^2 - 1/2*y^2 - 1/2*z^2 + x*xi(i) - 1/2*xi(i)^2 + y*yi(i) - 1/2*yi(i)^2 + z*zi(i) - 1/2*zi(i)^2), i, 1, n)^2, x), y), z)

Does this mean SAGE is not able to integrate this symbolically?