Algorithm: The horsepower curve is handled as a piecewise cubic spline. The program will not interpolate beyond the user-entered RPM range, so the computed optimum must lie within the RPM range of horsepower, and the RPMs must be entered in ascending order, or bad thing may happen. Method 1 (maintaining the same horsepower value before and after the shift) uses a modified Newton search, and the the second method (maximum area under horsepower curve) uses a numerical minimizer (or maximizer of area-under-the-curve, in this case). Since the RPM after the shift depends on the "ratios" of the gear ratios, the difference between the RPMs before and after the shift grows with increasing RPMs. This makes the area under the curve method favor higher shift RPMs compared to the first method. Which one is better? You find out......