Skip to main content

math_stats_raibeena


คำอธิบาย

Python Package สำหรับการคำนวณเมทริกซ์และสถิติพื้นฐาน

Description

แพ็กเกจนี้พัฒนาขึ้นเพื่อใช้ในการคำนวณ ตรวจสอบ และวิเคราะห์ทางคณิตศาสตร์เกี่ยวกับเมทริกซ์ เวกเตอร์ และสถิติพื้นฐานเชิงลึก รองรับการประมวลผลเชิงวัตถุ (OOP), การส่งออกข้อมูล (File I/O) และการวิเคราะห์ข้อมูลทางสถิติ ประกอบด้วย 2 โมดูลหลัก:

  • matrix : คำนวณทางพีชคณิตเชิงเส้น (Linear Algebra) รองรับการบวกเวกเตอร์ (vector_add), การดอตผลิตภัณฑ์ (dot_product), การทรานสโพสเมทริกซ์ (matrix_transpose), การหาผลรวมแนวทแยง (matrix_trace) และการคำนวณดีเทอร์มิแนนต์ของเมทริกซ์ขนาด 2x2 (det_2x2)
  • statistic : วิเคราะห์และคำนวณค่าทางสถิติพื้นฐาน รองรับการหาค่าเฉลี่ยเลขคณิต (mean), ค่าความแปรปรวน (variance), ส่วนเบี่ยงเบนมาตรฐาน (std_dev), การแปลงเป็นค่ามาตรฐาน (z_score) และการคำนวณค่าความแปรปรวนร่วมระหว่างสองตัวแปร (covariance)

Algorithm

The math_stats_raibeena package is a Python library designed for computing, validating, and analyzing mathematical and statistical data. The package is structured into two core modules—matrix and statistic—covering seven technical domains:


Module 1: matrix

Focuses on linear algebra, vector operations, advanced OOP inheritance, and spatial visualizations.

  • Vector & Matrix Operations: Performs core linear algebra calculations, vector norms, orthogonal checks, and matrix transformations.
  • Object-Oriented Programming (OOP):
    • Classes & Operators: Custom Vector classes with operator overloading (__add__).
    • Inheritance Models: Features Single (Vector2D), Hierarchical (Vector3D), Multilevel (UnitVector2D), Multiple (DescribableVector2D), and Mixin (Describable) patterns.
  • Algorithms: Implements recursive functions for linear algebra problems (determinant_recursive).
  • Scientific Integration & Visualization:
    • NumPy: High-performance matrix multiplications (matrix_multiply_numpy).
    • Visualization: 2D spatial vector plots via Matplotlib (plot_vector_2d) and 3D vector fields via PyVista (plot_vectors_3d_pyvista).

Module 2: statistic

