finished implementation of summation of two independent variables represented by a pdf

This commit is contained in:
Sebastian Wehling-Benatelli 2016-03-09 06:21:48 +01:00
parent 2de79eac77
commit f3467221cc

View File

@ -128,14 +128,13 @@ class ProbabilityDensityFunction(object):
assert isinstance(other, ProbabilityDensityFunction), \
'both operands must be of type ProbabilityDensityFunction'
raise NotImplementedError('implementation of resulting axis unclear - feature pending!')
# x0, incr, npts, pdf_self, pdf_other = self.rearrange(other)
# pdf = np.convolve(pdf_self, pdf_other, 'same') * incr
#
# # shift axis values for correct plotting
# npts *= 2
# x0 *= 2
# return ProbabilityDensityFunction(x0, incr, npts, pdf)
x0, incr, npts, pdf_self, pdf_other = self.rearrange(other)
pdf = np.convolve(pdf_self, pdf_other, 'full') * incr
# shift axis values for correct plotting
npts = pdf.size
x0 *= 2
return ProbabilityDensityFunction(x0, incr, npts, pdf)
def __sub__(self, other):
assert isinstance(other, ProbabilityDensityFunction), \