error with NIntegrate and RegionPlot
This is a bug in RegionPlot
. For a possible workaround, try the following undocumented option
RegionPlot[NIntegrate[PDF[NormalDistribution[0, 1], a], {a, 0, y}] >= 0.2,
{x, -1, 1}, {y, 0.1, 0.7}, "NumericalFunction" -> False]
EDIT : Changed for your edited question
$Version
(* "10.2.0 for Mac OS X x86 (64-bit) (July 7, 2015)" *)
Define a helper function that is defined only for numeric arguments
f[y_?NumericQ] :=
NIntegrate[
PDF[NormalDistribution[0, 1], a],
{a, 0, y}];
rgn = ImplicitRegion[
f[y] >= 0.2 && -1 <= x <= 1 && 0.1 <= y <= 0.7,
{x, y}];
However, this is very sloo...oow
RegionPlot[rgn, PlotRange -> {{-1, 1}, {0.1, 0.7}}] //
AbsoluteTiming // Column
ContourPlot
is much, much faster
f[0.62] >= 0.2
(* True *)
ContourPlot[f[y],
{x, -1, 1}, {y, 0.1, 0.7},
Contours -> {0.2},
Epilog -> Text["f[y] \[GreaterEqual] 0.2", {0, 0.62}]] //
AbsoluteTiming // Column
The largest that your integral can be is for y = 0.7
dist = NormalDistribution[0, 1];
Integrate[PDF[dist, a], {a, 0, 0.7}]
(* 0.258036 *)
This is equivalent to
CDF[dist, 0.7] - CDF[dist, 0]
(* 0.258036 *)
Even if you were to integrate from -Infinity
, the largest that the integral could be is
Integrate[PDF[dist, a], {a, -Infinity, 0.7}]
(* 0.758036 *)
or equivalently,
CDF[dist, 0.7] - CDF[dist, -Infinity]
(* 0.758036 *)
or more simply
CDF[dist, 0.7]
(* 0.758036 *)
Consequently, since you are looking for the region for which the integral is greater than or equal to 0.95
, your region is empty. Note the use of Integrate
rather than NIntegrate
RegionPlot[
Integrate[PDF[NormalDistribution[0, 1], a], {a, 0, y}] >= 0.95, {x, -1,
1}, {y, 0.1, 0.7}]
If you reverse the inequality then
RegionPlot[
Integrate[PDF[dist, a], {a, 0, y}] < 0.95, {x, -1, 1}, {y, 0.1, 0.7}]
Or the same result with
RegionPlot[CDF[dist, y] - CDF[dist, 0] < 0.95, {x, -1, 1}, {y, 0.1, 0.7}]
Try this small variation over your original request
RegionPlot[
Integrate[PDF[NormalDistribution[0, 1], a], {a, 0, x}] > 0.3 //
Evaluate, {x, -10, 10}, {y, -1, 1}]