def tailProbability(x, distributionParams):
 if (('mean' not in distributionParams) or ('stdev' not in distributionParams)):
  raise RuntimeError('Insufficient parameters to specify the distribution.')
 if (x < distributionParams['mean']):
  xp = ((2 * distributionParams['mean']) - x)
  return tailProbability(xp, distributionParams)
 z = ((x - distributionParams['mean']) / distributionParams['stdev'])
 return (0.5 * math.erfc((z / 1.4142)))

def tailProbability ( x , distributionParams ) : if ( ( 'mean' not in distributionParams ) or ( 'stdev' not in distributionParams ) ) : raise RuntimeError ( 'Insufficient parameters to specify the distribution.' ) if ( x < distributionParams [ 'mean' ] ) : xp = ( ( 2 * distributionParams [ 'mean' ] ) - x ) return tailProbability ( xp , distributionParams ) z = ( ( x - distributionParams [ 'mean' ] ) / distributionParams [ 'stdev' ] ) return ( 0.5 * math . erfc ( ( z / 1.4142 ) ) )
given the normal distribution specified by the mean and standard deviation in distributionparams .