I am trying to find the area beneath a curve of a given data set. In a previous posting I found some jsl script that helps get the area after using analyze>modeling>non-linear and then using a Gompertz function to get the equation. The problem is the code crashes when I try to run it after I have found that equation. Below is the code and thanks for any help or suggestions
Clear Globals();
xmin=0;
xmax=120;
stop=0.000000001;
pdf=function( {x} , 1.16929740059737 * Exp( -Exp( 0.46956698638041 - 0.00339164235623826 * x ) ) );
//it appears that {x} is what crashes the program, but without it, that line of code has errors
intervals=1;
last=0;
new=0;
flag=0;
while(flag==0,
intervals=intervals+1;
increment=(xmax-xmin)/intervals;
total=0;
for(i=1, i<=intervals, i++,
if(i==1, x=xmin);
if(i>1, x=x+increment);
total=total + ((pdf(x))/2)*increment;
);
last=new;
new=total;
diff=abs(last-new);
if(diff<=stop, flag=1);
);
show(intervals);
show(total);