Metadata-Version: 2.5
Name: math4u
Version: 0.2.2
Summary: Python Package สำหรับการคำนวณและเครื่องมือทางคณิตศาสตร์
Project-URL: Homepage, https://github.com/username/my_package
Project-URL: Documentation, https://github.com/username/my_package#readme
Project-URL: Repository, https://github.com/username/my_package.git
Project-URL: Bug Tracker, https://github.com/username/my_package/issues
Author-email: Bunyasak Rakjing <boonyasuk1213@gmail.com>
License: MIT
License-File: LICENSE
Keywords: calculus,linear-algebra,mathematics,numpy,scipy,sympy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Requires-Dist: matplotlib
Requires-Dist: networkx
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: sympy
Description-Content-Type: text/markdown

# math4u

Python Package สำหรับการคำนวณ Calculus, Linear Algebra และเครื่องมือทางคณิตศาสตร์

## การใช้งาน

```python
import math4u

# =========================
# Calculus
# =========================

# 1. Derivative
print(math4u.derivative("x**3 + 2*x"))
# 3*x**2 + 2

# 2. Second Derivative
print(math4u.second_derivative("x**3 + 2*x"))
# 6*x

# 3. Indefinite Integral
print(math4u.integrate("x**2 + 2*x"))
# x**3/3 + x**2

# 4. Definite Integral
print(math4u.definite_integral("x**2", 0, 2))
# 8/3

# 5. Limit
print(math4u.limit("sin(x)/x", point=0))
# 1

# 6. Taylor Series
print(math4u.taylor_series("exp(x)", point=0, order=5))
# x**4/24 + x**3/6 + x**2/2 + x + 1


# =========================
# Linear Algebra
# =========================

A = [[1, 2], [3, 4]]
B = [[5, 6], [7, 8]]

# 1. Matrix Addition
print(math4u.matrix_add(A, B))
# Matrix([[6, 8], [10, 12]])

# 2. Matrix Multiplication
print(math4u.matrix_multiply(A, B))
# Matrix([[19, 22], [43, 50]])

# 3. Determinant
print(math4u.determinant(A))
# -2

# 4. Inverse Matrix
print(math4u.inverse_matrix(A))
# Matrix([[-2, 1], [3/2, -1/2]])

# 5. Transpose
print(math4u.transpose(A))
# Matrix([[1, 3], [2, 4]])

# 6. Solve Linear System
print(math4u.solve_linear_system(
    [[2, 1], [1, -1]],
    [5, 1]
))
# (2, 1)


# =========================
# String Processing
# =========================

# 1. Reverse String
print(math4u.reverse_string("Hello"))
# olleH

# 2. Count Words
print(math4u.count_words("Hello Python World"))
# 3

# 3. Count Characters
print(math4u.count_characters("Hello"))
# 5

# 4. Uppercase
print(math4u.to_uppercase("hello"))
# HELLO

# 5. Lowercase
print(math4u.to_lowercase("HELLO"))
# hello

# 6. Remove Spaces
print(math4u.remove_spaces("Hello World"))
# HelloWorld


# =========================
# Data Structures
# =========================

# List
print(math4u.list_operations([10, 20, 30]))

# Tuple
print(math4u.tuple_operations((1, 2, 3)))

# Dictionary Keys
print(math4u.dictionary_keys({
    "a": 1,
    "b": 2
}))

# Dictionary Values
print(math4u.dictionary_values({
    "a": 1,
    "b": 2
}))

# Set Union
print(math4u.set_union({1, 2}, {2, 3}))

# Set Intersection
print(math4u.set_intersection({1, 2}, {2, 3}))


# =========================
# Recursive Functions
# =========================

# Factorial
print(math4u.factorial(5))
# 120

# Fibonacci
print(math4u.fibonacci(6))
# 8

# Power
print(math4u.power_recursive(2, 5))
# 32

# Recursive Sum
print(math4u.sum_recursive([1, 2, 3, 4]))
# 10

# Greatest Common Divisor
print(math4u.gcd_recursive(48, 18))
# 6


# =========================
# Recursive Function with Memoization
# =========================

print(math4u.fibonacci_memo(10))
# 55


# =========================
# Object-Oriented Programming
# =========================

# Calculator
calc = math4u.Calculator(10)
print(calc.add(5))
# 15

# Single Inheritance
scientific = math4u.ScientificCalculator(4)
print(scientific.square())
# 16

# Multiple Inheritance
advanced = math4u.AdvancedCalculator(3)
print(advanced.cube())
# 27

# Multilevel Inheritance
special = math4u.SpecialCalculator(2)
print(special.fourth_power())
# 16

# Hierarchical Inheritance
basic = math4u.BasicCalculator(5)
print(basic.double())
# 10

# Hybrid Inheritance
hybrid = math4u.HybridCalculator(2)
print(hybrid.fifth_power())
# 32


# =========================
# Exception Handling
# =========================

# Safe Division
print(math4u.safe_divide(10, 2))
# 5.0

print(math4u.safe_divide(10, 0))
# None

# Safe Square Root
print(math4u.safe_square_root(16))
# 4.0

print(math4u.safe_square_root(-1))
# None

# Validate Number
print(math4u.validate_number("25"))
# 25.0

# Get List Item
print(math4u.get_list_item([10, 20, 30], 1))
# 20

# Get Dictionary Value
print(math4u.get_dictionary_value(
    {"name": "Math"},
    "name"
))
# Math


# =========================
# NumPy
# =========================

# Create Array
print(math4u.create_array([1, 2, 3]))

# Mean
print(math4u.array_mean([1, 2, 3, 4]))
# 2.5

# Sum
print(math4u.array_sum([1, 2, 3, 4]))
# 10

# Matrix Multiplication
print(math4u.matrix_multiply_numpy(
    [[1, 2], [3, 4]],
    [[5, 6], [7, 8]]
))

# Statistics
print(math4u.array_statistics([1, 2, 3, 4, 5]))


# =========================
# SciPy and SymPy
# =========================

import sympy as sp

x = sp.Symbol("x")

# Symbolic Simplify
print(math4u.symbolic_simplify(
    (x**2 - 1) / (x - 1)
))
# x + 1

# Symbolic Expand
print(math4u.symbolic_expand(
    (x + 1)**2
))
# x**2 + 2*x + 1

# Numerical Integral
print(math4u.numerical_integral(
    lambda x: x**2,
    0,
    1
))
# 0.333333...


# =========================
# Matplotlib
# =========================

x = [1, 2, 3, 4]
y = [1, 4, 9, 16]

math4u.visualization.plot_function(x, y)


# =========================
# NetworkX
# =========================

edges = [
    ("A", "B"),
    ("B", "C"),
    ("C", "A")
]

graph = math4u.visualization.create_graph(edges)

math4u.visualization.draw_graph(edges)