1.0.2 • Published 4 years ago

mathood v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Mathood package guidelines version 1.0.0

Mathood is a npm package that can be used for parsing vectors and their operations. This module includes utilities such as

  • parsing a vector
  • finding mean of a vector
  • unitizing (normalizing) a vector
  • scaling a vector
  • finding the dot (inner) product of a vector

Downloading the package

The package can be downloaded locally through npm npm i mathood --save

Examples of use

Requiring the module to your app.js file

const mathood = require("mathood");

Determining the vector that you want to parse

const myVector = [1,2,3]; // [ 1, 2, 3 ]

const myVectorParse = mathood.parsed(myVector);

myVectorParse.vector // 1, 2, 3

myVectorParse.dim // 3, 1 // claiming that it is a 3 by 1 vector.

myVectorParse.print(); // consoles vector parsed: 1, 2, 3

>Finding the mean of entries of a vector
```JavaScript
const myVectorFindMean = mathood.mean(myVector); // 2

Normalizing the vector

const myVectorNormalize = mathood.unit(myVector); // [ 0.2672612419124244, 0.5345224838248488, 0.8017837257372732 ]

Scaling the vector by a given value

let scalar = 5;
const myVectorScaleBy = mathood.scaleBy(myVector, scalar) // [ 5, 10, 15 ]

Dot (inner) product operation on the vector

const myVectorDotProduct = mathood.dot(myVector); // 14
1.0.2

4 years ago

1.0.1

4 years ago