5.0.0 • Published 1 year ago

math-rockz v5.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Math Rockz

math-rockz is a NPM package which helps in doing basic and advanced Maths Calculations and also helps to calculate Perimeter, Area and Volume of different 2D and 3D shapes.

How to install this package?

npm i math-rockz

How to get output?

  • Write any one code from the below examples
  • Then open your terminal and run your .js file

Changes Made

  • Replaced the pow() function with exponent() function
  • Removed square() function
  • Removed squareRoot() function
  • Removed cube() function
  • Removed cubeRoot() function
  • Removed getPythagorasTheoram() function
  • Removed getSine(), getCosine() and getTangent() functions
  • Removed kilometreToMeter(), metreToKilometer(), kilometreToCentimeter(), centimeterToKilometre(), meterToCentimeter() and centimeterToMeter() functions
  • Removed bodyMassIndex() function
  • Added trapeziumArea() function

Examples

.add(number1, number2)

const math = require("math-rockz");

console.log(math.add(10, 10)); //returns 20 in the console

.subtract(number1, number2)

const math = require("math-rockz");

console.log(math.subtract(10, 10)); //returns 0 in the console

.multiply(number1, number2)

const math = require("math-rockz");

console.log(math.multiply(10, 10)); //returns 100 in the console

.divide(number1, number2)

const math = require("math-rockz");

console.log(math.divide(10, 10)); //returns 1 in the console

.remainder(number1, number2)

const math = require("math-rockz");

console.log(math.remainder(10, 3)); //returns 1 in the console

.exponent(base, power)

const math = require("math-rockz");

console.log(math.exponent(12, 4)); //returns the value of 12 to the power of 4 which is 20736

.rectanglePerimeter(length, breadth)

const math = require("math-rockz");

console.log(math.rectanglePerimeter(12, 4)); //returns 32 in the console

.rectangleArea(length, breadth)

const math = require("math-rockz");

console.log(math.rectangleArea(12, 4)); //returns 48 in the console

.squarePerimeter(side)

const math = require("math-rockz");

console.log(math.squarePerimeter(5)); //returns 20 in the console

.squareArea(side)

const math = require("math-rockz");

console.log(math.squareArea(5)); //returns 25 in the console

.trianglePerimeter(side1, side2, side3)

const math = require("math-rockz");

console.log(math.trianglePerimeter(12, 10, 13)); //returns 35 in the console

.triangleArea(base, height)

const math = require("math-rockz");

console.log(math.triangleArea(6, 10)); //returns 30 in the console

.parallelogramPerimeter(base, side)

const math = require("math-rockz");

console.log(math.parallelogramPerimeter(12, 10)); //returns 44 in the console

.parallelogramArea(base, height)

const math = require("math-rockz");

console.log(math.parallelogramArea(12, 10)); //returns 120 in the console

.rhombusPerimeter(side)

const math = require("math-rockz");

console.log(math.rhombusPerimeter(7)); //returns 28 in the console

.rhombusArea(diagonal1, diagonal2)

const math = require("math-rockz");

console.log(math.rhombusArea(5, 8)); //returns 20 in the console

.trapeziumPerimeter(base1, base2, side1, side2)

const math = require("math-rockz");

console.log(math.trapeziumPerimeter(10, 13, 3, 3)); // returns 29 in the console

.trapeziumArea(base1, base2, height)

const math = require("math-rockz");

console.log(math.trapeziumArea(10, 13, 6)); //returns 69 in the console

.circleCircumference(radius)

const math = require("math-rockz");

console.log(math.circleCircumference(5)); //returns 31.41593 in the console

.circleArea(radius)

const math = require("math-rockz");

console.log(math.circleArea(5)); //returns 78.53982 in the console

.semiCircleCircumference(radius)

const math = require("math-rockz");

console.log(math.semiCircleCircumference(5)); //returns 25.708 in the console

.semiCircleArea(radius)

const math = require("math-rockz");

console.log(math.semiCircleArea(5)); //returns 39.27 in the console

.cuboidSurfaceArea(length, breadth, height)

const math = require("math-rockz");

console.log(math.cuboidSurfaceArea(12, 5, 3)); //returns 222 in the console

.cuboidLateralSurfaceArea(length, breadth, height)

const math = require("math-rockz");

console.log(math.cuboidLateralSurfaceArea(12, 5, 3)); //returns 102 in the console

.cuboidVolume(length, breadth, height)

const math = require("math-rockz");

console.log(math.cuboidVolume(12, 5, 3)); //returns 180 in the console

.cubeSurfaceArea(edge)

const math = require("math-rockz");

console.log(math.cubeSurfaceArea(5)); //returns 150 in the console

.cubeLateralSurfaceArea(edge)

const math = require("math-rockz");

console.log(math.cubeLateralSurfaceArea(5)); //returns 100 in the console

.cubeVolume(edge)

const math = require("math-rockz");

console.log(math.cubeVolume(5)); //returns 125 in the console

.cylinderSurfaceArea(radius, height)

const math = require("math-rockz");

console.log(math.cylinderSurfaceArea(5, 10)); //returns 471.2389 in the console

.cylinderLateralSurfaceArea(radius, height)

const math = require("math-rockz");

console.log(math.cylinderLateralSurfaceArea(5, 10)); //returns 314.15927 in the console

.cylinderVolume(radius, height)

const math = require("math-rockz");

console.log(math.cylinderVolume(5, 10)); //returns 785.39816 in the console

.simpleInterest(principle, rateOfInterest, timeInYrs)

const math = require("math-rockz");

console.log(math.simpleInterest(100, 10, 1)); //returns interest gained and total amount recieved in the console

.isProfitOrLoss(costPrice, sellPrice)

const math = require("math-rockz");

console.log(math.isProfitOrLoss(100, 180)); //returns profit gained or loss faced

.findHypotenuse(10, 10)

const math = require("math-rockz");

console.log(math.findHypotenuse(10, 10)); // returns 14.142 in the console

.averageOfTwoNumbers(number1, number2)

const math = require("math-rockz");

console.log(math.averageOfTwoNumbers(12, 21)); //returns the Average as 16.5 in the console

.averageOfThreeNumbers(number1, number2, number3)

const math = require("math-rockz");

console.log(math.averageOfThreeNumbers(12, 21, 5)); //returns the Average as 12.6666666667 in the console

.averageOfFourNumbers(number1, number2, number3, number4)

const math = require("math-rockz");

console.log(math.averageOfFourNumbers(12, 21, 5, 9)); //returns the Average as 11.75 in the console

.averageOfFiveNumbers(number1, number2, number3, number4, number5)

const math = require("math-rockz");

console.log(math.averageOfFiveNumbers(12, 21, 5, 9, 18)); //returns the Average as 13 in the console

.degreeToRadian(degree)

const math = require("math-rockz");

console.log(math.degreeToRadian(99)); // returns 1.727 in the console

.radianToDegree(radian)

const math = require("math-rockz");

console.log(math.radianToDegree(99)); // returns 5675.15923566879 in the console

.percentageCalculator(number, percentage)

const math = require("math-rockz");

console.log(math.percentageCalculator(200, 10)); // returns 10% of 200 in the console

.sectionPoint(xcord1,ycord1, xcord2, ycord2, ratio1, ratio2)

const math = require("math-rockz");

console.log(math.sectionPoint(4, -5, 6, 3, 2, 5)); //returns X = 4.571 and Y = -2.714

.midPoint(xcord1, xcord2, ycord1, ycord2)

const math = require("math-rockz");

console.log(math.midPoint(4, -2, -6, 4)); //returns X = 1 and Y = -1

.distance(xcord1, xcord2, ycord1, ycord2)

const math = require("math-rockz");

console.log(math.distance(-2, 5, 3, 6)); //returns 7.616 units

.slope(xcord1, xcord2, ycord1, ycord2)

const math = require("math-help");

console.log(math.slope(12, 4, 3, 6)); //returns the value -0.375

Donate us so we can Improve

5.0.0

1 year ago

4.1.0

1 year ago

4.0.0

2 years ago

3.9.0

2 years ago

3.8.0

2 years ago

3.7.1

2 years ago

3.7.0

2 years ago

3.6.0

2 years ago

3.5.0

2 years ago

3.4.0

2 years ago

3.3.0

2 years ago

3.2.0

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.9.0

2 years ago

2.8.0

2 years ago

2.7.0

2 years ago

2.6.0

2 years ago

2.5.0

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago