I was hoping to post in here another problem I solved to show what I've learned, but the test data I plug into my solution gives me unexpected results. I looked over it a dozen times.

This is supposed to evaluate the area under a curve between two points when the curve equation's variable is in the exponent. For example:

Such as in the formula for continuously compounded interest:

where, P is the starting principal,

e is Euler's Number,

r is the annual interest rate (e.g. 0.1 is 10%),

and A is the balance after t years

So to find the area, I take what I presume is called the integral of its differential:

Substitute simple data to check (P=1, r=0.0, p=0, q=2):

That's not right. Well, you see what I've learned. What am I doing wrong?