Skip to main content
  • Version 1.0.6

  • Python 3.7+ module to calculate riemann sum area under a curve

  • Copyright 2019 Steven Mycynek

  • Supports

    • simpson, trapezoid, and midpoint algorithms,

    • n-degree single variable polynomials, including fractional exponents,

    • variable step size

  • https://pypi.python.org/pypi/area-under-curve

USAGE = """ -p|--poly {DegreeN1:CoefficientM1, DegreeN2:CoefficientM2, ...}... -l|--lower <lower_bound> -u|--upper <upper_bound> -s|--step <step> -a|--algorithm <simpson | trapezoid | midpoint>

  • This was just a fun experiment I did on a couple airplane rides and might not be suitable for production use.
  • Try a simple function you can integrate by hand easily, like f(x) = x^3 from [0-10], and compare that to how accurate the midpoint, trapezoid, and simpson approximations are with various steps sizes.

  • Why not use numpy? You probably should, but I wanted to do everything from scratch for fun.

examples:

python3 area_under_curve.py --polynomial {3:1} --lower 0 --upper 10 --step .1 --algorithm simpson

or:

import area_under_curve as auc

algorithm = auc.get_algorithm("simpson")

bounds = auc.Bounds(0, 10, .1)

polynomial = auc.Polynomial({3:1})

params = auc.Parameters(polynomial, bounds, algorithm)

AREA = auc.area_under_curve(params.polynomial, params.bounds, params.algorithm)

print(str(AREA))

Also try out unit_test.py and demo.py.

Use poetry install and poetry shell for a python3 environment with dev dependencies.

Metadata

Release files for area-under-curve 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for area-under-curve 1.0.6
File Size Uploaded
area_under_curve-1.0.6.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for area-under-curve 1.0.6
File Interpreter ABI Platform
area_under_curve-1.0.6-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 14.3 kB

Release files / area_under_curve-1.0.6.tar.gz

Download URL area_under_curve-1.0.6.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3a036fe9d60a6c435fed59b6179be793baeaee07445288b409ac4d4d2aeec2a6
BLAKE2b-256 checksum
How to use checksums
5f42184ad67cf2d547ca7de350af1be4836d8f3a5c87855228cd2b0bea0657bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

Release files / area_under_curve-1.0.6-py2.py3-none-any.whl

Download URL area_under_curve-1.0.6-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0940724f01d92d88a36f55bdb87dfd454be0f8be15e425e170a3f6b2f8f9eb0e
BLAKE2b-256 checksum
How to use checksums
13f90424cf3612f1c5190054a310855a431c83177a2c67056b3d85526d6b6191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page