Permalink
Browse files

Update README styles and release version 0.1.4

  • Loading branch information...
1 parent 5f8955b commit ea49e240c83f51fd64857d319e5cbd3acbfcc7b8 @arian committed Dec 9, 2010
Showing with 61 additions and 61 deletions.
  1. +60 −60 README.md
  2. +1 −1 package.yml
View
120 README.md
@@ -20,14 +20,14 @@ contains some tests.
How to use
----------
-### Array.toNumbers
+### Array:toNumbers
Transforms each value of the array to a number.
#JS
['1', '13', '300'].toNumbers(); // [1, 13, 300]
-### Array.sortNumbers
+### Array:sortNumbers
Sorts an array as numbers. The sort method usually transforms each value to a string and lexically compares the values.
This will result that '10' will before '2'. This is a quick method to fix that.
@@ -36,137 +36,137 @@ This will result that '10' will before '2'. This is a quick method to fix that.
[99, 2, 4, 40, 10].sortNumbers(); [2, 4, 10, 40, 99]
-### Array.sum
+### Array:sum
Sum all the entities of the array
#JS
- [2,5,1,6].sum(); // 14
- [2,5,2,7,7,12,8].sum([start],[length])
+ [2, 5, 1, 6].sum(); // 14
+ [2, 5, 2, 7, 7, 12, 8].sum([start], [length])
-### Array.product
+### Array:product
Get the product of the array and a number or an array with the same size
#JS
- [2,5,6,2].product(3); // [6,15,18,6]
- [2,5,6,2].product([3,7,1,5]); // [5,12,7,7]
+ [2, 5, 6, 2].product(3); // [6, 15, 18, 6]
+ [2, 5, 6, 2].product([3, 7, 1, 5]); // [5, 12, 7, 7]
-### Array.quotient
+### Array:quotient
Get the quotient of the array and a number or an array with the same size
#JS
- [9,12,15].quotient(3) // [3,4,5]
- [9,12,15].quotient(3,4,5) // [3,3,3]
+ [9, 12, 15].quotient(3) // [3, 4, 5]
+ [9, 12, 15].quotient(3, 4, 5) // [3, 3, 3]
-### Array.power
+### Array:power
Get the power of each entity in the array
#JS
- [3,6,2].power(3) // [27,216,8]
- [2,2,2].power([3,4,5]) // [8,16,32]
+ [3, 6, 2].power(3) // [27, 216, 8]
+ [2, 2, 2].power([3, 4, 5]) // [8, 16, 32]
### Array.add
Add a number to each entity in the array
#JS
- [2,5,1].add(4) // [6,9,5]
- [2,5,1].add([1,2,3]) // [3,7,4]
+ [2, 5, 1].add(4) // [6, 9, 5]
+ [2, 5, 1].add([1, 2, 3]) // [3, 7, 4]
-### Array.subtract
+### Array:subtract
Subtract a number to each entity of the array
#JS
- [6,9,5].subtract(4) // [2,5,1]
- [2,7,4].subtract([1,2,3]) // [1,5,1]
+ [6, 9, 5].subtract(4) // [2, 5, 1]
+ [2, 7, 4].subtract([1, 2, 3]) // [1, 5, 1]
-### Array.count
+### Array:count
Count the number of entities in the array
#JS
- [1,3,56,3,56].count() // 5
+ [1, 3 , 56, 3, 56].count() // 5
### Array.range
Fill the array with a range of numbers
#JS
- [].range(2,5) // [2,3,4,5]
- [].range(1,8,2) // [1,3,5,7]
+ [].range(2, 5) // [2, 3, 4, 5]
+ [].range(1, 8, 2) // [1, 3, 5, 7]
-### Array.sequence
+### Array:sequence
Create a sequence
#JS
//A function with a return
[].sequence(function(n){
- return Math.pow(-1,n);
- },[start],[length]);
+ return Math.pow(-1, n);
+ }, [start], [length]);
// A recursive function without a return
// Fibonacci
- [1,1].sequence(function(n){
- this[n+2] = this[n]+this[n+1];
- },[start],[length]);
+ [1, 1].sequence(function(n){
+ this[n + 2] = this[n] + this[n + 1];
+ }, [start], [length]);
-### Array.median
+### Array:median
Find the median of a array of numbers
#JS
- [1,5,2,8,7].median() // 5
- [1,5,2,8,7,2].median() // 3.5
+ [1, 5, 2, 8, 7].median() // 5
+ [1, 5, 2, 8, 7, 2].median() // 3.5
-### Array.variance
+### Array:variance
Find the variance of an array of numbers
#JS
- [3,7,7,19].variance() // 36'
+ [3, 7, 7, 19].variance() // 36'
-### Array.stdDeviation
+### Array:stdDeviation
Find the standard deviation
#JS
- [3,7,7,19].stdDeviation() // 6
+ [3, 7, 7, 19].stdDeviation() // 6
-### Array.transpose
+### Array:transpose
Transpose the matrix (swap the rows and columns)
#JS
- [ [1,2,3], [4,5,6], [7,8,9] ].transpose() // [ [1,4,7], [2,5,8], [3,6,9] ]
+ [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ].transpose() // [ [1, 4, 7], [2, 5, 8], [3, 6, 9] ]
-### Array.dot
+### Array:dot
Find the dot product between two vectors
#JS
- [1,2,3].dot([4,5,6]) // 32
+ [1, 2, 3].dot([4, 5, 6]) // 32
-### Array.cross
+### Array:cross
Find the cross product between two vectors.
Tip, if you use this in combination with Array.vectorLength(), you will
find the magnitude of the vector
#JS
- [1,2,3].cross([4,5,6]) // [-3,6,-6]
+ [1, 2, 3].cross([4, 5, 6]) // [-3, 6, -6]
// Find the torque about A with arm r and force F
// M = r x A
- var M = [1,2,1].cross([100,145,106]); // [67, -6, 6]
+ var M = [1, 2, 1].cross([100, 145, 106]); // [67, -6, 6]
var Mmagnitude = M.vectorLenght(); // 67.53517601961218
-### Array.projection
+### Array:projection
Find the projection of the array on a certain vector
For example: you have a vector in a certain direction, and you want to
@@ -178,59 +178,59 @@ Tip, if you use this in combination with Array.vectorLength(), you will
find the magnitude of the vector
#JS
- [3,3].projection([2,0]) // [3,0]
+ [3, 3].projection([2, 0]) // [3,0]
// Find the force along the x-axis in this 3d space
- [600,263,768].projection([1,0,0]); // [600,0,0]
+ [600, 263, 768].projection([1, 0, 0]); // [600, 0, 0]
// Find the force along the line in the xy-area with slope 0.5
- [600,235,267].projection([1,0.5]);
+ [600, 235, 267].projection([1, 0.5, 1]);
-### Array.determinant
+### Array:determinant
Find the determinant of a 2 by 2 matrix
#JS
- [[4,6],[3,5]].determinant() // 2
+ [[4, 6], [3, 5]].determinant() // 2
-### Array.vectorLength
+### Array:vectorLength
Find the vector of a vector
#JS
- [3,6,2].vectorLength() // 7
+ [3, 6, 2].vectorLength() // 7
- // Find the magnitude of the force [150,300,100] in the 3d space
- [150,300,100].vectorLength();
+ // Find the magnitude of the force [150, 300, 100] in the 3d space
+ [150, 300, 100].vectorLength();
-### Array.normalize
+### Array:normalize
Get the normalized vector, so that the vector length is 1
#JS
- [8,6].normalize() // [4/5,3/5]
+ [8, 6].normalize() // [4/5, 3/5]
-### Array.angle
+### Array:angle
Find the angle between two vectors
#JS
- [3,7,1].angle([3,3,6]) / Math.PI // 0.2798476073884561 pi
+ [3, 7, 1].angle([3, 3, 6]) / Math.PI // 0.2798476073884561 pi
### Array.slope()
Get the slope between two points (2d only, there isn't really such thing as a 3d slope)
#JS
- [3,4].slope([5,8]) // 2
+ [3, 4].slope([5, 8]) // 2
-### Array.distance()
+### Array:distance()
Get the distance between two points (more-dimensional)
#JS
- [4,1].distance([7,5]) // 5
+ [4, 1].distance([7, 5]) // 5
View
@@ -19,7 +19,7 @@ sources:
author: astolwijk
-current: 0.1.3
+current: 0.1.4
docs: http://github.com/arian/Array.Math/blob/master/README.md

0 comments on commit ea49e24

Please sign in to comment.