Skip to content

Commit 7704bf8

Browse files
committed
Updated README.md with section about differential-equations engine
1 parent 718fef2 commit 7704bf8

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,49 @@ Full measured breakdowns, including GPU throughput at scale, live in [BENCHMARK_
235235

236236
---
237237

238+
239+
240+
---
241+
242+
## 🧮 Solving Differential Equations
243+
244+
ParserNG solves ODEs — single equations, systems, and higher-order equations — as a first-class expression, not a bolted-on API. Four functions cover it: `diffeqn` (endpoint), `diffeqnPath` (full trajectory), `diffeqnHO` and `diffeqnPathHO` (the higher-order equivalents, for equations involving `y''`, `y'''`, and beyond).
245+
246+
Five solver methods are available, spanning the usual accuracy/stiffness tradeoff:
247+
248+
| Method | Order | Stiff-safe? | Use it for |
249+
| :--- | :--- | :--- | :--- |
250+
| `euler` | 1st | No | Real-time graphics, particle sims — speed over precision |
251+
| `rk4` | 4th | No | General-purpose default — solid accuracy, no adaptive bookkeeping |
252+
| `rk45` | 4th/5th, adaptive | No | Behavior that varies across the interval; industry-standard adaptive stepping |
253+
| `implicit_euler` | 1st | **Yes** | Stiff systems where stability matters more than tight accuracy |
254+
| `bdf2` | 2nd | **Yes** | Stiff systems needing better accuracy than `implicit_euler` at the same stability |
255+
256+
```java
257+
// Endpoint only, using RK4 defaults
258+
MathExpression me = new MathExpression("diffeqn(y[1] + 2*y[0], 0, 1, 5)");
259+
me.solve();
260+
261+
// Full trajectory, resampled to 50 evenly-spaced points
262+
MathExpression path = new MathExpression(
263+
"diffeqnPath(y[1] + 2*y[0], 0, 1, 5, 0.01, rk4, 50)");
264+
path.solve();
265+
266+
// A 3rd-order equation, stiff-safe BDF2, full state trajectory (t, y, y', y'')
267+
MathExpression ho = new MathExpression(
268+
"A=diffeqnPathHO(3*x*sin(x)*y[3]+4*x*y[2]+3*ln(x)*y[1]+4*y[0], 1, @(1,3)(1, 0, 0), 3, 0.01, bdf2, state)");
269+
ho.solve();
270+
FunctionManager.lookUp("A").getMatrix().print();
271+
```
272+
273+
Results assign to a variable or matrix just like any other ParserNG expression — but a `diffeqn`-family call must always be the *entire* input expression (`A = diffeqn(...)` is fine; `sin(diffeqn(...))` is not — see the docs for why).
274+
275+
Full syntax reference, argument-by-argument breakdown, and per-method accuracy/stability nuances: [DIFF_ENGINE.md](parser-ng/DIFF_ENGINE.md).
276+
277+
---
278+
279+
280+
238281
## 📐 Examples Across Every Backend
239282

240283
Same expression syntax, five different execution tiers. Pick based on how hot the loop is.
@@ -421,6 +464,7 @@ Running any of this in production? Production infrastructures requiring predicta
421464
* **Deep Dive Benchmarking Logs:** [BENCHMARK_RESULTS.md](parser-ng/BENCHMARK_RESULTS.md) — Comprehensive execution breakdowns versus competitor runtimes.
422465
* **High-Fidelity Graphical Plotting:** [GRAPHING.md](parser-ng/GRAPHING.md) — Render configuration rules for JavaFX, Swing, and Android surfaces.
423466
* **Bulk Vectorization Blueprints:** [BULK.md](https://www.google.com/search?q=parser-ng/BULK.md) — Optimization techniques for massive array processing.
467+
* **Differential Equations:** [DIFF_ENGINE.md](parser-ng/DIFF_ENGINE.md) — Full `diffeqn`/`diffeqnPath`/`diffeqnHO`/`diffeqnPathHO` syntax, solver selection guide, and result-capture patterns.
424468
* **Release Artifact Logs:** [LATEST.md](LATEST.md) — Change logs and technical notes for v3.0.3.
425469
* [MORE.md](MORE.md) — Even more to know
426470
* [Hello world and original readme](src/main/java/com/github/gbenroscience/README.md) — Original readme for pre-1.0 versions with a lot of, still valid, examples

0 commit comments

Comments
 (0)