Repository: sympy/sympy

Issue:
Wrong Probability for Exponential Distribution
```
import sympy.stats as stats
X = stats.Exponential('x',3)
a = stats.P(X > x)
b = stats.P(X < x)
```

`a` yields (correctly): `exp(-3x)` but `b` gives `oo - exp(-3x)` instead of the CDF `1 - exp(-3x)`.

I am working on:
- Python 3.4.3
- SymPy 0.7.6.1


Discussion:

Patch:
diff --git a/sympy/stats/crv.py b/sympy/stats/crv.py
index 4bae1d936e..834edf87e2 100644
--- a/sympy/stats/crv.py
+++ b/sympy/stats/crv.py
@@ -446,7 +446,7 @@ def probability(self, condition, **kwargs):
             expr = condition.lhs - condition.rhs
             dens = density(expr, **kwargs)
             if not isinstance(dens, ContinuousDistribution):
-                dens = ContinuousDistributionHandmade(dens)
+                dens = ContinuousDistributionHandmade(dens, set=self.domain.set)
             # Turn problem into univariate case
             space = SingleContinuousPSpace(z, dens)
             result = space.probability(condition.__class__(space.value, 0))


Test patch:
diff --git a/sympy/stats/tests/test_continuous_rv.py b/sympy/stats/tests/test_continuous_rv.py
index c5fbb85f74..4e14e744bc 100644
--- a/sympy/stats/tests/test_continuous_rv.py
+++ b/sympy/stats/tests/test_continuous_rv.py
@@ -586,7 +586,10 @@ def test_exponential():
     assert quantile(X)(p) == -log(1-p)/rate
 
     assert where(X <= 1).set == Interval(0, 1)
-
+    #Test issue 9970
+    z = Dummy('z')
+    assert P(X > z) == exp(-z*rate)
+    assert P(X < z) == 0
 
 def test_exponential_power():
     mu = Symbol('mu')