Skip to main content

Python quartic equation solver for exact values

A Python module for the exact solutions of a quartic equation: a x^4 + b x^3 + c x^2 + d x + e = 0

Usage

Calculate quartic solution

The solutions are four symexpress3 objects: x1Optimized, x2Optimized, x3Optimized, x4Optimized

>>> import quarticequation
>>> objQuartic = quarticequation.QuarticEquation()
>>> objQuartic.a = "1"
>>> objQuartic.b = "2"
>>> objQuartic.c = "3"
>>> objQuartic.d = "4"
>>> objQuartic.e = "5"
>>> objQuartic.calcSolutions()
>>> print( f"x1: {objQuartic.x1Optimized}\nx2: {objQuartic.x2Optimized}\nx3: {objQuartic.x3Optimized}\nx4: {objQuartic.x4Optimized}\n" )
x1: (-1/2) + ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(1/2) * (-1/2) + (1/2) * ((-2) + ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(-1/2) * 4 +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) * (-1) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ))^^(1/2)
x2: (-1/2) + ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(1/2) * (-1/2) + ((-2) + ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(-1/2) * 4 +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) * (-1) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ))^^(1/2) * (-1/2)
x3: (-1/2) + (1/2) * ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(1/2) + (1/2) * ((-2) + (-4) * ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(-1/2) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) * (-1) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ))^^(1/2)
x4: (-1/2) + (1/2) * ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(1/2) + ((-2) + (-4) * ((-1) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ) * (-1))^^(-1/2) +  cos( (1/3) *  atan( (1/2) ) ) * 15^^(1/2) * (-1) + 5^^(1/2) *  sin( (1/3) *  atan( (1/2) ) ))^^(1/2) * (-1/2)```

Numeric input values

The parameters may be real numbers or symexpress3 strings

>>> import quarticequation
>>> objQuartic = quarticequation.QuarticEquation()
>>> objQuartic.a = 1.0
>>> objQuartic.b = -28
>>> objQuartic.c = "200 + 66"
>>> objQuartic.d = "-1028"
>>> objQuartic.e = "2730 / 2"
>>> objQuartic.calcSolutions()
>>> print( f"x1: {objQuartic.x1Optimized}\nx2: {objQuartic.x2Optimized}\nx3: {objQuartic.x3Optimized}\nx4: {objQuartic.x4Optimized}\n" )
x1: 5
x2: 3
x3: 13
x4: 7

Calculate real values

>>> import quarticequation
>>> objQuartic = quarticequation.QuarticEquation()
>>> objQuartic.a = 1
>>> objQuartic.b = 2
>>> objQuartic.c = 3
>>> objQuartic.d = 4
>>> objQuartic.e = 5
>>> objQuartic.calcSolutions()
>>> print( f"x1: {objQuartic.x1Value}\nx2: {objQuartic.x2Value}\nx3: {objQuartic.x3Value}\nx4: {objQuartic.x4Value}\n" )
x1: (-1.287815479557648+0.8578967583284903j)
x2: (-1.287815479557648-0.8578967583284903j)
x3: (0.2878154795576482+1.4160930801719078j)
x4: (0.28781547955764797-1.4160930801719078j)

Command line

python -m quarticequation

  • Help: python -m quarticequation -h
  • Quartic solution: python -m quarticequation 1 2 3 4 5

Graphical user interface

https://github.com/SWVandenEnden/websym3

Metadata

Release files for quarticequation 0.0.5

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

Source distribution (sdist)

Source distribution for quarticequation 0.0.5
File Size Uploaded Provenance Actions
quarticequation-0.0.5.tar.gz 27.9 kB Without provenance Details for quarticequation-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quarticequation 0.0.5
File Interpreter ABI Platform Actions
quarticequation-0.0.5-py3-none-any.whl Python 3 none any Details for quarticequation-0.0.5-py3-none-any.whl

Total release size: 49.5 kB

Release files / quarticequation-0.0.5.tar.gz

Download URL quarticequation-0.0.5.tar.gz
Size 27.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d24214c73af2e9c654974248c9dd998b4bc0c71150ecec3f2aa122bb8d6dca46
BLAKE2b-256 checksum
How to use checksums
b2a285d11eb04fe878266c715a05e29c1db7e30d85aa1ffc82edeb10b26d7ba6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / quarticequation-0.0.5-py3-none-any.whl

Download URL quarticequation-0.0.5-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e36b92deb331b89cb4ea39e8715ff4aa3a88fc03c71e89a301773033d334f566
BLAKE2b-256 checksum
How to use checksums
9f7a59356c991ab2901c1e40194cf597a5658292f5ce9980cb977a4246c58f0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for quarticequation 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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