Understanding your maximum heart rate (MHR) is a valuable metric for cyclists looking to optimize their training. Your MHR is the highest number of times your heart can beat per minute during intense physical activity. While it varies greatly between individuals, several formulas can provide a good estimate. The most common and widely accepted formula is the Tanaka formula, which is generally considered more accurate than the older Karvonen formula for most individuals.
function calculateMaxHeartRate() {
var ageInput = document.getElementById("age");
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
var age = parseFloat(ageInput.value);
if (isNaN(age) || age 120) {
resultDiv.innerHTML = "Please enter a valid age in years (between 1 and 120).";
return;
}
// Tanaka formula: MHR = 208 – (0.7 * age)
var maxHeartRate = 208 – (0.7 * age);
resultDiv.innerHTML = "Estimated Maximum Heart Rate: " + maxHeartRate.toFixed(0) + " bpm";
}