Skip to main content

Polyno

Polynomial object (class)

Installation

pip install polyno

Import Poly object

from polyno import Poly

Set P1 and P2 for the examples below

The parameter of Poly object is 
a vector of coefficients in descending 
according to the degrees order 
or a dictionnary {degree:coef}
>>> P1 = Poly([3, 1, 0])
>>> P2 = Poly({0:5, 3:2})
>>> P2.coefficients()
[5.0, 0, 0, 2.0]
>>> 

Print polynomial

>>> P1.toString()
'3x^2 + x'
>>> print(P1)
3x^2 + x
>>> print(P2)
2x^3 + 5
>>> 

Addition (with Poly and scalar)

>>> P1 + P2
2x^3 + 3x^2 + x + 5
>>>
>>> P1 + 2
3x^2 + x + 2
>>>

Substraction (with Poly and scalar)

>>> P1 - P2
-2x^3 + 3x^2 + x - 5
>>> P2 - P1
2x^3 - 3x^2 - x + 5
>>> P1 - 2
3x^2 + x - 2
>>>

Multiplication with scalar

>>> P1 * -2
-6x^2 - 2x
>>> P2 * 3
6x^3 + 15
>>> 

Multiplication with Poly

>>> P1 * P2
6x^5 + 2x^4 + 15x^2 + 5x
>>> 

Division with scalar

>>> P2/2
x^3 + 2.5
>>> 

Derivative

>>> P1.derivative()
6x + 1
>>> 

k_th order Derivative

>>> print(P2.derivative()) 	# first order
6x^2
>>> print(P2.derivative(2)) # second order
12x
>>> print(P2.derivative(3)) # third order
12
>>>

Other methods

eval: value of P(x)
integral: polynomial integral from a to b
zero: solution of P(x) = 0 for x in [a, b] interval

Eval

>>> P1.eval(2)
14

Integral

>>> # integeral of P2 from 1 to 3
>>> P2.integral(1, 3)
50

Zero

f(x) = 0 ==> x ?

>>> # solution of P(x) = 0 ?
>>> P = Poly({2:-1, 1:-1, 0:1})
>>> P.zero(0, 10)
0.6180338561534882
>>> P.zero(-3, 0)
-1.6180343627929688
>>> 
>>> P.zero(3, 6) # no solution
>>> P.zero(-3, 3) # two solution, 
>>> # but nothing is returned 
>>> # because of dichotomy (binary search) algorithm

Futures

Release files for polyno 1.2.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 polyno 1.2.5
File Size Uploaded
polyno-1.2.5.tar.gz 5.5 kB Details

Built distribution (wheel)

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

Total release size: 11.2 kB

Release files / polyno-1.2.5.tar.gz

Download URL polyno-1.2.5.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3dc6178ec57de92df958a26fa57f38b3706908209146dda656f6b5fe31e8b7f5
BLAKE2b-256 checksum
How to use checksums
6252173993095613e71da3bce59982f574a105dc5fd7624b122d65309eba73a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / polyno-1.2.5-py3-none-any.whl

Download URL polyno-1.2.5-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f8071808705d969a63701f4fb967ba0c988a3ef5673e062b97e27b324275a59
BLAKE2b-256 checksum
How to use checksums
c0bfa0aeb48db2b25cfd9c5aff3a4682b61f8b550a3de93c2b7bd9cc2fe5366c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.2.5 This release

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.1.2

2 release files

1.0.2

2 release files

0.0.2

2 release files

0.0.1

2 release files

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