Mean Value Theorem Calculator📝 Try These Examples:
x³ – 3x² + 2x on [-1, 2]
x² + 2x on [1, 4]
sin(x) on [0, π]
e^x on [0, 2]
`;
// Create blob and download
const blob = new Blob([downloadHTML], { type: 'text/html' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'MVT_Result_' + new Date().getTime() + '.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
showToast('✓ Result downloaded successfully!');
}function resetResult() {
const resultSection = document.getElementById('resultSection');
resultSection.innerHTML = '';
resultSection.classList.remove('show');
// Clear inputs
document.getElementById('function').value = '';
document.getElementById('pointA').value = '';
document.getElementById('pointB').value = '';
// Scroll to top
window.scrollTo({ top: 0, behavior: 'smooth' });
showToast('✓ Calculator reset successfully!');
}function showToast(message) {
// Remove existing toast if any
const existingToast = document.querySelector('.mvt-toast');
if (existingToast) {
existingToast.remove();
}
// Create new toast
const toast = document.createElement('div');
toast.className = 'mvt-toast';
toast.textContent = message;
document.body.appendChild(toast);
// Remove after 3 seconds
setTimeout(() => {
toast.style.opacity = '0';
setTimeout(() => toast.remove(), 300);
}, 3000);
}function showError(message) {
const resultSection = document.getElementById('resultSection');
resultSection.innerHTML = '
';
resultSection.classList.add('show');
}