Theta Calculator — A Simple Interactive Demo
2024-02-12
experimentsinteractivemath
The Idea
Sometimes you need a quick way to convert angles. Degrees ↔ radians. Maybe compute sin(θ) or cos(θ). Here's a tiny interactive demo built right into the blog.
The Demo
θTheta Calculator
sin(θ) = 0.7071 · cos(θ) = 0.7071 · tan(θ) = 1.0000
The Code
function degreesToRadians(deg) {
return (deg * Math.PI) / 180;
}
function radiansToDegrees(rad) {
return (rad * 180) / Math.PI;
}
// θ in radians
const theta = degreesToRadians(45);
console.log(Math.sin(theta)); // ~0.707
Why θ?
Theta (θ) is the classic variable for angles. It shows up everywhere: trig, physics, rotations. This little calculator is a nod to that—and a chance to try interactive components in the blog itself.
Add more experiments by dropping Markdown files into content/blog/. Cursor-friendly.