3

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.

Sjoerd C. de Vries
  • 16,122
  • 3
  • 42
  • 94
Jagra
  • 3,149
  • 1
  • 18
  • 19

1 Answers1

10

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

Daniel Lichtblau
  • 6,854
  • 1
  • 23
  • 30
  • Thank you. Interesting (at least on my machine) that the FindRoot usage runs much faster than Solve. – Jagra Feb 03 '11 at 18:30
  • 1
    FindRoot is a local root-finder. Solve will find ALL roots in the specified region given by the inequality, and moreover find them in an "exact" form. Since I gave input that was approximate, it then numericizes that to get the final result. (The exact result is correct for a rationalized form of the input). Anyway, since Solve is using global and exact methods, it is no surprise that FindRoot is faster. But FindRoot, being a set of numerical methods, can fail in situations where there actually is a root. – Daniel Lichtblau Feb 03 '11 at 19:17