# Shell Calculator

 Direct url for sharing | reverse Print worksheet | Clear worksheet

Shell Calculator is a powerful scientific calculator. It can evaluate wide range of mathematical expressions, supports variable assignment loading external javascript resources and custom calculators.

For instance try entering the following:
a=3
c=sqrt(25+a*a)
(press Enter or click Compute button after each expression)

## Examples

1. How much would \$1000 would turn into after 30 years if APY is 10%? Solve.
2. What is the sum of all natural numbers less or equal to 100. Solve.
3. What is the chance of getting heads 10 times in a row in a cointoss? Solve.

## Instructions

History: use arrow up and arrow down to navigate command history.

Syntax: put function arguments in parentheses: sin(x) - correct, sin x - incorrect; do not omit multiplication: x*sin(x) - correct, x sin(x) - incorrect; use e for numbers in scientific notation: 2e3 = 2000; log - natural logarithm, to express decimal logarithm use log(x)/log(10).

Constants: e (Base of the natural logarithm: 2.71828...), pi (π: 3.14159...), Infinity (Positive infinity), -Infinity (Negative infinity).

Arithmetic operators: + (Addition), - (Subtraction), * (Multiplication), / (Division), % (Modulus).

Comparison operator: == (equal), != (not equal), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal), === (equal in both value and type), !== (not equal in either value or type).

Logical operator: && (and), || (or), ! (not).

Bitwise operators: & (and), | (or), ~ (not), ^ (xor), << (left shift), >> (Sign-propagating right shift), >>> (Zero-fill right shift).

Assignment operators: =, +=, -=, *=, /=, %=, <<=, >>=, >>>=, &=, ^=, |=.

Ternary conditional operator: <condition> ? <value if true> : <value if false>

Functions: sqrt (Square root), exp (Exponent), pow (Power), log (Natural logarithm), erf (Error function), abs (Absolute value), sign (Sign function).

Trigonometric functions: sin (Sine), cos (Cosine), sec (Secant), csc (Cosecant), tan (Tangent), cot (Cotangent), asin (Arcsine), acos (Arccosine), asec (Arcsecant), acsc (Arccosecant), atan (Arctangent), acot (Arccotangent); rad (Converts from degrees to radians), deg (Converts from radians to degrees).

Hyperbolic functions: sinh cosh sech csch tanh coth asinh acosh asech acsch atanh acoth.

Rounding functions: floor (returns largest integer smaller or equal to the number), ceil (returns smallest integer greater or equal to the number), round (returns nearest integer).

Random functions: random (returns float between in [0, 1) interval), rand(min, max) (returns integer in [min, max) interval).

Statistical functions (operate on arrays): max (maximum element), min (minimum element), sum (sum of elements), mean (arithmetic mean), geometric_mean (geometric mean), harmonic_mean (harmonic mean), median, range (returns range = max - min), variance, sample_variance, std (standard deviation), sample_std (sample standard deviation), standard_error, cv (coefficient of variation), skewness, sample_skewness.

Integraton with external resources: load(URL) - if resource is a javascript it will be loaded and executed, if resource is an image it will be inserted in the console.

Advanced usage: valid javascript expressions are supported. For instance, you can ask for the user input by calling prompt function as demonstrated in circumference calculator.

## Creating a custom calculator

If you need to compute an expression frequently you can define it as a function and then use direct link to access a custom version of this calculator.

For example to can define hypotenuse of a triangle as follows: hyp = function(a, b) { return sqrt(a*a+b*b)}
Change the title of the calculator:
title('Hypotenuse calculator')
and definte custom help string:
help('<b>Hypotenuse Calculator</b> is a custom shell calculator that allows to compute hypotenuse of a right triangle using function <b>hyp(a, b)</b>. Example: <i>hyp(3, 4)</i>')

Final result is a hypotenuse calculator.

 Shell calculator | Link to us | Contact us
Shell Calculator - Scientific calculator redefined.