The Scientific Calculator evaluates mathematical expressions including trigonometric functions (sin, cos, tan), logarithms (log, ln), square roots, powers, and constants (π, e) — all from a clean button interface or typed expressions.
Scientific Calculator
Advanced calculator with trig, logarithmic, and power functions.
How to Use This Calculator
- Click the buttons to build an expression, or type directly in the display.
- Use function buttons like sin(, cos(, √( followed by the argument and a closing parenthesis.
- Press = to evaluate. Press C to clear or DEL to delete the last character.
Function Reference
- sin / cos / tan: Trigonometric functions — input in radians (e.g., sin(π/2) = 1)
- log: Base-10 logarithm (log(100) = 2)
- ln: Natural logarithm, base e (ln(e) = 1)
- √(: Square root
- π: Pi ≈ 3.14159265…
- e: Euler’s number ≈ 2.71828…
- ^: Exponentiation (2^8 = 256)
- x²: Squares the current expression
Radians vs. Degrees
This calculator, like most programming environments, uses radians for trigonometric functions. To convert degrees to radians: radians = degrees × π/180. Common values: 90° = π/2 ≈ 1.5708, 180° = π, 360° = 2π.
Frequently Asked Questions
Why does sin(π) not equal exactly 0?
Due to floating-point precision, sin(π) evaluates to approximately 1.22e−16 rather than exactly 0. This is normal — JavaScript stores π as an approximation with about 15 significant digits, and the tiny error propagates through the sine function.
Is the expression evaluation safe?
The calculator sanitizes the input to only allow mathematical expressions before evaluation. Variable names and other code constructs are blocked, preventing code injection.
How it works
Expressions are transformed by replacing mathematical notation (sin, cos, log, √, π, e, ^) with their JavaScript equivalents (Math.sin, Math.cos, Math.log10, Math.sqrt, Math.PI, Math.E, **). The transformed expression is then evaluated using the Function constructor with "use strict" mode.Formula
Transforms: sin→Math.sin, cos→Math.cos, tan→Math.tan, log→Math.log10, ln→Math.log, √→Math.sqrt, π→Math.PI, ^→**