Focuses on statistical analysis, data processing, file I/O, error handling, and interactive data visualization.

  • Data Structures & Functions:
    • Formatting & Structures: String/currency formatting (format_currency) and structural summaries across Lists, Tuples, Dictionaries, and Sets (summarize_data_structures).
    • Function Arguments: Flexible parameter wrappers using Positional, Keyword, Default, and *args/**kwargs (calculate_total_stats).
  • Algorithms & Benchmarking:
    • Recursion & Dynamic Programming: Combinatorics (factorial_recursive) and memoization (fibonacci_memoized).
    • Benchmarking: Execution speed comparisons across statistical routines (compare_statistic_algorithms).
  • Data Management (I/O & Errors):
    • File I/O: Serializes and loads statistical summaries via JSON (save_summary_json, load_summary_json).
    • Exception Handling: Custom exceptions (InvalidDataError) and defensive execution wrappers (safe_mean).
  • Scientific Libraries Integration:
    • Pandas & SciPy: Tabular DataFrames (create_summary_dataframe) and probability density fitting (fit_normal_scipy).
    • SymPy & Advanced Engines: Symbolic equation solvers (solve_symbolic_system) and high-precision engines (SageMath / PARI-GP / GMPY2).
  • Data Visualization:
    • Statistical & Interactive Charts: Distribution plots via Seaborn (plot_distribution_seaborn) and interactive scatter plots via Plotly (plot_interactive_scatter_plotly).
    • Network Graphs: Matrix-based network graph visualizations via NetworkX (plot_matrix_graph).


การใช้งาน

การติดตั้ง(Installation) You can install package from Pypi :

pip install math-stats-raibeena

PACKAGE

import math_stats_raibeena as pkg

# Module 1: matrices

print(pkg.vector_add([1, 2], [3, 4]))                                  # output: [4, 6]
print(pkg.scalar_multiply(2, [1, 2, 3]))                               # output: [2, 4, 6]
print(pkg.dot_product([1, 2, 3], [4, 5, 6]))                           # output: 32
print(pkg.vector_norm([3, 4]))                                         # output: 5.0
print(pkg.matrix_rank([[1, 2], [2, 4]]))                               # output: 1
print(pkg.is_linearly_independent([[1, 0], [0, 1]]))                   # output: True
print(pkg.is_orthogonal([1, 0], [0, 1]))                               # output: True

# --- Recursive function ---
print(pkg.determinant_recursive([[6, 1, 1], [4, -2, 5], [2, 8, 7]]))   # output: -306

# --- OOP: Class, Magic methods, Inheritance ---
v1, v2 = pkg.Vector([1, 2, 3]), pkg.Vector([4, 5, 6])
print(v1 + v2)                                                         # output: Vector([5, 7, 9])

v2d = pkg.Vector2D(3, 4)
print(v2d.norm())                                                      # output: 5.0

v3d = pkg.Vector3D(1, 2, 3)                                            # hierarchical inheritance
print(v3d)                                                             # output: Vector([1, 2, 3])

uv = pkg.UnitVector2D(3, 4)                                            # multilevel inheritance
print(uv.is_unit())                                                    # output: True

dv = pkg.DescribableVector2D(1, 1)                                     # multiple inheritance
print(dv.describe())                                                   # output: เวกเตอร์ 2 มิติ: [1, 1]

duv = pkg.DescribableUnitVector2D(3, 4)                                # hybrid inheritance
print(duv.is_unit(), duv.describe())

class MyVector(pkg.Vector, pkg.Describable):
    pass

mv = MyVector([1, 2])
print(mv.describe())                                                   # output: เวกเตอร์ 2 มิติ: [1, 2]

# --- Numpy ---
print(pkg.matrix_multiply_numpy([[1, 2], [3, 4]], [[5, 6], [7, 8]]))   # output: [[19, 22], [43, 50]]

# --- Data Visualization: Matplotlib, PyVista ---
pkg.plot_vector_2d([3, 4], "vector.png")
pkg.plot_vectors_3d_pyvista([[1, 0, 0], [0, 1, 0]], "vectors3d.png")   # needs pyvista installed
import pyvista as pv


# ==============================================================================

# Module 2: statistic
import sys
sys.stdout.reconfigure(encoding='utf-8')

print(pkg.mean([10, 20, 30, 40, 50]))                                  # output: 30.0
print(pkg.median([10, 20, 30, 40, 50]))                                # output: 30.0
print(pkg.mode([10, 20, 20, 30, 40]))                                  # output: [20]
print(pkg.variance([10, 20, 30, 40, 50]))                              # output: 250.0
print(pkg.std_dev([10, 20, 30, 40, 50]))                               # output: 15.811388300841896
print(pkg.z_score(45, [10, 20, 30, 40, 50]))                           # output: 0.9486832980505138

# --- String Processing ---
print(pkg.format_currency(1234.5))                                     # output: ฿1,234.50

# --- Exception Handling ---
try:
    raise pkg.InvalidDataError("ชุดข้อมูลต้องไม่เป็นค่าว่าง")
except pkg.InvalidDataError as e:
    print(e)                                                           # output: ชุดข้อมูลต้องไม่เป็นค่าว่าง

print(pkg.safe_mean([]))                                               # prints an error message, returns None

# --- Data Structures: dict, tuple, set, list ---
holdings = {"A": [10, 20], "B": [30, 40]}
summary = pkg.summarize_data_structures(holdings)
print(summary)                                                         # output: {'unique_set': {10, 20, 30, 40}, ...}

# --- Function Arguments: Positional, Keyword, Default, Variable-length ---
print(pkg.calculate_total_stats(10, 20, 30, scale=2.0, extra_bonus=5))

# --- Pandas ---
print(pkg.create_summary_dataframe(holdings))

# --- SciPy ---
print(pkg.fit_normal_scipy([1, 2, 3, 4, 5]))                           # output: (3.0, 1.4142135623730951)

# --- SymPy ---
print(pkg.solve_symbolic_system(["x + y - 5", "x - y - 1"], ["x", "y"])) # output: {x: 3, y: 2}

# --- File I/O ---
pkg.save_summary_json({"mean": 30.0}, "summary.json")
print(pkg.load_summary_json("summary.json"))                           # output: {'mean': 30.0}

# --- Data Visualization: Matplotlib, Seaborn ---
pkg.plot_distribution_seaborn([10, 20, 20, 30, 40, 50], "trend.png")

# --- Data Visualization: Plotly & NetworkX ---
pkg.plot_interactive_scatter_plotly([1, 2, 3], [4, 5, 6])              # needs plotly installed
pkg.plot_matrix_graph([[0, 1], [1, 0]], "graph.png")

# --- Recursive function ---
print(pkg.factorial_recursive(5))                                      # output: 120

# --- Recursive function with memoization ---
print(pkg.fibonacci_memoized(30))                                      # output: 832040

# --- Algorithm Comparison ---
print(pkg.compare_statistic_algorithms([10, 20, 30, 40, 50]))

Metadata

Release files for math-stats-raibeena 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 math-stats-raibeena 0.1.8
File Size Uploaded Provenance
math_stats_raibeena-0.1.8.tar.gz 70.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 81.5 kB

Release files / math_stats_raibeena-0.1.8.tar.gz

Download URL math_stats_raibeena-0.1.8.tar.gz
Size 70.3 kB
Tags Source
SHA-256 checksum
How to use checksums
39f9cbe4137ba5a5971835594e64dc3662636f9d42cdd54033516c63ac9c5379
BLAKE2b-256 checksum
How to use checksums
2f9eddbd8de8a2b258586960060fb621cf6381c4b88885a9ccc493f4b8f2a31a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / math_stats_raibeena-0.1.8-py3-none-any.whl

Download URL math_stats_raibeena-0.1.8-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d52c221e1ff7e24d9133ccb3202b74b9e3f2ef30a05b70f0422a672c48aaa78
BLAKE2b-256 checksum
How to use checksums
3d08cb0d87dc32f22d684b462409f1031341a6bac072ea76d1e2b2742f2e1c20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for math-stats-raibeena 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