Inverse Problems: Exercicestarantola/Files/Professional/Teaching/Princeton/... · Individual...

18
Individual Sections of the Book Inverse Problems: Exercices With mathematica, matlab, and scilab solutions Albert Tarantola 1 Université de Paris, Institut de Physique du Globe 4, place Jussieu; 75005 Paris; France E-mail: [email protected] March 12, 2007 1 © A. Tarantola, 2006. Students and professors are invited to freely use this text.

Transcript of Inverse Problems: Exercicestarantola/Files/Professional/Teaching/Princeton/... · Individual...

Individual Sections of the Book

Inverse Problems: Exercices

With mathematica, matlab, and scilab solutions

Albert Tarantola1

Université de Paris, Institut de Physique du Globe4, place Jussieu; 75005 Paris; France

E-mail: [email protected]

March 12, 2007

1© A. Tarantola, 2006. Students and professors are invited to freely use this text.

38 Explicit use of Probability Densities

2.4 Epicentral Coordinates of a Seismic Event

2.4.1 Problem

At the scale we work, the Earth can be assumed to be flat, and Cartesian coordinates canbe used. To simplify the example, we forget the detpth coordinate, so we consider a two-dimensional Earth.

A seismic source was activated at time T = 0 in an unknown location at the surface ofEarth. The seismic waves produced by the explosion have been recorded at a network of sixseismic stations whose coordinates in a rectangular system are

(x1, y1) = (3 km , 15 km) , (x2, y2) = (3 km , 16 km) ,

(x3, y3) = (4 km , 15 km) , (x4, y4) = (4 km , 16 km) ,

(x5, y5) = (5 km , 15 km) , (x6, y6) = (5 km , 16 km) .

(2.34)

From the seismograms in figure 2.1 we pick the following arrival times for the seismic wavesat these stations:

t1obs = 3.12 s± σ , t2

obs = 3.26 s± σ ,

t3obs = 2.98 s± σ , t4

obs = 3.12 s± σ ,

t5obs = 2.84 s± σ , t6

obs = 2.98 s± σ ,

(2.35)

where σ = 0.10 s , the symbol ±σ being a short notation indicating that experimental un-certainties are independent and can be modeled using a Gaussian probability density with astandard deviation equal to σ .

Estimate the epicentral coordinates (X, Y) of the explosion, assuming a velocity of v =5 km/s for the seismic waves.

Discuss the generalization of the problem to the case where the time of the explosion, thelocations of the seismic observatories, or the velocity of the seismic waves are not perfectlyknown.

2.4.2 Solution

Executable notebook at

http://www.ipgp.jussieu.fr/~tarantola/exercices/chapter_02/EpicenterMathematica.nb

The model parameters are the coordinates of the epicenter of the explosion,

m = (X, Y) , (2.36)

and the observable parameters are the arrival times at the seismic network,

d = (t1, t2, t3, t4, t5, t6) , (2.37)

while the coordinates of the seismic stations and the velocity of the seismic waves are as-sumed perfectly known (i.e., known with uncertainties that are negligible with respect to theuncertainties in the observed arrival times).

2.4 Epicentral Coordinates of a Seismic Event 39

0.5 1 1.5 2 2.5 3 3.5 4 1.5 5-0.5

0.5

1

0.5 1 1.5 2 2.5 3 3.5 4 1.5 5-0.5

0.5

1

0.5 1 1.5 2 2.5 3 3.5 4 1.5 5-0.5

0.5

1

0.5 1 1.5 2 2.5 3 3.5 4 1.5 5-0.5

0.5

1

0.5 1 1.5 2 2.5 3 3.5 4 1.5 5-0.5

0.5

1

0.5 1 1.5 2 2.5 3 3.5 4 1.5 5-0.5

0.5

1

Figure 2.1: The seismograms observed at the six stations. From them, we can obtain the(secondary) observations listed in equation 2.35.

40 Explicit use of Probability Densities

For a given (X, Y) , the arrival times of the seismic wave at the seismic stations can becomputed using the (exact) equation

tical(X, Y) = gi(X, Y) =

1V

√(xi − X)2 + (yi −Y)2 (i = 1, . . . , 6) , (2.38)

which solves the forward problem d = g(m) .As we are not given any a priori information on the epicentral coordinates, we take a

uniform a priori probability density, i.e., because we are using Cartesian coordinates,

