I’m working on this page:

http://www.iquilezles.org/www/articles/functions/functions.htm

And I try to get Exponential Impulse to work:

Exponential Impulse

Great for triggering behaviours or making envelopes for music or animation, and for anything that grows fast and then slowly decays. Use

kto control the stretching of the function. Btw, its maximum, which is 1, happens at exactly x = 1/k.

```
float expImpulse( float k, float x ) {
const float h = k*x;
return h*exp(1.0-h);
}
```

This is what I have, but it is all being zero.

```
void setup() {
size(600, 600, P2D);
}
void draw() {
background(0);
stroke(255);
for (int x = 0; x < width; x++) {
float y = expImpulse(norm(mouseX, 0, width), x);
}
}
float expImpulse( float k, float x ) {
float h = k*x;
return h*exp(1.0-h);
}
```

Can someone help?