Skip to content

[RuleBased] change of variables loses the domain of the substituted variable, breaking ∫sin(sqrt(1+x))/sqrt(1+x)dx #145

Closed

Description

@s-celles

∫ sin(sqrt(1+x))/sqrt(1+x) dx no longer closes with the rule-based method. It is entry 15
of the difficult baseline, and it fails in every difficult CI job of PRs #136, #138 and
#141 — on all three independently, and also on clean main with a current dependency
resolution, so it is not caused by any of those PRs:

[ fail ]∫( sin(sqrt(1 + x)) / sqrt(1 + x) )dx = -2cos(sqrt(1 + x)) but got: ...

Mechanism

Rule 4_1_12_81 (src/methods/rule_based/rules2/4 Trig functions/4.1 Sine/4.1.12 (e x)^m (a+b sin(c+d x^n))^p.jl:562)
changes variables to u = (e + f*x)^n via int_and_subst, which integrates in u and then
substitutes back with a plain substitute(result, from => to)
(src/methods/rule_based/rules_utility_functions.jl:466-485).

Nothing records that u is a principal square root when n = 1//2, and therefore
nonnegative. The integrand rebuilt in u contains sqrt(u^2):

The upstream rule is correct. The gap is on this side: the change of variables discards the
domain of the substituted variable. JuliaSymbolics/SymbolicUtils.jl#1046 (no simplification
rules for abs) is why nothing removes the abs afterwards.

Possible fixes

  1. Carry the domain of the substituted variable through int_and_subst, so that u >= 0 is
    available to simplification. The VariableDomain metadata key proposed in
    feat: add VariableDomain metadata to support mathematical assumptions Symbolics.jl#1983 would give a place to record it.
  2. More narrowly, have int_and_subst rewrite sqrt(u^2) to u when it knows the
    substitution it introduced is nonnegative.

Either way a regression test on this integrand would be welcome, since the baseline entry
alone did not make the cause obvious.

Provenance of the evidence

The CI failures and the rule/int_and_subst source paths above were read directly. The
4.46.6 → 4.46.7 → 4.46.8 boundary was established by the automated reviews of #138, #140 and
#141 rather than re-bisected here; the commit e03f3da4 that adds the abs rule is in
SymbolicUtils PR #1077, which is consistent with that boundary.

Assisted by: AI

Activity

  1. added a commit that references this issue on Oct 2, 2026
    4e27faa
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions