# Negative splits generator

Running in Guam is very difficult -- no two ways about it. The grilling heat and oppressive humidity combine to wear you down much faster than even Tallahassee's climate, which I had previously considered pretty hot and humid. My "easy" runs are consistently slower than they were on the mainland by about 45 to 60 seconds per mile. Because of this, I've had to adjust my running goals.

Instead of aiming for a particular time, my new success criterion is to make each mile faster than the one before it. I wanted to be precise about this, so I searched online for a tool that would allow me to hit a specified average pace for the whole run, while making each mile faster than its predecessor by a fixed percentage. The tools I found weren't interactive enough, though, so of course I had to build my own.

Now the only hard part is sticking to the times I've defined...

# Mathematics

Suppose we define "aggressiveness" *A* as the percentage difference between the times for the first and final lap. It's easier to work with this number as *P*, the percentage difference between the time for one lap and the next. For *N* laps then, the problem is a system of linear equations with *N* unknowns and *N* constraints:

- (Constraint 1): The sum of all lap times must equal your expected total running time.
- (Constraints 2-
*N*): For each lap except the first, the running time must be*P*% less than the previous lap.

We can write this as a matrix as follows:

This equation can be solved by multiplying by the inverse on both sides. If you're interested in the code, check it out on Observable.