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.8

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.8
File Size Uploaded Provenance
k3math-0.1.8.tar.gz 7.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 15.2 kB

Release files / k3math-0.1.8.tar.gz

Download URL k3math-0.1.8.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6cdb2caf6e1d39ba6a6315bcbb4e8736eebd81a79929a0c2396b67d28d2cd43b
BLAKE2b-256 checksum
How to use checksums
b4d712a5863c43089f711052367a4bc3d3187e73f23a653a425d07370b8c4a30
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.8-py3-none-any.whl

Download URL k3math-0.1.8-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f50a9f5c99ae2abc504cbd4d0c98c274b3c67adb102e446c1a138e091196bd8
BLAKE2b-256 checksum
How to use checksums
1a3d4e757725ff7b513fe74bc01406281f18ea8fa621ab371236ff1e8b55e7ca
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.8

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