Skip to main content

k3math

Action-CI Documentation Status Package

k3math is a toy math impl

k3math is a component of pykit3 project: a python3 toolkit set.

Install

pip install k3math

Synopsis

from k3math import Polynomial

xs = [1, 2, 3, 4]
ys = [6, 5, 7, 10]

# Fit polynomial curve with 4 points, at degree 0, 1, 2, 3:
for deg in (0, 1, 2, 3):
    poly = Polynomial.fit(xs, ys, degree=deg)
    print("y =", poly)

    # Evaluate y(5) with polynomial
    y5 = Polynomial.evaluate(poly, 5)
    print("y(5) =", y5)

    # Plot the curve and points
    lines = Polynomial.plot(
        [(poly, ".")], (-1, 6), width=30, height=10, points=list(zip(xs + [5], ys + [y5], ["X", "X", "X", "X", "*"]))
    )
    for line in lines:
        print(line)

# y = 7
# y(5) = 7.0
#                     X
#
#
#
# ...............X.........*....
#      X
#           X
# y = 3.5 + 1.4x
# y(5) = 10.5
#                              .
#                          *...
#                     X....
#                .....
#           .....X
#      X....X
# .....
# y = 8.5 - 3.6x + x²
# y(5) = 15.5
#                              .
#                             .
#                           ..
#                         .*
#                      ...
# ..               ...X
#   ...X....X....X.
# y = 12 - 9.166667x + 3.5x² - 0.333333x³
# y(5) = 12.0
#
# .                     ...*....
#  .                  X.
#   .               ..
#    .            ..
#     .         .X
#      X....X...

Author

Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Copyright and License

The MIT License (MIT)

Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Metadata

Release files for k3math 0.1.9

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

Source distribution (sdist)

Source distribution for k3math 0.1.9
File Size Uploaded Provenance
k3math-0.1.9.tar.gz 8.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 15.5 kB

Release files / k3math-0.1.9.tar.gz

Download URL k3math-0.1.9.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b7b07e216f5cd8c7b08b6285b82a506c1dd986fa4cddf54b683a80afb64a7d48
BLAKE2b-256 checksum
How to use checksums
98f581350073413302d217c20993d809f65f35353e1308193777a7a71f45da01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / k3math-0.1.9-py3-none-any.whl

Download URL k3math-0.1.9-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb0ca481b69d0a007244ecda50f721a87db66fe08edc6c65828e17889f45801a
BLAKE2b-256 checksum
How to use checksums
b92e9d0e8ff3944cfc22afa52dc5651537159861c987c4ec3bfea7d224bafd1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for k3math 0.1.9

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