# Solving Line Integral

1. Feb 21, 2008

### integrator

Hello!

I am working on atmospheric scattering and therefore I have to calculate the optical depth along a given path through the atmosphere.

The integral I have to solve is this one:
$$\int_{P_a}^{P_b} f ds \quad with \quad f:R\rightarrow R, h\rightarrow e^{(-h/H_0)}$$

$$P_a$$ und $$P_b$$ are Points in $$R^3$$ and I have to solve the integral along the path from $$P_a$$ to $$P_b$$. $$H_0$$ is just a constant and h is the height of a point between the line from $$P_a$$ to $$P_b$$ .
So obviously this is a line integral (at least I hope so), which can be solved this way:

$$\int_{P_a}^{P_b} f ds \quad = \quad \int_{a}^{b} f(r(t)) * |r'(t)| dt$$

r is the parameterization of the path, so my r is:
r: [a,b] $$\rightarrow R^3$$.
r(t) (t is in [a,b]) gives me a point on the path from $$P_a$$ to $$P_b$$, with r(a) = $$P_a$$ and r(b) = $$P_b$$.
Now I have the problem that the result of r doesnt fit to the input of f, because f needs a height and not a point in $$R^3$$ .
Therefore I slightly change f (and now call it f2):
$$f2:R^3 \rightarrow R, P \rightarrow e^{(-HeightOf(P)/H_0)}$$

f2 expects a point in $$R^3$$ and calculates the height of the point P itself.

Now I just need the parameterization r of the path. Two solutions came into my mind:
1) $$r: [0,1] \rightarrow R^3, t \rightarrow P_a + t * (P_b - P_a) \quad with \quad r'(t) = LengthFromPaToPb = Length$$
2) $$r: [0, N] \rightarrow R^3, t \rightarrow P_a + t * (P_b - P_a) / N \quad with \quad r'(t) = LengthFromPaToPb / N = sampleLength$$

If I pick parameterization 1) I end with this formula:

$$\int_{P_a}^{P_b} f ds \quad = \quad \int_{0}^{1} f2(r(t)) * |r'(t)| dt \quad = \quad \int_{0}^{1} f2(r(t)) * Length dt \quad = \quad Length * \int_{0}^{1} f2(r(t)) dt$$

I numerically solve this integral with the trapezium rule.
My problem is, that the solutions I get with the trapezium rule are really big (up to 14000). Maybe its because the length of my paths between Pa and Pb are long (about 80000meters) and thus my Length is also very big.

I cant believe that values around 14000 are right (I have read in a paper, that the optical depth at the horizon is about 6).
So Im asking you: did I make something wrong?

2. Feb 22, 2008

### Pere Callahan

The method you used looks about right. I didnt check the details.

You can do some rough calculations to check whether your result should rather be 6 or 14 000.

You write the distance between your two points is 80 000 and you choose a linear path for the integration.

What is your value for H_0 and and at what heights are your starting and end point? Does the height of a point depend on the coordinates of the point in an easy way (for example just the z-coordinate) or does it involve complicated formulae to account for the curvature of the atmosphere (or whatever)?

3. Feb 24, 2008

### integrator

This is my coordinate system: http://www.infoboard.org/screenshots/system.png [Broken]
P_a can be any point on the vertical gray line and P_b can be any of the orange points on the outer radius (atmosphere).
The inner circle is the earth and has an radius of 6 000 000 meters and the outer radius is the atmosphere and has an radius of 6 080 000 meters (so my atmosphere has a height of 80 000m)

My paramterization r gives me a point on the line between P_a and P_b.
My function f2 is e^(-HeightOf(P) / H_0) and HeightOf(P) is basically just this:
|P| - innerRadius (the length of the vector P minus the radius of the earth).
My H_0 is 20000m.

Do you see any errors in this?

Last edited by a moderator: May 3, 2017