calculus-algorithms
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Calculus Algorithms

This library includes various algorithms for calculus.

Currently it's in heavy development and only few are implemented.

Just wait many more algorithms are coming soon!

If you want, you can contribute too!

If you like this library don't forget to start the repository!

calculus-algorithms / Modules

calculus-algorithms

Table of contents

Modules

Module: differentiation

Functions

backwardDiff

backwardDiff(fx, x, h?): number

Remarks

This is a numerical method.

Example

backwardDiff(Math.log, 7)

backwardDiff(func1, 3, 0.0001)

const func1 = (arg0: number): number => {
  return 1 / (1 + arg0 * arg0)
}

Parameters

Name Type Default value Description
fx (arg0: number) => number undefined Function to differentiate.
x number undefined Differentiate at this given value.
h number 0.0001 Optional parameter - step size to use.

Returns

number

differentiation of given function at given value.

Defined in

differentiation/backwardDividedDifference.ts:22


centralDiff

centralDiff(fx, x, h?): number

Remarks

This is a numerical method.

Example

centralDiff(Math.log, 7)

centralDiff(func1, 3, 0.0001)

const func1 = (arg0: number): number => {
  return 1 / (1 + arg0 * arg0)
}

Parameters

Name Type Default value Description
fx (arg0: number) => number undefined Function to differentiate.
x number undefined Differentiate at this given value.
h number 0.0002 Optional parameter - step size to use.

Returns

number

differentiation of given function at given value.

Defined in

differentiation/centralDividedDifference.ts:22


differentiate

differentiate(expression): string

Remarks

This is a not a numerical method.

Example

diff("4x^3 - 3x^1 + 2x^2")

Parameters

Name Type Description
expression string Expression to differentiate.

Returns

string

differentiation of given expression.

Defined in

differentiation/differentiate.ts:48


forwardDiff

forwardDiff(fx, x, h?): number

Remarks

This is a numerical method.

Example

forwardDiff(Math.log, 7)

forwardDiff(func1, 3, 0.0001)

const func1 = (arg0: number): number => {
  return 1 / (1 + arg0 * arg0)
}

Parameters

Name Type Default value Description
fx (arg0: number) => number undefined Function to differentiate.
x number undefined Differentiate at this given value.
h number 0.0001 Optional parameter - step size to use.

Returns

number

differentiation of given function at given value.

Defined in

differentiation/forwardDividedDifference.ts:22


Module: integration

Functions

simpsonOneThird

simpsonOneThird(func, lowerLimit, upperLimit): number

Example

simpsonOneThird(Math.log, 4, 5.2)

simpsonOneThird(func1, 0, 1)

const func1 = (arg0: number): number => {
  return 1 / (1 + arg0 * arg0)
}

Parameters

Name Type Description
func (arg0: number) => number Function to integrate
lowerLimit number Lower limit to integrate within.
upperLimit number Upper limit to integrate within.

Returns

number

integration of given function within given limits.

Defined in

integration/simpsonOneThird.ts:19


simpsonThreeEighth

simpsonThreeEighth(func, lowerLimit, upperLimit): number

Example

simpsonThreeEighth(Math.log, 4, 5.2)

simpsonThreeEighth(func1, 0, 1)

const func1 = (arg0: number): number => {
  return 1 / (1 + arg0 * arg0)
}

Parameters

Name Type Description
func (arg0: number) => number Function to integrate
lowerLimit number Lower limit to integrate within.
upperLimit number Upper limit to integrate within.

Returns

number

integration of given function within given limits.

Defined in

integration/simpsonThreeEighth.ts:19


trapezoidalRule

trapezoidalRule(func, lowerLimit, upperLimit): number

Example

trapezoidalRule(Math.log, 4, 5.2)

trapezoidalRule(func1, 0, 1)

const func1 = (arg0: number): number => {
  return 1 / (1 + arg0 * arg0)
}

Parameters

Name Type Description
func (arg0: number) => number Function to integrate
lowerLimit number Lower limit to integrate within.
upperLimit number Upper limit to integrate within.

Returns

number

integration of given function within given limits.

Defined in

integration/trapezoidal.ts:19


Package Sidebar

Install

npm i calculus-algorithms

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

38.2 kB

Total Files

66

Last publish

Collaborators

  • rohitsingh107