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.2.tar.gz (13.5 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.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: arctans-0.2.2.tar.gz
  • Upload date:
  • Size: 13.5 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.2.tar.gz
Algorithm Hash digest
SHA256 1c2cd8f319c5b47cf879ee2939721a706f1faafb811b383113a336b6ac96dd52
MD5 b37971e445c7b21f22db6469af77a943
BLAKE2b-256 723bacf7b370c5dd222d3c0f4e05ac15bd696e089226ce66b8c3aef3ea11fcd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for arctans-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: arctans-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef3ecb667c2c39f0a060c08f1b081e0cc378f417b01262cd5acdb3f87406a8d9
MD5 e3a217c0331985947d818c1cfbc3340f
BLAKE2b-256 bcf68de439cbfbee38d139c6f87e8ca96f900082c9cd3e6a0d6ec6e13a365798

See more details on using hashes here.

Provenance

The following attestation bundles were made for arctans-0.2.2-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