// Path: src/main/java/cz/paulrz/montecarlo/single/StochasticProcess1D.java
// public abstract class StochasticProcess1D implements GenericProcess1D {
//     protected final Discretization discretization;
//     protected double x0;
// 
//     /**
//      * Stochastic process constructor
//      * 
//      * @param x0 initial position value
//      * @param d Discretization
//      */
//     protected StochasticProcess1D(double x0, Discretization d) {
//         this.x0 = x0;
//         discretization = d;
//     }
// 
//     /**
//      * Gets initial position value
//      * 
//      * @return
//      */
//     public double getInitialX() {
//         return x0;
//     }
// 
//     public void setInitialX(double x) {
//         x0 = x;
//     }
// 
//     /**
//      * Drift component of stochastic process
//      * 
//      * @param t Time
//      * @param x Position
//      * @return drift
//      */
//     public abstract double drift(double t, double x);
// 
//     /**
//      * Diffusion component of stochastic process
//      * 
//      * @param t Time
//      * @param x Position
//      * @return diffusion
//      */
//     public abstract double diffusion(double t, double x);
// 
//     /**
//      * Returns position after time interval dt
//      * 
//      * @param t Time
//      * @param x Position
//      * @param dt Time step
//      * @param dw Standard Brownian Step
//      * @return Position after time step
//      */
//     public double evolve(final double t, final double x, final double dt, final double dw) {
//         return x + discretization.drift(this, t, x, dt)
//                 + discretization.diffusion(this, t, x, dt) * dw;
//     }
// }


import cz.paulrz.montecarlo.single.StochasticProcess1D;
                    -(2*ksi(t1, x0) + 1),
                    _beta * ksi(t1, xp) - _alpha*_process.drift(t1, xp)
            );
        }

        return result;
    }

    public double[] createRhs(double[] f, double t) {
        final double[] result = new double[_size];

        result[0] = rightHandFunction(t, _mesh.xStart, 0.0, f[0], f[1]);
        result[_size - 1] = rightHandFunction(t, _mesh.xEnd, f[_size-2], f[_size-1], 0.0);

        for(int i=1; i<_size-1; ++i) {
            result[i] = rightHandFunction(t, _mesh.getX(i), f[i-1], f[i], f[i+1]);
        }

        return result;
    }

    private double rightHandFunction(double t, double x, double fn, double f0, double fp) {
        final double xp = x + _dx;
        final double xn = x - _dx;
        final double dmf = mu(t, xp)*fp - mu(t, xn) * fn;
        final double dxf = ksi(t, xp)*fp - 2*ksi(t, x)*f0 + ksi(t, xn)*fn;

        return _alpha*dmf - _beta*dxf - f0;
    }

// Path: src/main/java/cz/paulrz/montecarlo/single/StochasticProcess1D.java
// public abstract class StochasticProcess1D implements GenericProcess1D {
//     protected final Discretization discretization;
//     protected double x0;
// 
//     /**
//      * Stochastic process constructor
//      * 
//      * @param x0 initial position value
//      * @param d Discretization
//      */
//     protected StochasticProcess1D(double x0, Discretization d) {
//         this.x0 = x0;
//         discretization = d;
//     }
// 
//     /**
//      * Gets initial position value
//      * 
//      * @return
//      */
//     public double getInitialX() {
//         return x0;
//     }
// 
//     public void setInitialX(double x) {
//         x0 = x;
//     }
// 
//     /**
//      * Drift component of stochastic process
//      * 
//      * @param t Time
//      * @param x Position
//      * @return drift
//      */
//     public abstract double drift(double t, double x);
// 
//     /**
//      * Diffusion component of stochastic process
//      * 
//      * @param t Time
//      * @param x Position
//      * @return diffusion
//      */
//     public abstract double diffusion(double t, double x);
// 
//     /**
//      * Returns position after time interval dt
//      * 
//      * @param t Time
//      * @param x Position
//      * @param dt Time step
//      * @param dw Standard Brownian Step
//      * @return Position after time step
//      */
//     public double evolve(final double t, final double x, final double dt, final double dw) {
//         return x + discretization.drift(this, t, x, dt)
//                 + discretization.diffusion(this, t, x, dt) * dw;
//     }
// }


// Path: src/main/java/cz/paulrz/montecarlo/estimator/FokkerOperator.java
import cz.paulrz.montecarlo.single.StochasticProcess1D;

                    -(2*ksi(t1, x0) + 1),
                    _beta * ksi(t1, xp) - _alpha*_process.drift(t1, xp)
            );
        }

        return result;
    }

    public double[] createRhs(double[] f, double t) {
        final double[] result = new double[_size];

        result[0] = rightHandFunction(t, _mesh.xStart, 0.0, f[0], f[1]);
        result[_size - 1] = rightHandFunction(t, _mesh.xEnd, f[_size-2], f[_size-1], 0.0);

        for(int i=1; i<_size-1; ++i) {
            result[i] = rightHandFunction(t, _mesh.getX(i), f[i-1], f[i], f[i+1]);
        }

        return result;
    }

    private double rightHandFunction(double t, double x, double fn, double f0, double fp) {
        final double xp = x + _dx;
        final double xn = x - _dx;
        final double dmf = mu(t, xp)*fp - mu(t, xn) * fn;
        final double dxf = ksi(t, xp)*fp - 2*ksi(t, x)*f0 + ksi(t, xn)*fn;

        return _alpha*dmf - _beta*dxf - f0;
    }

    private double mu(double t, double x) {