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

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

Built distribution (wheel)

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

Total release size: 16.8 kB

Release files / k3math-0.1.10.tar.gz

Download URL k3math-0.1.10.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
34eaad71b579a54604a1c9fd24938980a4c56f4148f02094ad7a98298f314730
BLAKE2b-256 checksum
How to use checksums
077a48b214edc23e8bd6dfd857738e2525dad1e2677f1dd770cca988369269c8
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.10-py3-none-any.whl

Download URL k3math-0.1.10-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2eafa1c6c1bccb4fa8e698659131be00962d22103d2a27bc7b72c248dded73eb
BLAKE2b-256 checksum
How to use checksums
db3ab87b01b48668622c7ab2a34042aba576f804f1aa810b0f9b4d072847ecb0
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.10

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