Metadata-Version: 2.4
Name: furthermathskit
Version: 1.0.0
Summary: Step-by-step solver for Further Mathematical Methods — ODEs, PDEs, Fourier series, linear algebra, with LaTeX output in Jupyter
Author-email: Enzo <you@email.com>
License: MIT License
        
        Copyright (c) 2025 Enzo
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/yourusername/furthermathskit
Project-URL: Repository, https://github.com/yourusername/furthermathskit
Project-URL: Issues, https://github.com/yourusername/furthermathskit/issues
Keywords: mathematics,ODE,PDE,fourier,sympy,linear-algebra,gram-schmidt,jupyter,step-by-step,cauchy-euler,eigenvalue,heat-equation,wave-equation
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
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Education
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Framework :: Jupyter
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sympy>=1.12
Requires-Dist: numpy>=1.24
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# furthermathskit

**Step-by-step solver for Further Mathematical Methods**

Renders full working as **LaTeX in Jupyter notebooks**. Falls back to clean plain text in scripts or terminals.

Built from analysis of 3 years of PolyU AMA3724 past exam papers.

---

## Install

```bash
pip install furthermathskit
```

## Quick Start

```python
from furthermathskit import *

toolkit_menu()   # see all functions
quick_ref()      # formula sheet
```

---

## Functions

### Linear Algebra

```python
# Column-sum norm and spectral norm
matrix_norms([[-1,7,3,-3],[7,-1,3,-3],[3,3,-1,-7],[-3,-3,-7,-1]])

# Orthogonal projection of b onto col(A) + least squares
orthogonal_projection(b=[8,0,2,-2], A_list=[[...]])

# Change of basis matrix P_{B<-E} and coordinate vector [X]_B
change_of_basis(E, B, X)

# Jordan form with eigenspace dimension analysis + generalised eigenvector hints
jordan_analysis([[2,1,0,0,0],[0,2,0,0,0],[0,0,3,1,0],[0,0,0,3,1],[0,0,0,0,3]])

# Full SVD decomposition
svd_analysis([[1,2],[2,4]])
```

### ODEs

Functions marked `#` are safe for exam questions that **explicitly ban `dsolve`** — they work purely via eigenvalues, integrals, and manual substitutions.

```python
# 2nd-order constant-coefficient IVP
# Automatically uses undetermined coefficients with printed working
solve_2nd_order_ivp(a=6, b=-1, c=-1, y0=10, dy0=0)
solve_2nd_order_ivp(a=1, b=-4, c=3, y0=2, dy0=1, forcing=exp(5*t))

# Cauchy-Euler  a2 t^2 y'' + a1 t y'' + a0 y = 0
# Handles distinct, repeated, and complex roots                          #
solve_cauchy_euler(1, -3, 4)
solve_cauchy_euler(1, -3, 4, y0=1, dy0=2)

# System X'=AX via eigenvalue method (no dsolve)                        #
solve_system_eigenvalue([[0,1,0],[0,0,1],[-15,-23,-9]], t0=0, X0_list=[1,1,1])

# Euler-type system tX'=AX  (solutions are t^lambda * v)                #
solve_system_eigenvalue(A, t0=1, X0_list=[1,1,1], euler_type=True)

# Variation of parameters (no dsolve)                                    #
variation_of_parameters(y1=x*exp(x), y2=x, forcing_expr=2*x**2)

# Exact ODE check + solve for potential function F(x,y)=C               #
check_exact_ode(M_expr=cos(y), N_expr=y**3 - x*sin(y))

# Bernoulli ODE  y' + P(x)y = Q(x)y^n                                   #
solve_bernoulli(n_val=4, P_expr=-1, Q_expr=-exp(-x))
```

### Market Models

```python
# Solow growth model  k' + lambda*k = s*k^alpha  (Bernoulli)
solow_growth_model(alpha=Rational(3,11), s_val=Rational(1,3),
                   lam_val=Rational(1,4), k0=1)

# Market clearing equilibrium ODE
P = Function('P')
Qd = 5*P(t) - 4*P(t).diff(t) + P(t).diff(t,2)
Qs = 2*P(t) + exp(5*t) + 2
market_clearing_equilibrium(Qd, Qs, P0=2, dP0=1)
```

### Fourier / PDE

```python
# Heat IBVP — Neumann BCs (cosine series)
# Smart: if IC is a sum of cosines, uses direct mode matching
# No integration needed — just reads off coefficients
solve_heat_ibvp_neumann(k_val=7, L_val=9, ic_expr=cos(6*pi*x))

# With reaction term  ut = k uxx + a u  ->  substitution u = e^(at) w
solve_heat_ibvp_neumann(k_val=7, L_val=9, ic_expr=cos(6*pi*x),
                        extra_term="5u", change_var=(5, "u=e^(5t)w -> wt=7wxx"))

# Heat IBVP — Dirichlet BCs (sine series)
solve_heat_ibvp_dirichlet(k_val=5, L_val=pi, ic_expr=sin(3*x))

# Wave IBVP
solve_wave_ibvp(L_val=pi, ic_u_expr=sin(4*x)+2*sin(6*x),
                ic_ut_expr=2*sin(10*x))

# Fourier transform PDE on (-inf, inf) — guided steps
fourier_transform_pde({'a': 5, 'b': 3, 'c': 8, 'ic': 'sin(3 pi x)'})
```

### Gram-Schmidt in L²([a,b])

```python
# Orthonormalise a polynomial basis over [0,1]
basis = [S(1), x, x**2, x**3, x**4]
ONB   = l2_gram_schmidt(basis, a=0, b=1)

# Project a function onto the ONB
coeffs, reconstruction = l2_project(-10*x**3 + x**4, ONB)

# Raw inner product
l2_inner_product(x, x**2, a=0, b=1)   # -> 1/4
```

---

## Output style

**In Jupyter notebooks** — all expressions render as proper LaTeX:
- Section headers: styled HTML blocks
- Step-by-step working shown at each stage
- Final answers in a green bordered box
- Eigenvalues, matrices, solutions all rendered via `display(Math(...))`

**In scripts / terminals** — clean Unicode fallback with box-drawing characters.

---

## Topics covered

| Topic | Notes |
|---|---|
| Matrix norms (column-sum, spectral) | Via eigenvalues of AᵀA |
| Orthogonal projection & least squares | Normal equations + null space |
| Change of basis | P_{B←E} and [X]_B |
| Jordan form | With generalised eigenvector hints |
| SVD | Full U, Σ, Vᵀ decomposition |
| 2nd-order ODE IVP | Undetermined coefficients with working |
| Cauchy-Euler ODE | All root cases including complex |
| System of DEs (X'=AX) | Eigenvalue method, no dsolve |
| Euler-type system (tX'=AX) | t^λ solutions |
| Variation of parameters | Full Wronskian working, no dsolve |
| Exact ODE | Check + solve for F(x,y) |
| Bernoulli ODE | w=y^(1-n) substitution |
| Market equilibrium ODE | Arbitrary order |
| Solow growth model | Bernoulli reduction |
| Heat IBVP Neumann | Smart cosine mode matching |
| Heat IBVP Dirichlet | Sine series |
| Heat with reaction term | e^(at)·w substitution trick |
| Wave IBVP | aₙ and bₙ coefficients |
| Fourier transform PDE | Guided procedure + formula |
| Gram-Schmidt L²([a,b]) | Full orthonormalisation |
| L² projection | Coefficient computation + reconstruction |

## License

MIT
