Find intersection of 2 curves & area under a curve to the right of the intersection w/ Mathematica

StackOverflow https://stackoverflow.com/questions/4889634

  •  28-10-2019
  •  | 
  •  

Question

I have 2 curves illustrated with the following Mathematica code:

Show[Plot[PDF[NormalDistribution[0.044, 0.040], x], {x, 0, 0.5}, PlotStyle -> Red],
 Plot[PDF[NormalDistribution[0.138, 0.097], x], {x, 0, 0.5}]]

Mathematica graphics

I need to do 2 things:

  1. Find the x and y coordinates where the two curves intersect and
  2. Find the area under the red curve to the right of the x coordinate in the above intersection.

I haven't done this kind of problem in Mathematica before and haven't found a way to do this in the documentation. Not certain what to search for.

Was it helpful?

Solution

Can find where they intersect with Solve (or could use FindRoot).

intersect = 
 x /. First[
   Solve[PDF[NormalDistribution[0.044, 0.040], x] == 
     PDF[NormalDistribution[0.138, 0.097], x] && 0 <= x <= 2, x]]

Out[4]= 0.0995521

Now take the CDF up to that point.

CDF[NormalDistribution[0.044, 0.040], intersect]

Out[5]= 0.917554

Was not sure if you wanted to begin at x=0 or -infinity; my version does the latter. If the former then just subtract off the CDF evaluated at x=0.

FindRoot usage would be

intersect = 
 x /. FindRoot[
   PDF[NormalDistribution[0.044, 0.040], x] == 
    PDF[NormalDistribution[0.138, 0.097], x], {x, 0, 2}]

Out[6]= 0.0995521

If you were working with something other than probability distributions you could integrate up to the intersection value. Using CDF is a useful shortcut since we had a PDF to integrate.

Daniel Lichtblau Wolfram Research

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top