Skip to content

jylopez/partial-geometric-series

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

partial-geometric-series npm version

Returns the partial sum of the geometric sequence. i.e. 1 + r + r^2 + r^3 + ... + r^n

Install

npm install partial-geometric-series

Usage

/*
Return the partial sum of a geomtric series
*/

var p = require('partial-geometric-series');
var ratio = 0.3 // Must be <1 for convergence
var nth = 5 // nth partial sum

console.log( 'Partial Sum:', p(ratio, nth) ) // Partial Sum: 1.42753
console.log( 'Infinite Sum:', 1/(1-0.3)) // Infinite Sum: 1.4285714285714286

API

partial-geometric-series(ratio, nth partial sum)

License

MIT

About

🐊 Returns partial sum of geometric series

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published