Metadata-Version: 2.5
Name: nateeganmathpackagelinfinnum
Version: 0.1.10
Summary: A collection of undergraduate math functions: Linear Algebra, Number Theory, Mathematical Finance
Project-URL: Homepage, https://github.com/yourusername/mypackage
Project-URL: Documentation, https://github.com/yourusername/mypackage#readme
Project-URL: Repository, https://github.com/yourusername/mypackage.git
Project-URL: Bug Tracker, https://github.com/yourusername/mypackage/issues
Author-email: Nateegan Yopituk <nateegan2205@gmail.com>
License: MIT
License-File: LICENSE
Keywords: finance,linear-algebra,math,number-theory,pep621
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
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
Description-Content-Type: text/markdown

# nateeganmathpackagelinfinnum

`nateeganmathpackagelinfinnum` is a lightweight Python package that provides simple utility functions for **Linear Algebra**, **Number Theory**, and **Mathematical Finance**. It is designed mainly for learning purposes and as an example of Python packaging.

---

## Features

- **Module 1: finance**
  - **present_value / future_value**: convert between present value and future value given an interest rate and number of periods
  - **simple_return**: compute simple return from a starting price and ending price
  - **portfolio_value**: compute total value of a portfolio from asset prices and quantities
  - **call_option_payoff / put_option_payoff**: compute European option payoff at expiry
  - **has_arbitrage_two_state**: check for arbitrage in a simple two-state (binomial) market model
- **Module 2: linear**
  - **vector_add / scalar_multiply**: basic vector operations
  - **dot_product / vector_norm**: inner product and Euclidean norm of a vector
  - **matrix_rank**: rank of a matrix via Gaussian elimination
  - **is_linearly_independent**: check whether a set of vectors is linearly independent
  - **is_orthogonal**: check whether two vectors are orthogonal
- **Module 3: numtheory**
  - **is_prime**: check whether a number is prime
  - **prime_factorization**: factor a number into its prime factors
  - **mod_pow**: fast modular exponentiation
  - **extended_gcd / modular_inverse**: extended Euclidean algorithm and modular multiplicative inverse
  - **euler_totient**: compute Euler's totient function φ(n)

---

## Installation

You can install the package directly from PyPI:

```bash
pip install nateeganmathpackagelinfinnum
```

---

## Examples

```python
import nateeganmathpackagelinfinnum as pkg

# --- finance ---
print("present_value =", pkg.present_value(1000, 0.05, 2))                           # output: 907.0294784580499
print("future_value =", pkg.future_value(1000, 0.05, 2))                             # output: 1102.5
print("simple_return =", pkg.simple_return(100, 110))                                # output: 0.1
print("portfolio_value =", pkg.portfolio_value([50, 100, 20], [10, 2, 5]))           # output: 800
print("call_option_payoff =", pkg.call_option_payoff(120, 100))                      # output: 20
print("put_option_payoff =", pkg.put_option_payoff(80, 100))                         # output: 20
print("has_arbitrage_two_state =", pkg.has_arbitrage_two_state(0, 5, 0))             # output: True

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

# --- numtheory ---
print("is_prime =", pkg.is_prime(29))                                                # output: True
print("prime_factorization =", pkg.prime_factorization(60))                          # output: {2: 2, 3: 1, 5: 1}
print("mod_pow =", pkg.mod_pow(3, 13, 7))                                            # output: 3
print("extended_gcd =", pkg.extended_gcd(30, 18))                                    # output: (6, -1, 2)
print("modular_inverse =", pkg.modular_inverse(3, 11))                               # output: 4
print("euler_totient =", pkg.euler_totient(36))                                      # output: 12
```
