npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wdmath

v1.0.0

Published

WdMath is an extension for advanced math calcs

Downloads

2

Readme


WdMath

WdMath is a JavaScript library providing a variety of mathematical functions, including operations on complex numbers, geometry calculations, and conversion utilities. This library is designed to be lightweight and easy to integrate into any JavaScript project.

Table of Contents

Installation

To install WdMath, you can use npm or include the script directly in your project.

npm install wdmath
yarn add wdmath

Usage

Complex Numbers

WdMath provides functions to work with complex numbers, including addition, subtraction, multiplication, and division.

Example:

const complex1 = { real: 1, imag: 2 };
const complex2 = { real: 3, imag: 4 };

const sum = WdMath.addComplex(complex1, complex2);
console.log(sum); // { real: 4, imag: 6 }

Geometry Calculations

Functions to calculate properties of various geometric shapes like cones, cylinders, prisms, pyramids, and spheres.

Example:

const radius = 5;
const height = 10;

const volume = WdMath.cylinderVolume(radius, height);
console.log(volume); // 785.3981633974483

Conversion Utilities

Convert between degrees and radians.

Example:

const degrees = 180;
const radians = WdMath.toRadians(degrees);
console.log(radians); // 3.141592653589793

Functions

Array Operations

  • => @param {number[]}
  • array.mean(array): Calculates the mean of a array.
  • array.median(array): Calculates the median of a array.
  • array.mode(array): Calculates the mode of a array.
  • array.standardDeviation(array): Calculates the standard deviation of a array.

Complex Numbers

  • => @param {{real: number, imag: number}}
  • complex.addComplex(complex1, complex2): Adds two complex numbers.
  • complex.subtractComplex(complex1, complex2): Subtracts two complex numbers.
  • complex.multiplyComplex(complex1, complex2): Multiplies two complex numbers.
  • complex.divideComplex(complex1, complex2): Divides two complex numbers.
  • complex.magnitudeComplex(complex): Calculates the magnitude of a complex number
  • complex.phaseComplex(complex): Calculates the phase of a complex number

Geometry Examples

  • cone.Volume(radius, height): Calculates the volume of a cone.
  • cylinder.Volume(radius, height): Calculates the volume of a cylinder.
  • prism.Volume(baseArea, height): Calculates the volume of a prism.
  • pyramid.Volume(baseArea, height): Calculates the volume of a pyramid.
  • sphere.Volume(radius): Calculates the volume of a sphere.
  • rectangularPrism.Volume(length, width, height): Calculates the volume of a rectangular prism.

Conversion

  • toRadians(degrees): Converts degrees to radians.
  • toDegrees(radians): Converts degrees to radians.

Other

  • getBearing(startLat, startLng, endLat, endLng): Calculates the bearing between two points.
  • distInKm(lat1, lng1, lat2, lng2): Calculates the distance in kilometers between two points.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes or additions.

License

This project is licensed under the MIT License.