Java Gauss gaussianIntegral(double x)

Here you can find the source of gaussianIntegral(double x)

Description

gaussian Integral

License

LGPL

Declaration

public static double gaussianIntegral(double x) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static double gaussianIntegral(double x) {
        if (x < -8.)
            return -.5;
        if (x > 8.)
            return .5;

        double xx = x * x;

        double sum = 0.0, term = x;
        for (int i = 3;; i += 2) {
            double next = sum + term;
            if (next == sum)
                break;

            sum = next;//from   ww w .jav  a  2 s. c o  m
            term = term * xx / i;
        }

        return sum * gaussian(x);
    }

    public static double gaussian(double x) {
        return Math.exp(-x * x / 2) / Math.sqrt(2 * Math.PI);
    }
}

Related

  1. gaussian(int size, double sigma)
  2. gaussianBlur(int[][] pixels, float sigma)
  3. gaussianDensity(double x, double mean, double standardDeviation)
  4. gaussianDerivative(double x)
  5. gaussianFilter(float[] weights, float sigma)
  6. gaussianPDF(double mean, double variance, double x)
  7. gaussianPDF(double mu, double sigma, double x)
  8. gaussianWindow(double mean1, double mean2, double std)
  9. gaussJordanElimination(boolean[][] matrix)