2014-08-12 22:36:45 +02:00

1.2 KiB

Function divide

Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y).

Syntax

math.divide(x, y)

Parameters

Parameter Type Description
x Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null Numerator
y Number | BigNumber | Boolean | Complex | Array | Matrix | null Denominator

Returns

Type Description
Number | BigNumber | Complex | Unit | Array | Matrix Quotient, x / y

Examples

math.divide(2, 3);            // returns Number 0.6666666666666666

var a = math.complex(5, 14);
var b = math.complex(4, 1);
math.divide(a, b);            // returns Complex 2 + 3i

var c = [[7, -6], [13, -4]];
var d = [[1, 2], [4, 3]];
math.divide(c, d);            // returns Array [[-9, 4], [-11, 6]]

var e = math.unit('18 km');
math.divide(e, 4.5);          // returns Unit 4 km

See also

multiply