This commit is contained in:
tyuXX 2026-10-24 18:40:19 +03:00
parent d70b0390b7
commit ee25655c8d
22 changed files with 2126 additions and 53 deletions

View file

@ -76,13 +76,32 @@ dotnet run --project tests/GraphTUI.Tests/GraphTUI.Tests.csproj
## Mathematical Syntax
### Expressions & Variables
- Cartesian functions: $y = f(x)$, e.g. `sin(x) * exp(-0.1x)`
- Parametric curves: $x(t) = \cos(3t)$, $y(t) = \sin(4t)$
- Polar curves: $r = f(\theta)$, e.g. `2*(1 - sin(theta))`
- Implicit multiplication: `2x`, `3sin(x)`, `(x+1)(x-1)`, `2pi`, `x y`
### Expressions & Double-Sided Equations
GraphTUI automatically parses and classifies all single-sided and double-sided definitions:
- **$y = f(x)$ or $f(x) = y$**: Standard Cartesian curves, e.g. `y = sin(x)`, `y = x^2 - 4`, `sin(x) = y`
- **$f(y) = x$ or $x = f(y)$**: Inverse and vertical curves, e.g. `y^2 = x`, `sin(y) = x`, `x = y^2`, `x = cos(y)`
- **$f(y) = g(x)$ or $F(x, y) = 0$**: Double-sided implicit curves & relations, e.g. `y^2 = sin(x)`, `sin(y) = cos(x)`, `y^2 = x^3 - 3x` (elliptic curve), `x^2 + y^2 = 25` (circle), `y^2 - x^2 = 1` (hyperbola)
- **Parametric curves**: $x(t) = \cos(3t)$, $y(t) = \sin(4t)$
- **Polar curves**: $r = f(\theta)$, e.g. `2*(1 - sin(theta))`
- **Implicit multiplication**: `2x`, `3sin(x)`, `(x+1)(x-1)`, `2pi`, `x y`
### Built-in Functions
### Calculus, Summation & Product Operations
- **Summation**: `sum(n=start, end, f(n))` or `sum(n, start, end, f(n))`
Example: `sum(n=1, 5, sin(n*x)/n)` (Fourier harmonic synthesis), `sum(k=0, 8, x^k / fact(k))` (Taylor expansion of $e^x$)
- **Product**: `prod(n=start, end, f(n))` or `prod(n, start, end, f(n))`
Example: `prod(n=1, 4, 1 + x/n)` (Weierstrass product)
- **Definite Integrals in Formulas**: `int(t=a, b, f(t))` or `integral(t=a, b, f(t))`
Example: `y = int(t=0, x, sin(t^2))` (Fresnel sine integral), `y = int(t=1, x, 1/t)` (definition of $\ln(x)$)
- **Numerical Derivative Operator**: `diff(t=x, f(t))` or `diff(f(x), x)`
Example: `y = diff(t=x, sin(t^3))` (evaluates $\frac{d}{dx}[\sin(x^3)] = 3x^2 \cos(x^3)$)
- **Factorials, Double & Super Factorials**:
- **Single Factorial**: `x!` or `fact(x)` (e.g. `5! = 120`, `(x+1)!`)
- **Double Factorial**: `x!!` or `dfact(x)` (e.g. `5!! = 15`, `6!! = 48`, with full analytic continuation)
- **Super Factorial**: `x$` or `sfact(x)` (e.g. `4$ = 1!*2!*3!*4! = 288`)
- **Gamma function**: `gamma(x)` (Lanczos approximation for $\Gamma(x)$, accurate to 14 decimal digits)
- **Zero-Lag Line Clipping & Caching**: Powered by Cohen-Sutherland line clipping and static lookup tables ($0! \dots 170!$, $0!! \dots 300!!$, $0\$ \dots 27\$$). Steep factorial growth cannot hang the terminal or trigger off-screen rasterization.
### Built-in Functions & Constants
- **Trigonometric**: `sin`, `cos`, `tan`, `cot`, `sec`, `csc`
- **Inverse Trig**: `asin`, `acos`, `atan`, `atan2(y, x)`
- **Hyperbolic**: `sinh`, `cosh`, `tanh`
@ -90,6 +109,12 @@ dotnet run --project tests/GraphTUI.Tests/GraphTUI.Tests.csproj
- **Rounding & Utilities**: `abs`, `floor`, `ceil`, `round`, `sgn`, `min(a, b)`, `max(a, b)`, `clamp(x, min, max)`
- **Constants**: `pi` ($\pi$), `e`, `tau` ($2\pi$), `phi` ($\approx 1.618$)
### Function Cheatsheet (`F5` or `:cheat`)
Press **`F5`** at any time to open the built-in, categorized **Math Cheatsheet**:
- **Tab / 1-5**: Switch categories (Calculus/Sum/Prod, Double-Sided Equations, Trig, Exponentials, Utilities).
- **Up / Down**: Browse formulas, syntax, descriptions, and real-world examples.
- **Enter**: Instantly loads and graphs the selected example!
---
## Architecture