|
From: Barton W. <wil...@us...> - 2026-10-23 12:07:21
|
A better version:
~~~
(defmvar *max-fullratsimp-iterations* 32
"Maximum number of iterations allowed for fullratsimp before falling back.")
(defmfun ($fullratsimp :properties ((evfun t))) (exp &rest argl)
"Repeatedly applies `ratsimp` to `exp` until either (a) a fixpoint is reached,
(b) a cycle is detected, or (c) the number of iterations exceeds
*max-fullratsimp-iterations*."
(labels ((local-ratsimp (e)
(simplify (apply #'$ratsimp e argl))))
(let* ((k *max-fullratsimp-iterations*)
(seen (list exp))
(current exp)
(next (local-ratsimp exp))
(best exp)
(min-size (conssize exp)))
(loop
;; Track the minimum size on the fly
(let ((sz (conssize next)))
(when (< sz min-size)
(setf min-size sz
best next)))
;; (a) Fixpoint reached
(when (alike1 current next)
(return next)) ; or current, they are alike
;; (b) Cycle detected or (c) Max iterations exceeded
(when (or (member next seen :test #'alike1) (< k 0))
(return best))
(push next seen)
(decf k)
(setf current next
next (local-ratsimp next))))))
~~~
---
**[bugs:#5695] fullratsimp\(rat\(sqrt\(c-1\)/\(c-f\(a\)\)^\(3/2\)-1/\(sqrt\(c-1\)\*sqrt\(c-f\(a\)\)\)\)\) loops forever**
**Status:** closed
**Group:** None
**Labels:** fullratsimp
**Created:** Thu Oct 22, 2026 03:06 AM UTC by David Scherfgen
**Last Updated:** Thu Oct 22, 2026 08:11 PM UTC
**Owner:** nobody
Discovered by Claude:
~~~
fullratsimp(rat(sqrt(c-1)/(c-f(a))^(3/2)-1/(sqrt(c-1)*sqrt(c-f(a)))));
~~~
This loops forever, cycling over two representations.
---
Sent from sourceforge.net because max...@li... is subscribed to https://sourceforge.net/p/maxima/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/maxima/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |