Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@santi100a/quadratic-function

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@santi100a/quadratic-function

Santi's Quadratic Function Toolkit: A simple library for common tasks regarding quadratic functions.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Santi's Quadratic Function Toolkit

Build Status npm homepage GitHub stars License Bundlephobia stats

  • 🚀 Lightweight and fast
  • 👴 ES3-compliant
  • 💻 Portable between the browser and Node.js

What's this?

This is a small library that allows you to calculate things like the vertex or roots of a quadratic function. Quadratic equations can be solved using the latter.

Installation

  • Via NPM: npm install @santi100a/quadratic-function
  • Via Yarn: yarn add @santi100a/quadratic-function
  • Via PNPM: pnpm install @santi100a/quadratic-function

API

  • QuadraticFunction.vertex(): { x: number, y: number }; Returns an object containing the coordinates of the highest or lowest point the function will reach.
  • QuadraticFunction.roots(): [number?, number?]; Calculates the real roots of the QuadraticFunction.
  • QuadraticFunction.evaluate(x: number): number; Evaluates the QuadraticFunction at x.
    NameTypeDescriptionOptional?Default
    xnumberThe value at which to evaluate the function.YesN/A

Usage

import QuadraticFunction = require('@santi100a/quadratic-function'); // TypeScript
const QuadraticFunction = require('@santi100a/quadratic-function'); // CommonJS
import QuadraticFunction from '@santi100a/quadratic-function'; // ESM

const fn = new QuadraticFunction(1, -1, -1);
fn.evaluate(12); // => 131
fn.evaluate(0); // => -1
fn.vertex(); // => { x: 0.5, y: -1.25 }
fn.roots(); // => [ (1 + sqrt(5)) / 2, (1 - sqrt(5)) / 2 ]

Contribute

Wanna contribute? File an issue or pull request! Look at the contribution instructions and make sure you follow the contribution Code of Conduct.

Keywords

FAQs

Package last updated on 16 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc