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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arctans-1.0.0.tar.gz.
File metadata
- Download URL: arctans-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592fa1ebd802a2d1c7c194e6001f9ffc4695693bb10f697da38b3d6515052971
|
|
| MD5 |
728a27f144cdcb907550db4d2646112d
|
|
| BLAKE2b-256 |
5474e21aa6534d472a17cde7132be60e6d56a37da31cd76d0fcaf9499df4a5f6
|
Provenance
The following attestation bundles were made for arctans-1.0.0.tar.gz:
Publisher:
release.yml on mscroggs/arctans
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arctans-1.0.0.tar.gz -
Subject digest:
592fa1ebd802a2d1c7c194e6001f9ffc4695693bb10f697da38b3d6515052971 - Sigstore transparency entry: 767494228
- Sigstore integration time:
-
Permalink:
mscroggs/arctans@27fbbe6df316c02269f46c95db3a54c896f04052 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mscroggs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@27fbbe6df316c02269f46c95db3a54c896f04052 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arctans-1.0.0-py3-none-any.whl.
File metadata
- Download URL: arctans-1.0.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1eeab8e5f264c9669ee858a3e90cb4f7a0c1b4776e29776c5f77cde0b5d444a4
|
|
| MD5 |
902a5c3ecb29244dbd138d171f081eea
|
|
| BLAKE2b-256 |
72770c15db4ae23d1ed4d17f15c42a476a4df4df368bdc6c0df172b559108c10
|
Provenance
The following attestation bundles were made for arctans-1.0.0-py3-none-any.whl:
Publisher:
release.yml on mscroggs/arctans
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arctans-1.0.0-py3-none-any.whl -
Subject digest:
1eeab8e5f264c9669ee858a3e90cb4f7a0c1b4776e29776c5f77cde0b5d444a4 - Sigstore transparency entry: 767494229
- Sigstore integration time:
-
Permalink:
mscroggs/arctans@27fbbe6df316c02269f46c95db3a54c896f04052 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mscroggs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@27fbbe6df316c02269f46c95db3a54c896f04052 -
Trigger Event:
push
-
Statement type: