00001 package commandline.Distributions;
00002
00003 import junit.framework.Assert;
00004
00005 import commandline.ImageStuff.GeometricObjects.GenericEdge;
00006 import commandline.debuggingCode.Debug;
00007
00008 public class NormalIndicesDistribution_1A extends NormalIndicesDistribution {
00009 VerticalDistribution verticalDistribution_discr;
00010 public NormalIndicesDistribution_1A(VerticalDistribution verticalDistribution_discr) {
00011 super();
00012 this.verticalDistribution_discr=verticalDistribution_discr;
00013
00014 }
00015
00016 @Override
00021 protected double evaluatePDF(double x, float A_0, float A_1,GenericEdge edge) {
00022 float H=edge.getHoogte();
00023 float length=edge.getEuclidischeLengte();
00024 Assert.assertTrue(H<length);
00025 H=H/length;
00026 float lambda=this.verticalDistribution_discr.getSchatter()*length;
00027 x=x/length;
00028 length=1;
00029 float resultaat;
00030 x=Math.abs(x-length/2);
00031 if(x<H*H/(2*length)){
00032
00033 double INTEGRAAL_outer_a_0_groter_dan_0=-(Math.exp(lambda * (2 * H * (-H / 2 + 1 / H * length *length / 2) + length *length) / H / 2) + Math.exp((-H / 2 + 1 / H * length *length / 2) * lambda + H * lambda) - 2 * Math.exp(lambda * (2 * H * (-H / 2 + 1 / H * length *length / 2) + H *H + length *length) / H / 2) - Math.exp(1 / H * lambda * length *length / 2) - Math.exp(H * lambda) + 2 * Math.exp(lambda * (H *H + length *length) / H / 2)) * Math.exp(-lambda * (2 * H * (-H / 2 + 1 / H * length *length / 2) + H *H + length *length) / H / 2) / length / 4;
00034
00035
00036 double INTEGRAAL_outer_a_0_kleiner_dan_0 = -(-Math.exp(lambda * (2 * H * (1 / H * x * length - H / 2) + Math.pow(length,2) ) / H / 2) - Math.exp((1 / H * x * length - H / 2) * lambda + H * lambda) + 2 * Math.exp(lambda * (2 * H * (1 / H * x * length - H / 2) + Math.pow(H,2) + Math.pow(length,2) ) / H / 2) +Math.exp(1 / H * lambda * Math.pow(length,2) / 2) + Math.exp(H * lambda) - 2 * Math.exp(lambda * (Math.pow(H,2) + Math.pow(length,2) ) / H / 2)) / length * Math.exp(-lambda * (Math.pow(H,2) + Math.pow(length,2) ) / H / 2) / 4;
00037 double eersteterm=lambda * (length - 2 * x) * Math.exp(-(lambda / H * Math.abs(2 * length * x - Math.pow(H,2))) / 2) / length / 0.4e1;
00038 double tot_piek=INTEGRAAL_outer_a_0_kleiner_dan_0+INTEGRAAL_outer_a_0_groter_dan_0+eersteterm;
00039
00040 resultaat=(float) tot_piek;
00041 }
00042 else{
00043
00044 double INTEGRAAL_outer_a_0_groter_dan_ondergrens=(-Math.exp(-lambda * (2 * H * (1 / H * x * length - H / 2) - Math.pow(length,2) - 2 * H * (-H / 2 + 1 / H * Math.pow(length,2) / 2)) / H / 2) - Math.exp(-lambda * (1 / H * x * length - H - 1 / H * Math.pow(length,2) / 2)) + 2 * Math.exp(-lambda * (2 * H * (1 / H * x * length - H / 2) - Math.pow(length,2) - Math.pow(H,2) - 2 * H * (-H / 2 + 1 / H * Math.pow(length,2) / 2)) / H / 2) + Math.exp(1 / H * lambda * Math.pow(length,2) / 2) + Math.exp(H * lambda) - 2 * Math.exp(lambda * (Math.pow(length,2) + Math.pow(H,2)) / H / 2)) * Math.exp(-lambda * (2 * H * (-H / 2 + 4 / H * Math.pow(length,2) / 2) + Math.pow(length,2) + Math.pow(H,2)) / H / 2) / length / 0.4e1;
00045 double eersteterm_2=lambda * (length - 2 * x) * Math.exp(-(lambda / H * Math.abs(2 * length * x - Math.pow(H,2))) / 2) / length / 0.4e1;
00046 double vanaf_piek=INTEGRAAL_outer_a_0_groter_dan_ondergrens+eersteterm_2;
00047 resultaat=(float) vanaf_piek;
00048 }
00049 if(resultaat==Float.NaN){
00050 Debug.print("resultaat= NaN; Lambda has to be in the range of 30;");
00051 }
00052 return resultaat;
00053 }
00054
00055 }