# Integral over sphere

#### Matthiasf

##### New member
Hi,

I've been looking the whole day to solve this problem and I cannot find a solution.

I have the general equation of a sphere:

I have also a function that gives a value for every point in the 3D space: f(x,y,z). This function describes amount of light falling in at a point / m2.

Now I want to know what is the total amount of light on the sphere. So I have to sum the function over the total area of the sphere. I would think this is an integral of the form int(f(x,y,z) * ds1 *ds2) with ds1 and ds2 some perpendicular vectors in the tangent plane to the sphere in the point x,y,z.

How can I calculate this? I believe I should write ds1 and ds2 in function of x and y and then sum somehow.

Much thanks to the people willing to help me.

Matthias

#### Jomo

##### Elite Member
Well your first problem is that you do not have the general equation of a sphere. Please fix that.

Why would you code your problem by not giving us the definition of f(x,y,z)???

#### topsquark

##### Full Member
I have the general equation of a sphere:

I have also a function that gives a value for every point in the 3D space: f(x,y,z). This function describes amount of light falling in at a point / m2.
To be a bit more direct, your equation is for an ellipsoid, not a sphere. The equation for a sphere is centered on the origin ia $$\displaystyle x^2 + y^2 + z^2 = r^2$$

I agree with Jomo... What is f(x, y, z)?

Since you are only dealing with the surface of the sphere you don't need to worry about r changing, so the differential surface element on the sphere will have dimensions $$\displaystyle (r ~ sin( \theta ) ~ d \theta )*( r ~ d \phi )$$. Then integrate over the surface.

-Dan

Hi,