summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Guillermo Albers Raviola <thomas@thomaslabs.org>2026-07-22 23:07:55 +0200
committerThomas Guillermo Albers Raviola <thomas@thomaslabs.org>2026-07-22 23:07:55 +0200
commit1bae52f590f3c34a41bcf25bc8ba62e8ab7f5220 (patch)
tree5960d23c33990baa1223fe0cbaf38f3d00ee46be
parentbf3c49ef7d1e4ea97b1f1f5828b1fc9f4e1cb6ca (diff)
Add optional progress message in series expansion
-rw-r--r--series.mac15
1 files changed, 11 insertions, 4 deletions
diff --git a/series.mac b/series.mac
index ec4cb50..e2bc241 100644
--- a/series.mac
+++ b/series.mac
@@ -271,18 +271,25 @@ expand_term(expr, coeffs) := block(
/* Solve main equations term by term */
+print_progress : false;
+
/* TODO: Divide and conquer on term list for long expansions */
/* coeffs: facts already known about series expansions */
/* Series expansion inside each instance of a value in the terms of an equation
*/
-expand_equation(expr, coeffs) := block(
- [len, terms],
+expand_equation(expr, coeffs) := (
expr : rhs(expr) - lhs(expr),
0 = if atom(expr) then (
expr)
- elseif op(expr)="+" then (
- apply("+", map(lambda([term], expand_term(term, coeffs)), args(expr))))
+ elseif op(expr)="+" then block(
+ [i : 0, len : length(args(expr))],
+ apply("+", map(lambda([term],
+ i : i+1,
+ if print_progress then (
+ printf(true, "expand_equation [~a/~a]~%", i, len)),
+ expand_term(term, coeffs)),
+ args(expr))))
else (
expand_term(expr, coeffs)))$