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

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

Built distribution (wheel)

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

Total release size: 15.2 kB

Release files / k3math-0.1.7.tar.gz

Download URL k3math-0.1.7.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
14bcb3119243e355efe55c63756c8f41efe65809be1675e9b2de7669cb332180
BLAKE2b-256 checksum
How to use checksums
4ba0f35213d60b307c8ba615f479d51ac55e57466cc39d3a0ade83546fb71549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

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

Download URL k3math-0.1.7-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbba688e1ecbf8b508a411069f044e096b7891761910f4653141f8219d087c13
BLAKE2b-256 checksum
How to use checksums
6bc5f1bbeae37d894f577f85fbaa351fbf9fb61901b4a4ae0fa8cc5ae25f2b84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for k3math 0.1.7

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