Skip to main content

Simplify radicals.

Project description


Simplify radicals.

Simplifies a radical into a multiple of the square root of a prime number. Based on the popular SIMPRAD for TI-BASIC of unknown author. Supports negative numbers and arbitrary roots.

When the input is a nonnegative number, the output will be a Tuple of two real numbersߞthe coefficient and the radicand.
When the input is a negative number, the output will be a Tuple of a complex coefficient and a real radicand.

Use simprad as a module:

from simprad import simprad

print(simprad(50))    # (5, 2)
print(simprad(36))    # (6, 1)
print(simprad(-50))   # (5j, 2)
print(simprad(8, 3))  # (2, 1)

Use simprad as a command line utility:

$ python -m simprad
Radical to simplify: √50
Root [2]: 2
5 × √2

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

simprad-1.0.7.tar.gz (2.4 kB view hashes)

Uploaded source

Built Distribution

simprad-1.0.7-py3-none-any.whl (3.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page