Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 049c5ce

Browse files
committed
Released version 2.4.0
1 parent 667139f commit 049c5ce

9 files changed

Lines changed: 395 additions & 80 deletions

File tree

HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# History
22

3-
## not yet released, version 2.4.0
3+
## 2015-10-09, version 2.4.0
44

55
- Added support in the expression parser for mathematical alphanumeric symbols
66
in the expression parser: unicode range \u{1D400} to \u{1D7FF} excluding

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mathjs",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"main": "./dist/math.min.js",
55
"license": "Apache-2.0",
66
"ignore": [

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "mathjs",
33
"repo": "josdejong/mathjs",
44
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.",
5-
"version": "2.3.0",
5+
"version": "2.4.0",
66
"main": "dist/math.min.js",
77
"license": "Apache-2.0",
88
"keywords": [

dist/math.js

Lines changed: 329 additions & 51 deletions
Large diffs are not rendered by default.

dist/math.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/math.min.js

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/functions/distance.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,70 @@
11
# Function distance
22

3-
Calculates the Euclidean distance between two points.
3+
Calculates:
4+
The eucledian distance between two points in 2 and 3 dimensional spaces.
5+
Distance between point and a line in 2 and 3 dimensional spaces.
6+
Pairwise distance between a set of 2D or 3D points
7+
NOTE:
8+
When substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c
9+
For parametric equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c)
410

511

612
## Syntax
713

814
```js
9-
math.distance([x1, y1], [x2, y2]);
10-
math.distance([[x1, y1], [x2, y2]);
15+
math.distance([x1, y1], [x2, y2])
16+
math.distance({pointOneX: 4, pointOneY: 5}, {pointTwoX: 2, pointTwoY: 7})
17+
math.distance([x1, y1, z1], [x2, y2, z2])
18+
math.distance({pointOneX: 4, pointOneY: 5, pointOneZ: 8}, {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9})
19+
math.distance([[A], [B], [C]...])
20+
math.distance([x1, y1], [LinePtX1, LinePtY1], [LinePtX2, LinePtY2])
21+
math.distance({pointX: 1, pointY: 4}, {lineOnePtX: 6, lineOnePtY: 3}, {lineTwoPtX: 2, lineTwoPtY: 8})
22+
math.distance([x1, y1, z1], [LinePtX1, LinePtY1, LinePtZ1], [LinePtX2, LinePtY2, LinePtZ2])
23+
math.distance({pointX: 1, pointY: 4, pointZ: 7}, {lineOnePtX: 6, lineOnePtY: 3, lineOnePtZ: 4}, {lineTwoPtX: 2, lineTwoPtY: 8, lineTwoPtZ: 5})
24+
math.distance([x1, y1], [xCoeffLine, yCoeffLine, constant])
25+
math.distance({pointX: 10, pointY: 10}, {xCoeffLine: 8, yCoeffLine: 1, constant: 3})
26+
math.distance([x1, y1, z1], [x0, y0, z0, a-tCoeff, b-tCoeff, c-tCoeff]) point and parametric equation of 3D line
27+
math.distance([x, y, z], [x0, y0, z0, a, b, c])
28+
math.distance({pointX: 2, pointY: 5, pointZ: 9}, {x0: 4, y0: 6, z0: 3, a: 4, b: 2, c: 0})
1129
```
1230

1331
### Parameters
1432

1533
Parameter | Type | Description
1634
--------- | ---- | -----------
17-
`x` | Array | Matrix | Co-ordinates of first end-point of first line
18-
`y` | Array | Matrix | Co-ordinates of second end-point of first line
35+
`x` | Array | Matrix | Object | Co-ordinates of first point
36+
`y` | Array | Matrix | Object | Co-ordinates of second point
1937

2038
### Returns
2139

2240
Type | Description
2341
---- | -----------
24-
Number | BigNumber | Returns the distance from two points
42+
Number | BigNumber | Returns the distance from two/three points
2543

2644

2745
## Examples
2846

2947
```js
30-
math.distance([0,0], [4,4]) //returns 5.6569
31-
math.distance([[0,0], [4,4]]) //returns 5.6569
48+
math.distance([0,0], [4,4]) // Returns 5.6569
49+
math.distance(
50+
{pointOneX: 0, pointOneY: 0},
51+
{pointTwoX: 10, pointTwoY: 10}) // Returns 14.142135623730951
52+
math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.74166
53+
math.distance(
54+
{pointOneX: 4, pointOneY: 5, pointOneZ: 8},
55+
{pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9}) // Returns 3
56+
math.distance([[1, 2], [1, 2], [1, 3]]) // Returns [0, 1, 1]
57+
math.distance([[1,2,4], [1,2,6], [8,1,3]]) // Returns [2, 7.14142842854285, 7.681145747868608]
58+
math.distance([10, 10], [8, 1, 3]) // Returns 11.535230316796387
59+
math.distance([10, 10], [2, 3], [-8, 0]) // Returns 8.759953130362847
60+
math.distance(
61+
{pointX: 1, pointY: 4},
62+
{lineOnePtX: 6, lineOnePtY: 3},
63+
{lineTwoPtX: 2, lineTwoPtY: 8}) // Returns 2.720549372624744
64+
math.distance([2, 3, 1], [1, 1, 2, 5, 0, 1]) // Returns 2.3204774044612857
65+
math.distance(
66+
{pointX: 2, pointY: 3, pointZ: 1},
67+
{x0: 1, y0: 1, z0: 2, a: 5, b: 0, c: 1} // Returns 2.3204774044612857
3268
```
3369
3470

lib/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = '2.3.0';
1+
module.exports = '2.4.0';
22
// Note: This file is automatically generated when building math.js.
33
// Changes made in this file will be overwritten.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mathjs",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.",
55
"author": "Jos de Jong <[email protected]> (https://github.com/josdejong)",
66
"contributors": [
@@ -61,7 +61,7 @@
6161
"decimal.js": "^4.0.2",
6262
"fraction.js": "^3.0.0",
6363
"tiny-emitter": "^1.0.0",
64-
"typed-function": "^0.10.1"
64+
"typed-function": "^0.10.3"
6565
},
6666
"devDependencies": {
6767
"glob": "^5.0.5",

0 commit comments

Comments
 (0)