import React, { useState } from 'react'; const ExponentialExplorer: React.FC = () => { const [a, setA] = useState(2); // Initial Value const [b, setB] = useState(1.5); // Growth Factor const [k, setK] = useState(0); // Horizontal Asymptote shift const width = 300; const height = 300; const range = 5; // x range -5 to 5 // Mapping const toPx = (v: number, isY = false) => { const scale = width / (range * 2); const center = width / 2; return isY ? center - v * scale : center + v * scale; }; const generatePath = () => { let d = ""; for (let x = -range; x <= range; x += 0.1) { const y = a * Math.pow(b, x) + k; if (y > range * 2 || y < -range * 2) continue; // Clip const px = toPx(x); const py = toPx(y, true); d += d ? ` L ${px} ${py}` : `M ${px} ${py}`; } return d; }; return (
{b > 1 ? "Growth (b > 1)" : "Decay (0 < b < 1)"}