Here is a link to what I am trying to do... I'm not sure what I am doing wrong.

http://ezekiel.vancouver.wsu.edu/~cs...ts/pdf/pdf.pdf

Here is my source code thus far...

Values of x=72, U=69, and O=2.8 should give a p=0.85801Code:#include<stdio.h> #include<stdlib.h> #include<math.h> #define INV_SQRT_2PI 0.39894228 /* 1/sqrt(2*pi) */ #define epsilon 0.0000001 double a, b, approx, u, U, O; int x; double o=epsilon; double f(int x) { double f(int x); = exp(((double)x*x)/2); return f(x); } double S(double a, double b) { double S(double a, double b); = ((b-a)/6)*(f(a)+4*f((a+b)/2)+f(b)); return S(a,b); } double asimpson(double a,double b,double approx, double o) { double c=(a+b)/2; double left=S(a,c); double right=S(c,b); double d=(left+right-approx)/15; if(abs(d)<=epsilon) return left+right+d; return asimpson(a,c,left,o/2)+asimpson(c,b,right,o/2); } int main(void) { scanf("%lf", &x); scanf("%lf", &U); scanf("%lf", &O); double p, u, o; u=(x-U)/O; p=(1/2)+INV_SQRT_2PI * asimpson(0,u,S(0,u),o); printf("pdf= %f",p); return 0; }

You'll all probably find it disgustingly crude, but I've never done any programming before... please be kind and help a newbie.