In [1]:
from sympy import *; init_session()
IPython console for SymPy 0.7.7.dev (Python 2.7.10-64-bit) (ground types: python)
These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
>>> init_printing()
Documentation can be found at http://docs.sympy.org/dev
In [2]:
from applpy import *
In [3]:
X = KSRV(6)
In [4]:
X
continuous cdf
for 0.0833333333333 <= x <= 0.166666666667
---------------------------
0
---------------------------
for 0.166666666667 <= x <= 0.25
---------------------------
9 8 7 6 5
3840.0⋅x - 21760.0⋅x + 45600.0⋅x - 46320.0⋅x + 26012.7777777778⋅x - 8714.
4 3 2
07407407408⋅x + 1767.89609053498⋅x - 433.818587105624⋅x + 126.39146090535⋅x
- 12.9783950617284
---------------------------
for 0.25 <= x <= 0.333333333333
---------------------------
9 8 7
- 2302.22222222222⋅x + 5768.14814814815⋅x + 4822.71604938272⋅x - 28005.5658
6 5 4 3
436214⋅x + 33604.3484224966⋅x - 16873.795081733⋅x + 2475.35358081847⋅x + 6
2
79.335854147615⋅x - 247.595075302926⋅x + 20.3407415742646
---------------------------
for 0.333333333333 <= x <= 0.416666666667
---------------------------
8 7 6
- 1.4210854715202e-14⋅x + 1.13686837721616e-13⋅x - 228.950617283951⋅x + 190
5 4 3
.956790123456⋅x + 933.400205761317⋅x - 1162.36021804984⋅x + 52.639112154206
2
5⋅x + 177.457758201875⋅x - 34.237467571953
---------------------------
for 0.416666666667 <= x <= 0.5
---------------------------
7 6 5
- 2.48689957516036e-14⋅x - 191.851851851852⋅x + 181.744084362139⋅x + 781.55
4 3 2
5051868999⋅x - 1101.35412499047⋅x + 317.78816527111⋅x + 72.6020357232447⋅x
- 33.6206213040494
---------------------------
for 0.5 <= x <= 0.666666666667
---------------------------
7 6 5
5.32907051820075e-15⋅x - 7.105427357601e-15⋅x + 10.247170781893⋅x - 22.0846
4 3 2
7292524⋅x + 32.7031952541534⋅x - 25.5003363864121⋅x + 48.6274421256605⋅x -
17.9828339566239
---------------------------
for 0.666666666667 <= x <= 0.833333333333
---------------------------
7 6 5
3.5527136788005e-15⋅x - 3.5527136788005e-15⋅x + 6.58796296296294⋅x - 14.762
4 3 2
7314814815⋅x + 20.0555126886146⋅x - 14.9952096193416⋅x - 7.68981481481482⋅x
+ 5.95717592592593
---------------------------
for 0.833333333333 <= x <= 1.0
---------------------------
6 5 4
1.06581410364015e-14⋅x + 6.24999999999997⋅x - 14.9074074074074⋅x + 20.01929
3 2
01234568⋅x - 14.9976851851852⋅x + 6.0⋅x - 1.25
---------------------------
Out[4]:
None
In [5]:
X.verifyPDF()
Now checking for area...
The area under f(x) is: 0.405716708565448
Now checking for absolute value...
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-c4ffe843dfc8> in <module>()
----> 1 X.verifyPDF()
/home/matt/anaconda/lib/python2.7/site-packages/applpy/rv.pyc in verifyPDF(self)
642 quant_list=[.1,.2,.3,.4,.5,.6,.7,.8,.9]
643 for i in range(len(quant_list)):
--> 644 val=self.variate(s=quant_list[i])[0]
645 val_list.append(val)
646 for i in range(len(val_list)):
/home/matt/anaconda/lib/python2.7/site-packages/applpy/rv.pyc in variate(self, n, s, sensitivity, method)
775 PDF(pdf,guess))).evalf()
776 except:
--> 777 if guess>self.support[len(self.support)-1]:
778 cfunc=cdf.func[len(self.func)-1].subs(x,guess)
779 pfunc=pdf.func[len(self.func)-1].subs(x,guess)
/home/matt/anaconda/lib/python2.7/site-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/core/expr.pyc in __gt__(self, other)
278 if (me.is_complex and me.is_real is False) or \
279 me.has(S.ComplexInfinity):
--> 280 raise TypeError("Invalid comparison of complex %s" % me)
281 if me is S.NaN:
282 raise TypeError("Invalid NaN comparison")
TypeError: Invalid comparison of complex zoo
In [5]:
u[0]
Out[5]:
$$u_{0}$$
In [5]:
integrate(1,(u[4],0.83333-x,1))
Out[5]:
$$x + 0.16667$$
In [ ]:
Content source: MthwRobinson/APPLPy
Similar notebooks: