public double[][] getWaveFunction(double energy) {

        // Number of dots in the whole MatterStack
        int numberOfDots = (int) (getWidth() * X_POINTS_DENSITY * 1000000000L);

        // TODO try-catch or think on long-or-int problem
        double[] waveFunction = new double[numberOfDots];
        double[] xAxis = new double[numberOfDots];
        double[] xLocal;

        int counter = 0;

        Complex[] coef;
        Complex jp = new Complex(0, 1);  // i
        Complex jm = new Complex(0, -1); // -i

        for (int k = 0; k < intervals.size(); k++) {
            MatterInterval inl = intervals.get(k);
            xLocal = inl.getGrid(X_POINTS_DENSITY * 1000000000L); // XXX Magic
            for (int i = 0; i < xLocal.length; i++) {

                coef = getWavefunctionCoeffs(k, energy);
                waveFunction[i + counter] = (coef[0].times(Complex.exp(jp.times(inl.getWaveNumber(energy).times(xLocal[i])
                        .subtract(getDelta(k, energy)))))).add(
                        coef[1].times(Complex.exp(jm.times(inl.getWaveNumber(energy).times(xLocal[i])
                                .subtract(getDelta(k, energy)))))).abs();

                xAxis[i + counter] = xLocal[i];

            }
            counter += xLocal.length;
        }
        return new double[][]{xAxis, waveFunction};
    }