Skip to content

A two-sided limit is NaN where both one-sided limits are the same infinity #2274

Closed

Description

@Rafael-SOWNet

A two-sided limit comes back NaN where both one-sided limits exist and agree. NaN claims there is no limit. 2.6.0 and master:

Input Answered Left Right
limit(ln(x^2) / ln(1 - x^2/2), x, 0) NaN +oo +oo
limit(ln(x^2) / (cos(x) - 1), x, 0) NaN +oo +oo
limit(ln(abs(x)) / ln(cos(x)), x, 0) NaN +oo +oo

The two-sided branch of ComputeLimit (Solvers.Definition.cs) compares the bare descent from each side. When those disagree or are NaN, and l'Hopital's rule finds nothing, it asks WhereBothSidesAgree, which runs the full one-sided machinery and would answer +oo here. WhereBothSidesAgree runs only under a real codomain, so the branch returns NaN instead.

The gate is there on purpose (#719): over the complex plane a one-sided limit can come from the continuation, so x^x at 0- answers 1. That is not the case here, where each expression is real on both sides of 0. A fix needs a decision on which expressions may be asked side by side. For example, those that are real near the destination with the destination itself removed: ln(x^2) is real for every x != 0 but has no value at 0, and neither TreeAnalyzer.IsRealValued nor a reading at the destination says so today.

Found while fixing #2267, which moves limit(ln(x^2) / ln(cos(x)), x, 0) from a wrong -oo to this NaN.

Activity

  1. added this to the 2.7.0 milestone on Oct 30, 2026
  2. moved this from Todo to In Progress in AngouriMathon Oct 31, 2026
  3. Rafael-SOWNet commented on Oct 31, 2026

    @Rafael-SOWNet
    MemberAuthor

    A correction to the cause above: it isn't WhereBothSidesAgree's real-codomain gate. With the gate opened for expressions that are real on each side, nothing changed, because each one-sided limit came back as (-oo) / 0, which evaluates to NaN. The cause is DivergesAtAVanishingDivisor, which reads the side the divisor vanishes from but accepted only a finite dividend. #2295 extends it to an infinite one and leaves the gate alone.

  4. moved this from In Progress to Done in AngouriMathon Oct 31, 2026
  5. added a commit that references this issue on Nov 4, 2026
    17cd9da
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

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions