Skip to main content

a library for reducing arctans

Project description

arctans

arctans is a library for manipulating arctans to generate Machin-like formulae and other formulae involving arctans.

Installing arctans

Installing from PyPI using pip

The latest release of arctans can be installed by running:

pip3 install arctans

Installing from source using pip

arctans can be installed by running:

pip3 install git+https://github.com/mscroggs/arctans.git

Testing arctans

To run the arctans unit tests, clone the repository and run:

python3 -m pytest test/

Using arctans

arctans can be used to represent arctans and sums of arctans symbolically and generate arctan sums equivalent to a given set of sums.

For example, Machin's formula for pi (pi = 16arctan(1/5) - 4arctan(1/239)) can be created with:

from arctans import arctan, Rational

pi = 16 * arctan(Rational(1, 5)) - 4 * arctan(Rational(1, 239))
print(pi)
print(float(pi))

Or equivalently:

from arctans import arccotan

pi = 16 * arccotan(5) - 4 * arccotan(239)
print(pi)
print(float(pi))

As arccotangents of integers commonly appear in formulae for pi, when printing formulae represented using arctans, the shorthand notation [n] will be used to represent arccotan(n).

Once a formulae is expressed, new formulae that have the same value can be generated using the generate function, for example:

from arctans import arccotan, generate

pi = 16 * arccotan(5) - 4 * arccotan(239)

formulae = generate([pi])

for f in formulae:
    print(f)

This will print a number of different arctan sum formulae, including 16*[4] + -16*[21] + -4*[239] (ie pi = 16arctan(1/4) - 16arctan(1/21) - 4arctan(1/239)).

Further documentation

More detailed documentation of the latest release version of arctans can be found on Read the Docs. A series of example uses of arctans can be found in the demo folder or viewed on Read the Docs.

Getting help

You can ask questions about using arctans by using GitHub Discussions. Bugs can be reported using the GitHub issue tracker.

Contributing to arctans

Reporting bugs and suggesting enhancements

If you find a bug in arctans and want to report it, or if you want to suggest a new feature or an improvement of a current feature, please open an issue on the issue tracker.

Submitting a pull request

If you want to directly submit code to arctans, you can do this by forking the arctans repo, then submitting a pull request. If you want to contribute, but are unsure where to start, have a look at the issues labelled "good first issue".

On opening a pull request, unit tests and ruff and mypy style checks will run. You can click on these in the pull request to see where (if anywhere) there are errors in your code.

Code of conduct

We expect all our contributors to follow the Contributor Covenant. Any unacceptable behaviour can be reported to Matthew (arctans@mscroggs.co.uk).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arctans-0.2.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arctans-0.2.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file arctans-0.2.0.tar.gz.

File metadata

  • Download URL: arctans-0.2.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arctans-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8cbf1d2488d28f768e8fb02ff8cdc11264d531456abf6eb4e9e197220626ac69
MD5 abd1681c4e8e55e6e67f99ae33c6834f
BLAKE2b-256 f2fca314c984085849a7aab1a0a9455c50d6516ec4793412d595236bd182d089

See more details on using hashes here.

Provenance

The following attestation bundles were made for arctans-0.2.0.tar.gz:

Publisher: release.yml on mscroggs/arctans

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arctans-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: arctans-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arctans-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62759f9f58601e7182cc5483e494a26a5f00f078ae61336c5a67ddfcef685c46
MD5 2bbe6c365278377d005597548a7fdabe
BLAKE2b-256 958e362479972ac85d95316086149388d5a046b4a473f01553f3308434adf861

See more details on using hashes here.

Provenance

The following attestation bundles were made for arctans-0.2.0-py3-none-any.whl:

Publisher: release.yml on mscroggs/arctans

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page