ρM(X, Y) = const. , (2.39)

assigning equal a priori probabilities to equal volumes.As data uncertainties are Gaussian and independent, the probability density representing

the information we have on the true values of the arrival times is

ρD(t1, t2, t3, t4, t5, t6) = const. exp(− 1

2

6

∑i=1

(ti − tiobs)

2

σ2

). (2.40)

With the three pieces of information in equations 2.38–2.40, we can directly pass to theresolution of the inverse problem. The posterior probability density in the model space,combining the three pieces of information, is obtained using the general formula σM(m) =k ρM(m) ρD( g(m) ) , i.e., particularizing the notation to the present problem,

σM(X, Y) = k ρM(X, Y) ρD( g(X, Y) ) , (2.41)

where k is a normalization constant. Explicitly, using equations 2.38–2.40,

σM(X, Y) = k′ exp

(− 1

2 σ2

6

∑i=1

(tical(X, Y)− ti

obs)2

), (2.42)

where k′ is a new normalization constant and where the functions tical(X, Y) are those ex-

pressed in equation 2.38.The probability density σM(X, Y) describes all the a posteriori information we have on

the epicentral coordinates. As we only have two parameters, the simplest (and most general)way of studying this information is to plot the values of σM(X, Y) directly in the region ofthe plane where it takes significant values. Figure 2.2 shows the result obtained in this way(using the computer code given below).

We see that the zone of nonvanishing probability density is crescent-shaped. This can beinterpreted as follows. The arrival times of the seismic wave at the seismic network (top leftof the figure) are of the order of 3 s , and as we know that the explosion took place at timeT = 0 , and the velocity of the seismic wave is 5 km/s , this gives the reliable informationthat the explosion took place at a distance of approximately 15 km from the seismic network.But as the observational uncertainties (±0.1 s) in the arrival times are of the order of thetravel times of the seismic wave between the stations, the azimuth of the epicenter is notwell resolved. As the distance is well determined but not the azimuth, it is natural to obtaina probability density with a crescent shape.

2.4 Epicentral Coordinates of a Seismic Event 41

Figure 2.2: Probability density for the epicentral co-ordinates of the seismic event, obtained using as datathe arrival times of the seismic wave at six seismic sta-tions (points at the top of the figure). The gray scaleis linear, between zero and the maximum value of theprobability density. The crescent-shape of the regionof significant probability density cannot be describedusing a few numbers (mean values, variances, covari-ances,. . . ), as commonly done. This figure has beenobtained using the first of the two computer codesgiven below.

0 5 10 15 200

5

10

15

20

From the values shown in Figure 2.2 it is possible to obtain any estimator of the epicentralcoordinates one may wish, such as, for instance, the median, the mean, or the maximumlikelihood values. But the general solution of the inverse problem is the probability densityitself. Notice in particular that a computation of the covariance between X and Y will missthe circular aspect of the correlation.

Let’s see the code that produces these results. We may start by introducing the a prioriinformation on the epicentral coordinates (in fact, no information)

(* A priori information *)

rhoM[X_ ,Y_] := 1

We next move to the resolution of the forward problem, starting by introducing the coor-dinates of the seismic stations

(* Coordinates of the six seismic stations *)

x1 = 3 ; x2 = 3 ; x3 = 4 ; x4 = 4 ; x5 = 5 ; x6 = 5 ;

y1 = 15 ; y2 = 16 ; y3 = 15 ; y4 = 16 ; y5 = 15 ; y6 = 16 ;

and writing the travel-time computations (equations 2.38 )

(* Computing travel times *)

v = 5 ;

t1cal[X_,Y_] := Sqrt[(X-x1)^2 + (Y - y1)^2] / v ;

t2cal[X_,Y_] := Sqrt[(X-x2)^2 + (Y - y2)^2] / v ;

t3cal[X_,Y_] := Sqrt[(X-x3)^2 + (Y - y3)^2] / v ;

t4cal[X_,Y_] := Sqrt[(X-x4)^2 + (Y - y4)^2] / v ;

t5cal[X_,Y_] := Sqrt[(X-x5)^2 + (Y - y5)^2] / v ;

t6cal[X_,Y_] := Sqrt[(X-x6)^2 + (Y - y6)^2] / v ;

The observations and uncertainties are

(* Observations and uncertainties *)

sigma = 0.1 ;

t1obs = 3.12 ; t2obs = 3.26 ; t3obs = 2.98 ;

t4obs = 3.12 ; t5obs = 2.84 ; t6obs = 2.98 ;

and we choose here the Gaussian model for the uncertainties

42 Explicit use of Probability Densities

(* Uncertainties modeled using a Gaussian distribution *)

rhoD[t1_ , t2_ , t3_ , t4_ , t5_ , t6_] := Exp [ -(1/2) (

(t1-t1obs)^2/ sigma ^2 + (t2 -t2obs)^2/ sigma^2 + (t3 -t3obs)^2/ sigma^2 +

(t4-t4obs)^2/ sigma ^2 + (t5 -t5obs)^2/ sigma^2 + (t6 -t6obs)^2/ sigma^2 )]

It only remains to define the posterior pdf

(* Likelihood function and posterior probability density *)

L[X_,Y_] := rhoD[t1cal[X,Y],t2cal[X,Y],t3cal[X,Y],t4cal[X,Y],

t5cal[X,Y],t6cal[X,Y]]

sigmaM[X_ ,Y_] := rhoM[X,Y] L[X,Y]

Figure 2.2 is obtained by just plotting the function σM(X, Y) so defined.The student is invited to visit the original notebook, where some complements are given

(big error in one datum, changing the Gaussian model by the more robust Laplacian model,introducing a priori information). Note: sometime in the future these examples will also beexplained here. For the time being, please have a look at figures 2.3 and 2.4 and 2.5

Figure 2.3: Same as figure 2.2, excepted that a big er-ror has been introduced in one arrival time. Becausethe Gaussian assumption is used, the result is verysensitive to big errors (even if there is a small numberof them). Compare this with figure 2.4.

0 5 10 15 20 25 30 350

5

10

15

20

25

30

35

Figure 2.4: Same as figure 2.2, excepted that a bigerror has been introduced in one arrival time. Be-cause the Exponential assumption is used, the resultis not sensitive to a small number of big errors, andthis probability distribution is almost identical to thatin figure 2.2: the exponential model of uncertaintiesgives robust results.

0 5 10 15 200

5

10

15

20

2.4 Epicentral Coordinates of a Seismic Event 43

Figure 2.5: Result obtained when introducing the apriori information that the epicenter is in a “verticalfault” located at x = 10 km± 1 km . For the time be-ing, please see the mathematica notebook for the de-tails.

0 5 10 15 200

5

10

15

20

2.4.3 Solution (Time Unknown)

Executable notebook at

http://www.ipgp.jussieu.fr/~tarantola/exercices/chapter_02/EpicenterVelocityMathematica.nb

If the time of the explosion was not known, or the coordinates of the seismic stations werenot perfectly known, or if the velocity of the seismic waves were only known approximately,the model vector would contain all these parameters:

m = (X, Y, T, x1, y1, . . . , x6, y6, V) . (2.43)

After properly introducing the a priori information on T (if any), on (xi, yi) , and on V , theposterior probability density σM(X, Y, T, x1, y1, . . . , x6, y6, V) should be defined as before,from which the marginal probability density on the epicentral coordinates (X, Y) could beobtained as

σX,Y(X, Y) =∫ ∞

−∞dT∫ ∞

−∞dx1 · · ·

∫ ∞

−∞dy6

∫ ∞

0dV σM(X, Y, T, x1, y1, . . . , x6, y6, V) (2.44)

the posterior probability density on the velocity V of the medium as

σV(V) =∫ ∞

−∞dX

∫ ∞

−∞dY∫ ∞

−∞dT∫ ∞

−∞dx1 · · ·

∫ ∞

−∞dy6 σM(X, Y, T, x1, y1, . . . , x6, y6, V) . (2.45)

and the posterior probability density on the time T of the explosion as

σT(T) =∫ ∞

−∞dX

∫ ∞

−∞dY∫ ∞

−∞dx1 · · ·

∫ ∞

−∞dy6

∫ ∞

0dV σM(X, Y, T, x1, y1, . . . , x6, y6, V) . (2.46)

As an example, let us continue to assume the the origin time is exactly known, as are thecoordinates of the stations, but that the velocity V is poorly known. To avoid unnecessarycomplications, let us not use as variable the velocity V that is a Jeffreys quantity, but, rather,the logarithmic velocity v ,

v = log(V/V0) ; V = V0 exp v . (2.47)

44 Explicit use of Probability Densities

