MathMath

Help › Functions

Arithmetic and functions

sin cos tan sec csc cot asin acos atan atan2 sinh cosh tanh exp ln log sqrt sign floor ceil trunc round mod sum δ Δ Φ °C °F

sin(x) As in Mathcad

The sine of an angle.

Takes radians, or an angle written with deg. Element by element for a vector or matrix. Other trigonometric functions: cos, tan, sec, csc, cot.

Units

The argument has no units, apart from angles: 30·deg is fine.

Refused

  • A value with units other than an angle.
  • A complex argument.
sin(30⋅deg)=0.5
sin(2π​)=1

cos(x) As in Mathcad

The cosine of an angle.

Takes radians, or an angle written with deg. Element by element for a vector or matrix. acos goes back.

Units

The argument has no units, apart from angles: 60·deg is fine.

Refused

  • A value with units other than an angle.
  • A complex argument.
cos(60⋅deg)=0.5
cos(0)=1

tan(x) As in Mathcad

The tangent of an angle.

Takes radians, or an angle written with deg. Element by element for a vector or matrix. atan goes back.

Units

The argument has no units, apart from angles.

Refused

  • A value with units other than an angle.
  • A complex argument.
tan(45⋅deg)=1
tan(0)=0

sec(x) As in Mathcad

The secant of an angle: 1 / cos(x).

Takes radians, or an angle written with deg. Element by element for a vector or matrix. See cos.

Units

The argument has no units, apart from angles.

Refused

  • A value with units other than an angle.
  • A complex argument.
sec(60⋅deg)=2
sec(0)=1

csc(x) As in Mathcad

The cosecant of an angle: 1 / sin(x).

Takes radians, or an angle written with deg. Element by element for a vector or matrix. See sin.

Units

The argument has no units, apart from angles.

Refused

  • A value with units other than an angle.
  • A complex argument.
csc(30⋅deg)=2
csc(2π​)=1

cot(x) As in Mathcad

The cotangent of an angle: 1 / tan(x).

Takes radians, or an angle written with deg. Element by element for a vector or matrix. See tan.

Units

The argument has no units, apart from angles.

Refused

  • A value with units other than an angle.
  • A complex argument.
cot(45⋅deg)=1
cot(2π​)=0

asin(x) As in Mathcad

The angle, in radians from −π/2 to π/2, whose sine is x.

Element by element for a vector or matrix. Divide by deg to see the answer in degrees. sin goes back.

Units

The argument has no units.

Refused

  • A value outside −1 to 1: its angle is complex, and isn't supported.
asin(0.5)=0.524
degasin(0.5)​=30

acos(x) As in Mathcad

The angle, in radians from 0 to π, whose cosine is x.

Element by element for a vector or matrix. Divide by deg to see the answer in degrees. cos goes back.

Units

The argument has no units.

Refused

  • A value outside −1 to 1: its angle is complex, and isn't supported.
acos(0.5)=1.047
degacos(0.5)​=60

atan(x) As in Mathcad

The angle, in radians between −π/2 and π/2, whose tangent is x.

Element by element for a vector or matrix. When you have both sides of the triangle, atan2 and angle also tell the quadrant. tan goes back.

Units

The argument has no units.

Refused

  • A complex argument.
atan(1)=0.785
degatan(1)​=45

atan2(x, y) As in Mathcad

The angle of the point (x, y), in radians from −π to π.

Note the order: x first, then y. The answer is in the right quadrant, so atan2(−1, −1) is −3π/4, not π/4. angle gives the same angle from 0 to 2π.

Units

x and y are used as plain numbers, and can have any units: the units are dropped.

Refused

  • A complex argument is read by its real part only.
atan2(1,1)=0.785
atan2(−1,−1)=−2.356

sinh(x) As in Mathcad

The hyperbolic sine of x.

Element by element for a vector or matrix. See also cosh and tanh.

Units

The argument has no units.

Refused

  • A complex argument.
sinh(0)=0
sinh(1)=1.175

cosh(x) As in Mathcad

The hyperbolic cosine of x.

Element by element for a vector or matrix. See also sinh and tanh.

Units

The argument has no units.

Refused

  • A complex argument.
cosh(0)=1
cosh(1)=1.543

tanh(x) As in Mathcad

The hyperbolic tangent of x: sinh(x) / cosh(x).

Element by element for a vector or matrix. It runs from −1 to 1.

Units

The argument has no units.

Refused

  • A complex argument.
tanh(0)=0
tanh(1)=0.762

exp(x) As in Mathcad

e raised to the power x.

Element by element for a vector or matrix. ln goes back.

Units

The argument has no units.

Refused

  • A complex argument.
exp(0)=1
exp(ln(5))=5

ln(x) As in Mathcad

The natural logarithm of x.

Element by element for a vector or matrix. A negative or complex x gives a complex answer: ln(−1) is πi. For other bases see log; exp goes back.

