Skip to content

Infinite loop when rationalizing #3704

Open

Description

@khanybaba

Describe the bug
mathJs hangs when asked to rationalize relatively simple polynomials

To Reproduce
attempt this:
rationalize("(x+y+z)^3")

Activity

  1. x0Lazarus commented on Sep 30, 2026

    @x0Lazarus

    #3698 appears to address this case. On develop at 8d214e0, a process evaluating rationalize('(x+y+z)^3') hit a 15-second timeout. Applying only the simplifyCore.js change from that PR (c5ebf287) let the call complete in about 0.6 seconds on Windows with Node 24.13.1.

    The returned expression matched the original cube at five integer inputs, including negative and zero values. (x+y)^2, (x+y+z)^2 and (x+y)^3 also completed with the expected sampled values on both versions.

    This was a focused reproduction check; I haven't run the PR's full test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions