Your value of stop is pretty small. You might consider raising it a bit, but that really depends on how many significant digits you want to converge on. Also use **{default local}** in your function so as not to confuse JMP about **x**. Here's my modification:

Clear Globals**()**;

xmin = **0**;

xmax = **120**;

stop = **0.000000001**;

pdf = Function**(** **{**x**}**,** {default local}**,

**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** **)**;

//print(intervals);

if **(**mod**(**intervals, **1000)** == **0**,

print**(**char**(**intervals**)** || ": " || char**(**diff**)** || " Total: " || char**(**total**))**;

**)**

**)**;

Show**(** intervals **)**;

Show**(** total **)**;

Results are shown here. I hit the ESC key to stop execution.

**"1000: 0.0000050154411717074 Total: 19.0754942945052"**

**"2000: 0.0000012532594197978 Total: 19.0779995336205"**

**"3000: 0.0000005569154488683 Total: 19.0788346249656"**

**"4000: 0.0000003132397878858 Total: 19.0792521728205"**

**"5000: 0.0000002004643206988 Total: 19.0795027022319"**

**"6000: 0.0000001392066906192 Total: 19.0796697221303"**

**"7000: 0.0000001022719047228 Total: 19.0797890222006"**

**"8000: 0.0000000783009035388 Total: 19.0798784973311"**

**"9000: 0.0000000618661744056 Total: 19.0799480891457"**

**"10000: 0.0000000501117192186 Total: 19.0800037626261"**

**"11000: 0.0000000414136884785 Total: 19.0800493136749"**