Units

The argument has no units.

Refused

  • 0, whose logarithm is minus infinity.
  • A value with units.
ln(1)=0
ln(−1)=3.142i

log(x, [b]) As in Mathcad

The logarithm of x to base 10, or to base b when you give one.

Element by element for a vector or matrix; b is a single real number. A negative or complex x gives a complex answer. For natural logarithms use ln.

Units

x has no units.

Refused

  • 0, whose logarithm is minus infinity.
  • A value with units.
  • A base b that isn't a real number.
log(1000)=3
log(8,2)=3

sqrt(x) As in Mathcad

The square root of x.

Type it by name, as sqrt(x). A negative x gives an imaginary answer. Element by element for a vector or matrix.

Units

Units are kept, with half the power: the square root of 9 m² is 3 m, and of 4 m is 2 m^0.5.

sqrt(16)=4
sqrt(−4)=2i

sign(x) As in Mathcad

The sign of x: −1 for negative, 0 for zero, and 1 for positive.

Element by element for a vector or matrix. A complex x is read by its real part.

Units

The answer has no units, whatever x has.

sign(−7)=−1
sign(2.5⋅m)=1

floor(x) As in Mathcad

The largest whole number not above x.

Element by element for a vector or matrix. Negative numbers go down: floor(−2.5) is −3. See also ceil, trunc and round.

Units

Units are kept.

floor(2.7)=2
floor(−2.5)=−3

ceil(x) As in Mathcad

The smallest whole number not below x.

Element by element for a vector or matrix. Negative numbers go up: ceil(−2.5) is −2. See also floor, trunc and round.

Units

Units are kept.

ceil(2.1)=3
ceil(−2.5)=−2

trunc(x) As in Mathcad

x with its fraction cut off, toward zero.

Element by element for a vector or matrix. trunc(−2.7) is −2. See also floor, ceil and round.

Units

Units are kept.

trunc(2.7)=2
trunc(−2.7)=−2

round(x, [n]) As in Mathcad

x rounded to n decimal places, or to a whole number when you leave n out.

A half rounds away from zero: round(2.5) is 3 and round(−2.5) is −3. A negative n rounds to tens, hundreds and so on. Element by element for a vector or matrix. See also floor, ceil and trunc.

Units

Units are kept. n has no units.

round(2.567,2)=2.57
round(15,−1)=20
round(2.5⋅m)=3 m

mod(x, y) As in Mathcad

The remainder of x divided by y.

The remainder has the sign of x: mod(−7, 3) is −1. x and y need not be whole numbers.

Units

The answer takes x's units; y's units are not checked.

Refused

  • y of 0.
mod(7,3)=1
mod(−7,3)=−1
mod(7⋅m,3⋅m)=1 m

sum(v) As in Mathcad

The sum of all the elements of a vector or matrix.

A single number gives itself. For a sum over a range variable, use the summation operator instead.

Units

The elements must be in compatible units; the sum is in the array's units.

Refused

  • Elements in different units.
  • Elements that aren't numbers.
sum((13​24​))=10
sum⎝⎛​⎝⎛​123​⎠⎞​⎠⎞​=6

δ(m, n) As in Mathcad

Kronecker's delta: 1 when m and n are equal, and 0 when they aren't.

Takes two real numbers. For Dirac's impulse, see Δ.

Refused

  • One argument only: δ is Kronecker's delta and needs two.
  • A complex m or n.
δ(2,2)=1
δ(2,3)=0

Δ(x) As in Mathcad

Dirac's impulse as inverse Laplace transforms write it: 0 for any x but 0, and infinity at 0.

Element by element for a vector or matrix. For the step that jumps at 0, see Φ.

Refused

  • A complex x.
Δ(0)=∞
Δ(2)=0

Φ(x) As in Mathcad

The Heaviside step: 0 for negative x, and 1 for x of 0 or more.

Element by element for a vector or matrix. Unlike some definitions, Φ(0) is 1.

Refused

  • A complex x.
Φ(−2)=0
Φ(0)=1
Φ(3)=1

°C(t) MathMath’s own

A temperature in degrees Celsius, as an absolute temperature in kelvin.

Use it as a function to turn a Celsius reading into a quantity you can calculate with: °C(20) is 293.15 K. Written after a number as the unit degC, it shows a result in Celsius instead. °F does the same for Fahrenheit.

Units

The argument has no units; the answer is in kelvin.

°C(20)=293.15 K
°C(100)−°C(0)=100 K

°F(t) MathMath’s own

A temperature in degrees Fahrenheit, as an absolute temperature in kelvin.

Use it as a function to turn a Fahrenheit reading into a quantity you can calculate with: °F(32) is 273.15 K. °C does the same for Celsius.

Units

The argument has no units; the answer is in kelvin.

°F(32)=273.15 K
°F(212)=373.15 K