Inputs
C
(
)
/
sin
7
8
9
*
cos
4
5
6
-
tan
1
2
3
+
log
ln
π
^
e
abs
0
.
=
Results
Result Value
0
Parsed JavaScript Expression None

How It Works

The scientific calculator takes user-friendly math tokens (like `sin`, `pi`, or `^`) and parses them into standard executable JavaScript counterparts (like `Math.sin`, `Math.PI`, or `**`). It then evaluates the expression client-side using a sanitized compiler wrapper to prevent execution of non-mathematical expressions.

Formula Used

Parsed Expression = ReplaceTokens(UserExpression)
The calculator parses algebraic inputs by replacing standard mathematical symbols with native JavaScript equivalents (e.g. replacing '^' with '**' and 'sin(x)' with 'Math.sin(x)'). The sanitized expression is then safely evaluated client-side using JavaScript's native evaluation engine.

Worked Example

Here is a step-by-step example of how these values are calculated:

Expression 2 * sin(pi / 6) + ln(e)
Result: JavaScript parse: `2 * Math.sin(Math.PI / 6) + Math.log(Math.E)`. Evaluated Result: 2.

Frequently Asked Questions

Are trigonometric inputs in degrees or radians?
Trigonometric functions (sin, cos, tan) assume inputs are in **radians**. To calculate the sine of 30 degrees, enter `sin(30 * pi / 180)`.
How do I do a natural logarithm vs base 10?
Use `ln(x)` for the natural logarithm (base $e$) and `log(x)` for the common logarithm (base 10).