Part 1 Objective
To the following code, add your implementation of the algorithm listed above. Then, given the following coordinates and times of observed peak concentration,print the coordinates of the evil point source in the format(x,y)(including the parentheses) wherexandyare floats with three digits following the decimal.
Part 2 Objective
Create a plot with the components described in the following sentences.Plot the three points at which the measurements are taken and the location of the evil point source. Make each a unique color, and label each point on the plot. Finally, draw a black, solid line from each measurement point to the evil point source.
Take Home Assignment 2 ENGR 131 | Winter 2019 Use triangulation to locate a pollutant source In LAB 10.25, you developed functions for using three points and two distances to calculate the location of an unknown point. Now, let's suppose that the unknown point is actually a point source for some pollutant X, and at time 0 it releases a burst of X. Assume no wind, and that X diffuses freely from its release point. Suppose that we have measurement devices at the three points 1, 2, and 3 that track the concentration of X as a function of time, and that the concentration of X is detected to peak at times t1, t2, and t3, at each point, respectively. Can we determine the location of the evil point source? Let's make the assumption that the time intervals scale with the square of the distance divided by the diffusivity of X, t ∼ .i DX di 2 This means we can invoke some unknown constant K = that satisfies d = K , d = K , and d = K . Can we estimate K uniquely knowing this? √ DX 1 √ t1 2 √ t2 3 √ t3 Consider that if we choose a value for K , all three distances are set, and we get the two solutions points that correspond to that value of K . We can then measure the distance to point 3 for each solution point, and see if it matches K(t ) . What if it doesn't? Is there one unique value of K that works? 3 0.5 The answer is yes! Consider the following algorithm: �. Given times t1, t2, t3 and the points (x1,y1), (x2,y2), and (x3,y3); �. Guess K . �. Find the point (x,y) the correct distance from both (x1,y1) and (x2,y2) and closest to (x3,y3). �. Compute the apparent distance d’3 from (x,y) to (x3,y3). �. Compute z = .√ d3′ K√t3 �. If z is 1, stop; otherwise let K be K/z , and go to 3. The value of K this converges to, if squared, gives an estimate for the diffusivity D . X Part 1 Objective To the following code, add your implementation of the algorithm listed above. Then, given the following coordinates and times of observed peak concentration, print the coordinates of the evil point source in the format (x,y) (including the parentheses) where x and y are floats with three digits following the decimal. Coordinates �x,y� of observation Time of peak concentration �-���, ���� ��� �-���, -���� ��� ����, ���� ��� 1 import numpy as np 2 def a( d1, d2, x1, y1, x2, y2 ): 3 numerator=d1**2-d2**2 - ((x1**2+y1**2)-(x2**2+y2**2)) 4 denominator=2*(y2-y1) 5 return numerator/denominator 6 7 def b( x1, y1, x2, y2 ): 8 return -(x2-x1)/(y2-y1) 9 10 def solve_xy( x1, y1, x2, y2, d1, d2 ): 11 bb=b(x1,y1,x2,y2) 12 aa=a(d1,d2,x1,y1,x2,y2) 13 rad=4*(bb*(aa-y1)-x1)**2 - 4*(1+bb**2)*(x1**2-d1**2+(y1-aa)* *2) 14 pre=2*(x1-bb*(aa-y1)) 15 den=2*(1+bb**2) 16 xp=(pre+np.sqrt(rad))/den 17 xm=(pre-np.sqrt(rad))/den 18 yp=aa+xp*bb 19 ym=aa+xm*bb 20 return xm,ym,xp,yp When your result converges to a set of coordinates for the evil point source and a value for K, this seems to show that we can use triangulation to estimate diffusivity. Of course, there are major simplifying assumptions here, most notably no wind and a very rough scaling estimate linking time to distance. Nevertheless, knowing the location of a third detector and the time of peak concentration gives us a good estimate, and we can locate the evil point source. Part 2 Objective Create a plot with the components described in the following sentences. Plot the three points at which the measurements are taken and the location of the evil point source. Make each a unique color, and label each point on the plot. Finally, draw a black, solid line from each measurement point to the evil point source.