#!/usr/bin/env python # (C) 2000 Huaiyu Zhu <hzhu@users.sourceforge.net>. Licence: GPL # $Id: test_sfuncs.py,v 1.7 2000/08/06 07:21:17 hzhu Exp $ """ Test stand-alone functions of some distributions. """ from MatPy.Matrix import r_range from MatPy.Stats.distribs import * if __name__ == "__main__": waittime = None else: waittime = 1 i = 0 def test(g, __name__, funcs, x, *args): "For each f in funcs, draw a line with f(args)" global i ys = map(lambda f,args=args:apply(f, args), funcs) g.plot(ys, names=["pdf", "cdf", "cdfc"], xs=[x]*len(funcs)) g.hardcopy("sfunc_%s.ps" %i) i = i + 1 wait(waittime) #------------------------------------------------------------------ print "All of these tests are shown in graphics" from MatPy.gplot import Gplot, wait g = Gplot() x = r_range(100)/10.+1e-300 #-------------------------------------------- g.title("Gamma distribution") a = 2; b = 0.5 test(g, __name__, (pdfg, cdfg, cdfcg), x, x, a, b) x = x - 5 #-------------------------------------------- g.title("Normal distribution") test(g, __name__, (pdfn, cdfn, cdfcn), x, x) """ binomial, negbinomial, poisson, beta, gamma, normal, chi2, t, F, """
Result obtained with
>>> from MatPy.tests import test_sfuncs
All of these tests are shown in graphics igam underflow error igam underflow error