finished implementation of summation of two independent variables represented by a pdf
This commit is contained in:
		
							parent
							
								
									2de79eac77
								
							
						
					
					
						commit
						f3467221cc
					
				| @ -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), \ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user