Metadata-Version: 2.5
Name: scm20368114081_math
Version: 0.7.0
Summary: Calculus, Linear Algebra, and full programming-concepts toolkit (Progress #1-#3 Final)
Project-URL: Homepage, https://pypi.org
Author-email: Alif <alifhatpradit49@gmail.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.8
Requires-Dist: gmpy2>=2.1.0
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.5.0
Requires-Dist: scipy>=1.8.0
Requires-Dist: sympy>=1.10
Description-Content-Type: text/markdown

# scm20368114081_math

แพ็กเกจ Python รวมเครื่องมือคำนวณแคลคูลัส (Calculus) และพีชคณิตเชิงเส้น
(Linear Algebra) พร้อมต่อยอดด้วยแนวคิดการเขียนโปรแกรมครบทุกหัวข้อตามเกณฑ์
โดย **ทุกหัวข้อใหม่เรียกใช้ฟังก์ชัน `calculus.py`/`linear.py` เดิมโดยตรง**

## การติดตั้ง (Installation)

```bash
pip install scm20368114081_math
```

## โครงสร้างแพ็กเกจ (ครบตามตารางเกณฑ์)

### 1. โครงสร้างข้อมูลและฟังก์ชัน (Data & Functions)
| หัวข้อ | โมดูล | เชื่อมกับงานเดิมอย่างไร |
|---|---|---|
| String Processing | `strings.py` | ดึงตัวเลขจากข้อความ ส่งเข้า `derivative_power`/`integral_power` |
| DS: List | `structures.py` | คำนวณอนุพันธ์หลายจุดเป็น list |
| DS: Tuple | `structures.py` | รูปร่างเมทริกซ์เป็น tuple, สลับแถวด้วย tuple unpacking |
| DS: Dictionary | `structures.py` | เก็บอนุพันธ์แต่ละจุดเป็น dict {x: ค่า}, นับความถี่ค่าในเมทริกซ์ |
| DS: Set | `structures.py` | ค่าบนเส้นทแยงมุม/ค่าไม่ซ้ำในเมทริกซ์ |
| Positional Args | `func_args.py` | `compute_derivative(a, n, x)` เรียก `derivative_power` ตามตำแหน่ง |
| Keyword Args | `func_args.py` | `describe_matrix(A, *, label=..., decimals=...)` เรียก `determinant` |
| Default Args | `func_args.py` | `scale_result(value, factor=2)` |
| Variable-length Args | `func_args.py` | `*args`/`**kwargs` ส่งเข้า `derivative_power`, ประกอบเมทริกซ์ |
| Recursive Function | `recursion.py` | หาดีเทอร์มิแนนต์ด้วย cofactor expansion เทียบกับ `determinant` เดิม |
| Memoization | `memoization.py` | ห่อ `integral_power` เดิมด้วย cache |

### 2. Algorithm Comparison
| โมดูล | รายละเอียด |
|---|---|
| `algorithms.py` | เทียบเวลา: สูตรดีเทอร์มิแนนต์ 2x2 มือ เทียบกับ `determinant` (NumPy) เดิม |

### 3. OOP (Class, Magic Methods, Inheritance)
| โมดูล | รายละเอียด |
|---|---|
| `oop.py` | `Matrix` ห่อฟังก์ชัน `linear.py` พร้อม magic methods, `SquareMatrix` สืบทอดจาก `Matrix`, `PowerFunction` ห่อ `calculus.py` |

### 4. การจัดการข้อมูล (I/O & Errors)
| โมดูล | รายละเอียด |
|---|---|
| `exceptions.py` | `safe_inverse_matrix` ดักจับ singular matrix จาก `inverse_matrix` เดิม |
| `fileio.py` | บันทึก/โหลดเมทริกซ์เป็น CSV/JSON |

### 5. ไลบรารีทางคณิตศาสตร์
| หัวข้อ | โมดูล | รายละเอียด |
|---|---|---|
| NumPy | `numpy_tools.py` | สถิติเพิ่มเติมจาก `linear.py` |
| Pandas | `pandas_tools.py` | เก็บผลลัพธ์อนุพันธ์/ปริพันธ์เป็นตาราง DataFrame |
| SciPy | `advanced_math.py` | อินทิเกรต/หาค่าต่ำสุดของฟังก์ชันทั่วไป ต่อยอดจาก `calculus.py` |
| SymPy | `advanced_math.py` | อนุพันธ์/ปริพันธ์/แก้สมการเชิงสัญลักษณ์ |
| GMPY2 | `advanced_math.py` | คำนวณ `derivative_power`/`integral_power` ด้วยความแม่นยำสูง |

### 6. Data Visualization
| โมดูล | รายละเอียด |
|---|---|
| `visualization.py` | **Matplotlib**: พล็อตฟังก์ชันจาก `calculus.py`, heatmap ของเมทริกซ์, กราฟเปรียบเทียบอัลกอริทึม |

### 7. Deployment
เผยแพร่แพ็กเกจขึ้น [PyPI](https://pypi.org/project/scm20368114081-math/) ด้วย `twine`:
```bash
python -m build
python -m twine upload dist/*
```

## วิธีการใช้งาน (Usage)

```python
import scm20368114081_math as pkg

A = [[4, 7], [2, 6]]

# String Processing
print(pkg.derivative_from_text("a=3, n=2, x=5"))     # -> 30

# Data Structures: List/Tuple/Dict/Set
print(pkg.matrix_shape(A))                            # -> (2, 2)
print(pkg.derivative_lookup(3, 2, [1, 2, 3]))          # -> {1: 6, 2: 12, 3: 18}
print(pkg.matrix_diagonal_set(A))                      # -> {4, 6}

# Positional / Keyword / Default / Variable-length Args
print(pkg.compute_derivative(3, 2, 5))                 # -> 30 (positional)
print(pkg.scale_result(30))                            # -> 60 (default factor=2)
print(pkg.describe_matrix(A, label="A"))               # -> keyword-only args
print(pkg.sum_derivatives(1, 2, 3, a=3, n=2))          # -> *args/**kwargs

# Recursive Function
print(pkg.determinant_recursive(A))                    # -> 10 (cofactor expansion)

# Memoization
print(pkg.integral_power_cached(2, 3, 0, 2))           # -> 8.0

# Algorithm Comparison
report = pkg.compare_determinant_algorithms(A)
print(report["results_match"])

# OOP: Class, Magic Methods, Inheritance
m1, m2 = pkg.Matrix([[1, 2], [3, 4]]), pkg.Matrix([[5, 6], [7, 8]])
print(m1 + m2)                                          # __add__ -> add_matrix เดิม
print(pkg.SquareMatrix(A).is_invertible())              # Inheritance

# Exception Handling & File I/O
try:
    pkg.safe_inverse_matrix([[1, 2], [2, 4]])
except pkg.SingularMatrixError as e:
    print(e)
pkg.save_matrix_csv(A, "matrix.csv")

# NumPy / Pandas / SciPy / SymPy / GMPY2
print(pkg.mean_std([2, 4, 4, 4, 5, 5, 7, 9]))
print(pkg.derivatives_dataframe(3, 2, [1, 2, 3]))
print(pkg.integrate_function(lambda x: x**2, 0, 1))
print(pkg.symbolic_derivative("x**3 + 2*x"))
print(pkg.derivative_power_precise(3, 100, 1.0000001))

# Data Visualization
pkg.plot_function(lambda x: x**2, filepath="function.png")
```

## เวอร์ชัน (Changelog)

- **0.3.1** (Progress #1): Calculus, Linear Algebra
- **0.4.x-0.5.0** (Progress #2-#3): เพิ่มหัวข้อทีละส่วนตามที่ปรับ
- **0.6.0**: ปรับให้ทุกหัวข้อเรียกใช้ `calculus.py`/`linear.py` เดิมโดยตรง
- **0.7.0 (Final)**: เพิ่มให้ครบทุกหัวข้อตามตารางเกณฑ์ — DS: Tuple/Dictionary,
  Positional/Keyword/Default Args, Recursive Function, Pandas, GMPY2
  (ยกเว้นหมวด Data Visualization ที่เลือกใช้ Matplotlib เพียงตัวเดียวตามที่กำหนด)
