How to use the chaospy.distributions.evaluation.evaluate_density function in chaospy

To help you get started, we’ve selected a few chaospy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonathf / chaospy / chaospy / distributions / operators / arcsin.py View on Github external
def _pdf(self, x, dist, cache):
        """Probability density function."""
        return evaluation.evaluate_density(
            dist, numpy.sin(x), cache=cache)*numpy.cos(x)
github jonathf / chaospy / chaospy / distributions / operators / cos.py View on Github external
def _pdf(self, x, dist, cache):
        """Probability density function."""
        output = evaluation.evaluate_density(dist, numpy.arccos(x), cache=cache)
        output /= numpy.where(numpy.isin(x, [-1, 1]), numpy.inf, numpy.sqrt(1-x*x))
        return output
github jonathf / chaospy / chaospy / distributions / operators / arccos.py View on Github external
def _pdf(self, x, dist, cache):
        return evaluation.evaluate_density(
            dist, numpy.cos(x), cache=cache)*numpy.sin(x)
github jonathf / chaospy / chaospy / distributions / operators / arcsinh.py View on Github external
def _pdf(self, x, dist, cache):
        """Probability density function."""
        return evaluation.evaluate_density(
            dist, numpy.sinh(x), cache=cache)*numpy.cosh(1+x*x)
github jonathf / chaospy / chaospy / distributions / operators / tanh.py View on Github external
def _pdf(self, x, dist, cache):
        """Probability density function."""
        return evaluation.evaluate_density(
            dist, numpy.arctanh(x), cache=cache)/numpy.sqrt(1-x*x)
github jonathf / chaospy / chaospy / distributions / operators / power.py View on Github external
assert numpy.all(left > 0), "imaginary result"
            x_ = numpy.where(xloc <= 0, -numpy.inf,
                    numpy.log(xloc + 1.*(xloc<=0))/numpy.log(left+1.*(left == 1)))
            num_ = numpy.log(left+1.*(left == 1))*xloc
            num_ = num_ + 1.*(num_==0)

            out = evaluation.evaluate_density(right, x_, cache=cache)/num_
            return out

        x_ = numpy.sign(xloc)*numpy.abs(xloc)**(1./right -1)
        xloc = numpy.sign(xloc)*numpy.abs(xloc)**(1./right)
        pairs = numpy.sign(xloc**right) == 1

        out = evaluation.evaluate_density(left, xloc, cache=cache)
        if numpy.any(pairs):
            out = out + pairs*evaluation.evaluate_density(left, -xloc, cache=cache)

        out = numpy.sign(right)*out * x_ / right
        out[numpy.isnan(out)] = numpy.inf

        return out
github jonathf / chaospy / chaospy / distributions / operators / logarithm10.py View on Github external
def _pdf(self, xloc, dist, cache):
        """Probability density function."""
        return evaluation.evaluate_density(
            dist, 10**xloc, cache=cache)*10**xloc*numpy.log(10)
github jonathf / chaospy / chaospy / distributions / operators / arctan.py View on Github external
def _pdf(self, x, dist, cache):
        return evaluation.evaluate_density(
            dist, numpy.tan(x), cache=cache)*(1+numpy.tan(x)**2)
github jonathf / chaospy / chaospy / distributions / operators / addition.py View on Github external
[ 0.  0. inf  0.]
        """
        left = evaluation.get_forward_cache(left, cache)
        right = evaluation.get_forward_cache(right, cache)

        if isinstance(left, Dist):
            if isinstance(right, Dist):
                raise evaluation.DependencyError(
                    "under-defined distribution {} or {}".format(left, right))
        elif not isinstance(right, Dist):
            return numpy.inf
        else:
            left, right = right, left

        xloc = (xloc.T-numpy.asfarray(right).T).T
        output = evaluation.evaluate_density(left, xloc, cache=cache)
        assert output.shape == xloc.shape
        return output