Here, we can arbitrarily take V0 = 1 km/s . Equation 2.38 is now written making apparentthe new variable, the logarithmic velocity v :

tical(X, Y, v) = gi(X, Y, v) =

√(xi − X)2 + (yi −Y)2

V0 exp v. (2.48)

which solves the forward problem d = g(m) . Again, we are not given any a priori informa-tion on the epicentral coordinates, but let us assume that the a priori information we have onthe logarithmic velocity can be represented by a Gaussian probability density,

ρM(X, Y, v) = const. exp(− 1

2(v− v0)2

s2

), (2.49)

with v0 = 1.6 and s = 0.3 (this probability density is represented at the top of figure 2.7).For the representation of the observations, we keep equation 2.40 as it is. The posteriorprobability density in the model space is now

σM(X, Y, v) = k′ exp

(− 1

2 σ2

6

∑i=1

(tical(X, Y, v)− ti

obs)2

), (2.50)

where the functions tical(X, Y, v) are those expressed in equation 2.48. Figure 2.6 displays

the marginal probability density

σX,Y(X, Y) =∫ ∞

−∞dv σM(X, Y, v) . (2.51)

Comparing this with figure 2.2 we see that the poor knowledge of the velocity has consider-ably degraded the information we have on the epicentral coordinates. Figure 2.7 displays, atthe bottom, the marginal probability density

σv(v) =∫ ∞

−∞dX

∫ ∞

−∞dYσM(X, Y, v) . (2.52)

We see that our knowledge on the velocity of the medium has ameliorated.Note: I have not yet had time to clean up the code, and to comment it. For the time being,

here is a crude reproduction of the present state of the code:

v0 = 1.6 ; s = 0.3 ;

priorv[v_] := Exp[-(v - v0)^2/(2s^2)]

vmin = -0.5 ; vmax = 3.5 ;

priorXY[X_ , Y_] := 1

rhoM[X_ , Y_, v_] := priorXY[X, Y] priorv[v]

Xmin = -0.5 ; Xmax = 20.5 ; Ymin = -0.5 ; Ymax = 20.5 ;

x1 = 3; x2 = 3; x3 = 4; x4 = 4; x5 = 5; x6 = 5;

y1 = 15; y2 = 16; y3 = 15; y4 = 16; y5 = 15; y6 = 16;

2.4 Epicentral Coordinates of a Seismic Event 45

Figure 2.6: Same af figure 2.2, but, this time, thevelocity of propagation of waves is poorly known.This marginal probability density is obtained fromthe posterior probability density σM(X, Y, v) by in-tegration of the variable v . This figure has been ob-tained using the second of the two computer codesgiven below.

0 5 10 15 20

0

5

10

15

20

Figure 2.7: At the top, the a priori information intro-duced on the logarithmic velocity v . At the bottom,the a posteriori information, obtained from the pos-terior probability density σM(X, Y, v) by integrationof the variables X and Y . This figure has been ob-tained using the second of the two computer codesgiven below.

v

v

0 1 2 3

0 1 2 3

0

0

1

1

V =

1 k

m/s

V =

2 k

m/s

V =

5 k

m/s

V =

10

km/s

V =

20

km/s

V =

1 k

m/s

V =

2 k

m/s

V =

5 k

m/s

V =

10

km/s

V =

20

km/s

46 Explicit use of Probability Densities

(* Computing travel times *)

t1cal[X_, Y_ , v_] := Sqrt[(X - x1)^2 + (Y - y1)^2]/ Exp[v];

t2cal[X_, Y_ , v_] := Sqrt[(X - x2)^2 + (Y - y2)^2]/ Exp[v];

t3cal[X_, Y_ , v_] := Sqrt[(X - x3)^2 + (Y - y3)^2]/ Exp[v];

t4cal[X_, Y_ , v_] := Sqrt[(X - x4)^2 + (Y - y4)^2]/ Exp[v];

t5cal[X_, Y_ , v_] := Sqrt[(X - x5)^2 + (Y - y5)^2]/ Exp[v];

t6cal[X_, Y_ , v_] := Sqrt[(X - x6)^2 + (Y - y6)^2]/ Exp[v];

sigma = 0.1;

t1obs = 3.12; t2obs = 3.26; t3obs = 2.98;

t4obs = 3.12; t5obs = 2.84; t6obs = 2.98;

(* Uncertainties modeled using a Gaussian distribution *)

rhoD[t1_ , t2_ , t3_ , t4_ , t5_ , t6_] := Exp [ -(1/2)((t1 - t1obs)^2/ sigma

^2 + (

t2 - t2obs)^2/ sigma ^2 + (t3 -

t3obs)^2/ sigma ^2 + (t4 - t4obs)^2/ sigma^2 + (

t5 - t5obs)^2/ sigma ^2 + (t6 - t6obs)^2/ sigma ^2)]

L[X_, Y_ , v_] := rhoD[t1cal[X, Y,

v], t2cal[X, Y, v], t3cal[X, Y, v], t4cal[X, Y, v], t5cal[X, Y, v],

t6cal[

X, Y, v]]

sigmaM[X_ , Y_, v_] := rhoM[X, Y, v] L[X, Y, v]

MarginalForEpicenter[X_ , Y_] := NIntegrate[sigmaM[X, Y, v], {v, vmin ,

vmax}]

ContourPlot[-MarginalForEpicenter[X, Y], {X, Xmin , Xmax}, {Y, Ymin , \

Ymax}, PlotRange -> All , PlotPoints -> 100, Contours -> 5];

MarginalForLogVelocity[v_] := NIntegrate[sigmaM[X, Y, v], {X, Xmin ,

Xmax}, \

{Y, Ymin , Ymax}]

Plot[MarginalForLogVelocity[v], {v, vmin , vmax}, PlotRange -> All ,

Frame -> \

True , Axes -> False ,

GridLines -> {{Log[1], Log[2], Log[5], Log[10], Log [20]}, {0}}]

2.4 Epicentral Coordinates of a Seismic Event 47

2.4.4 Solution (With Two Diffractors)

Executable notebook at

http://www.ipgp.jussieu.fr/~tarantola/exercices/chapter_02/EpicenterMathematicaDiffractors.nb

In this section, we consider the problem of estimation of the epicentral coordinates, asconsidered above, but now the six stations receive not only the direct arrival from the epi-center to the station but also the two echoes coming from two diffractors (see figure 2.8)1.

Figure 2.8: Same problem as above, butnow the six stations receive not only thedirect arrival from the epicenter to thestation but also the two echoes comingfrom two diffractors.

0 5 10 15 200

5

10

15

20

Figure 2.9 displays the six seismograms received at the six stations. The arrival of thediffracted waves is clearly visible. The position of the two diffractors, (xa, ya) , (xb, yb) isknown, but, depending on the position of the epicenter, the first diffracted signal may befrom the diffractor a or from the diffractor b . This adds a considerable complication, thatcould be addressed by introducing ad-hoc techniques, but that we address here using a pos-sibility offered by the general theory: using multimodal probability densities to represent thedata uncertainty.

Provisional note for Rob: the method that the students are using at this point of mylessons is the general probabilistic method. There is a set M = {m1, m2, . . . , mp} of p modelparameters, and some probability density

fprior(M) ≡ fprior(m1, m2, . . . , mp) (2.53)

representing the possible a priori information. Then, there is a set O = {o1, o2, . . . , oq} of qobservable parameters, that we can model, using a physical theory, as

O = ϕ(M) , (2.54)

i.e., as o1 = ϕ1(m1, m2, . . . , mp) , o2 = ϕ2(m1, m2, . . . , mp) , etc. Third, and finally, there arethe observations of the observable parameters, that produce a probability density

hobs(O) ≡ hobs(o1, o2, . . . , oq) . (2.55)1Problem suggested by Rob W. Clayton.

48 Explicit use of Probability Densities

1 2 3 4 5-1

1234

1 2 3 4 5-1

1234

1 2 3 4 5-1

1234

1 2 3 4 5-1

1234

1 2 3 4 5-1

1234

1 2 3 4 5-1

1234

Figure 2.9: The seismograms received by the each of the six stations. In each of the seismo-grams, we can visually identify the direct arrival (always the first) and the two secondaryarrivals from each of the diffractors.

2.4 Epicentral Coordinates of a Seismic Event 49

The “combination” of these three pieces of information produces the probability density

fpost(M) =1ν

fprior(M) L(M) , (2.56)

where L(M) is the “likelihood function”

L(M) = hobs( ϕ(M) ) , (2.57)

and where ν is a normalization constant2.Here, our model parameters are the coordinates of the epicenter,

M = {m1, m2} = {X, Y} (2.58)

(in this simple exercise, the origin time of the signal is assumed known, and equal to zero),and our observable parameters are the 18 eighteen arrival times (three arrival times at eachof the six stations)

O = {o1, o2, . . . , o18} = {t1, ta1, tb1, t2, ta2, tb2, t3, ta3, tb3, t4, ta4, tb4, t5, ta5, tb5, t6, ta6, tb6}(2.59)

We assume no a priori information on the location of the epicenter. As we use Cartesiancoordinates, this corresponds to choosing a constant probability density fprior(X, Y) :

(* A priori information *)

fprior[X_ ,Y_] := 1

We now pass to the establishment of the forward modeling relation O = ϕ(M) . Themodeling of the arrival times is done as follows. One first enters the coordinates of the sixstations and of the two diffractors,

(* Coordinates of the six seismic stations and the two diffractors *)

x[1]= 3.; x[2]= 3.; x[3]= 4.; x[4]= 4.; x[5]= 5.; x[6]= 5.;

y[1]=15.; y[2]=16.; y[3]=15.; y[4]=16.; y[5]=15.; y[6]=16.;

xa=5.; ya=5.; xb=15.; yb=10.;

and then uses the Pythagoras theorem to predict the arrival time to each of the six stations(resolution of the forward problem):

(* Computing travel times *)

v = 5;

tcal[i_ ,X_ ,Y_] := Sqrt[(X-x[i])^2 + (Y-y[i])^2]/v;

tacal[i_,X_,Y_] := Sqrt[(X-xa)^2 + (Y-ya)^2]/v

+ Sqrt[(xa -x[i])^2 + (ya -y[i])^2]/v;

tbcal[i_,X_,Y_] := Sqrt[(X-xb)^2 + (Y-yb)^2]/v

+ Sqrt[(xb -x[i])^2 + (yb -y[i])^2]/v;

The first two steps of the formulation of an inverse problem, the introduction of theprior probability density fprior(M) and the definition of the forward modeling relation O =ϕ(M) , is now done. We must pass to the (probabilistic) description of the observations.

Figures 2.10–2.15 show the result of the visual “picking” of the three arrival times in eachseismogram. As we don’t know which of the secondary arrivals comes from diffractor a orfrom diffractor b , these two probability densities are bimodal (and identical).

50 Explicit use of Probability Densities

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor a

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor b

0 1 2 3 4 502468

10

probability density for the arrival time of direct wave

Figure 2.10: For the first station (first seismogram in figure 2.9), the probability density for thetime of the first arival (top), the probability density for the time of the arrival from diffractora (middle), and the probability density for the time of the arrival from diffractor b (bottom).As we don’t know which of the secondary arrivals comes from diffractor a or from diffractorb , these two probability densities are bimodal (and identical).

Figure 2.11: Same as fig-ure 2.10, but the second sta-tion (second seismogram infigure 2.9). 0 1 2 3 4 5

02468

10

probability density for the arrival time from diffractor a

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor b

0 1 2 3 4 502468

10

probability density for the arrival time of direct wave

2.4 Epicentral Coordinates of a Seismic Event 51

Figure 2.12: Same as above,for the third station.

0 1 2 3 4 502468

10

probability density for the arrival time of direct wave

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor a

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor b

Figure 2.13: Same as above,for the fourth station.

0 1 2 3 4 502468

10

probability density for the arrival time of direct wave

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor a

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor b

52 Explicit use of Probability Densities

Figure 2.14: Same as above,for the fifth station.

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor b

0 1 2 3 4 502468

10

probability density for the arrival time of direct wave

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor a

Figure 2.15: Same as above,for the sixth station.

0 1 2 3 4 502468

10

probability density for the arrival time of direct wave

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor a

0 1 2 3 4 502468

10

probability density for the arrival time from diffractor b

2.4 Epicentral Coordinates of a Seismic Event 53

To define the individual probability densities in the figures 2.10–2.15, after defining a boxfunction3 centered at t0 , with range s ,

(* Box function centered at t0 , with range s *)

box[t_ ,t0_ ,s_] := (UnitStep[t-(t0 -s/2)] UnitStep[-t+(t0+s/2)])/s

we can —picking the arrival times observed in figure 2.9— define the three probability den-sity functions for the first seismogram

arrival1 = 3.12; arrival2 = 3.60; arrival3 = 4.04;

uncert1 = 0.1; uncert2 = 0.2; uncert3 = 0.2;

pdf[1,t_] = box[t,arrival1 ,uncert1 ];

pdfa[1,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

pdfb[1,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

for the second seismogram

arrival1 = 3.26; arrival2 = 3.68; arrival3 = 4.24;

uncert1 = 0.1; uncert2 = 0.2; uncert3 = 0.2;

pdf[2,t_] = box[t,arrival1 ,uncert1 ];

pdfa[2,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

pdfb[2,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

for the third seismogram

arrival1 = 2.97; arrival2 = 3.42; arrival3 = 4.01;

uncert1 = 0.1; uncert2 = 0.2; uncert3 = 0.2;

pdf[3,t_] = box[t,arrival1 ,uncert1 ];

pdfa[3,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

pdfb[3,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

for the fourth seismogram

arrival1 = 3.11; arrival2 = 3.51; arrival3 = 4.21;

uncert1 = 0.1; uncert2 = 0.2; uncert3 = 0.2;

pdf[4,t_] = box[t,arrival1 ,uncert1 ];

pdfa[4,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

pdfb[4,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

for the fifth seismogram

arrival1 = 2.83; arrival2 = 3.24; arrival3 = 4.00;

uncert1 = 0.1; uncert2 = 0.2; uncert3 = 0.2;

pdf[5,t_] = box[t,arrival1 ,uncert1 ];

pdfa[5,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

pdfb[5,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

and, finally, for the sixth seismogram

arrival1 = 2.97; arrival2 = 3.33; arrival3 = 4.20;

uncert1 = 0.1; uncert2 = 0.2; uncert3 = 0.2;

2One has ν =∫

dm fprior(m) L(m) .3Here, the function UnitStep[t] is the function equal to zero for t negative and equal to one for t zero or

positive.

54 Explicit use of Probability Densities

pdf[6,t_] = box[t,arrival1 ,uncert1 ];

pdfa[6,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

pdfb[6,t_] = (box[t,arrival2 ,uncert2] + box[t,arrival3 ,uncert3 ])/2;

The probability density in the data space hobs(O) , is the product of these individual prob-ability density, if we assume the all the uncertainties are independent (note: I have to givehere an example where these uncertainties would not be independent). Therefore, the prob-ability density in the data space is

(* The pdf in the data space *)

hobs[t1_ ,ta1_ ,tb1_ ,t2_ ,ta2_ ,tb2_ ,t3_ ,ta3_ ,tb3_ ,t4_ ,ta4_ ,tb4_ ,

t5_ ,ta5_ ,tb5_ ,t6_ ,ta6_ ,tb6_] :=

pdf[1,t1] pdfa[1,ta1] pdfb[1,tb1] pdf[2,t2] pdfa[2,ta2] pdfb[2,tb2]

pdf[3,t3] pdfa[3,ta3] pdfb[3,tb3] pdf[4,t4] pdfa[4,ta4] pdfb[4,tb4]

pdf[5,t5] pdfa[5,ta5] pdfb[5,tb5] pdf[6,t6] pdfa[6,ta6] pdfb[6,tb6]

The likelihood function (expressed in equation 2.57) is, then,

(* Likelihood function and posterior probability density *)

L[X_,Y_] := hobs[ tcal[1,X,Y], tacal[1,X,Y], tbcal[1,X,Y],

tcal[2,X,Y], tacal[2,X,Y], tbcal[2,X,Y],

tcal[3,X,Y], tacal[3,X,Y], tbcal[3,X,Y],

tcal[4,X,Y], tacal[4,X,Y], tbcal[4,X,Y],

tcal[5,X,Y], tacal[5,X,Y], tbcal[5,X,Y],

tcal[6,X,Y], tacal[6,X,Y], tbcal[6,X,Y] ]

Finally, the (unnormalized) posterior probability density (expressed in equation 2.56) is

(* Posterior probability density *)

fpost[X_,Y_] := fprior[X,Y] L[X,Y]

Plotting this probability density produces the result in figure 2.16.

0 5 10 15 200

5

10

15

20

14.2 15.7

5.8

4.3

Figure 2.16: The probability density for the epicentral position. When comparing this prob-ability density to that in figure 2.2, we see the dramatic improvement caused in the locationof the epicenter by the existence of the two diffractors. In fact, with the two diffractors, wecould have limited ourselves to using only one of the six seismic stations!