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.
Functions Supported
- Basic arithmetic: addition, subtraction, multiplication, division.
- Powers & roots: x², x^y, square root, and reciprocals.
- Trigonometry: sin, cos, and tan (with their inverses).
- Logarithms: natural log (ln) and base-10 log.
- Constants: π (pi) and e (Euler’s number).
- Factorials and percentages for quick combinatorics and proportion work.
Order of Operations (PEMDAS)
The calculator follows the standard order of operations so expressions evaluate the way they would on paper: Parentheses, Exponents, Multiplication and Division (left to right), then Addition and Subtraction (left to right). For example, 2 + 3 × 4 equals 14, not 20, because multiplication is performed before addition. Use parentheses whenever you want to force a different grouping, such as (2 + 3) × 4 = 20.
Degrees vs Radians
Trigonometric functions can be evaluated in degrees or radians, and the two give very different results — sin(90°) = 1, but sin(90 radians) ≈ 0.894. Make sure the angle mode matches your problem: most everyday geometry uses degrees, while calculus and physics usually use radians.
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, ^→**