Skip to content

A negative whole power is inverted to its roots, not to none - #2154

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-negative-power-equation-is-not-answered-empty
Oct 27, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-negative-power-equation-is-not-answered-empty

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Fixes #2144.

A wrong answer: an equation that reaches a negative whole power inside another expression was answered with the empty set, which claims it has no roots.

Input Was (2.6.0) Now
1/(1 + x^(-2)) = 1/2 { } { 1, -1 }
2/(1 + x^(-2)) = 1 { } { 1, -1 }
1/(2 + p^(-3)) = 1/3 { } { 1, -1/2 + i * 1/2 * sqrt(3), -1/2 + i * -1/2 * sqrt(3) }
1/(1 + x^(-2)) = y { } { ((-1) / (-y) - 1) ^ (-1/2), -((-1) / (-y) - 1) ^ (-1/2) }

Cause. Powf's inversion of x^n = v for a whole n multiplies an n-th root of v by each root of unity of order n. GetAllRootsOf1 lists those roots by counting up to n, so for n = -2 it listed none, and the inversion returned no roots. The replacement machinery solves t = x^(-2) as t = 1 correctly, and then asks that inversion for x.

Fix. x^n = v for a negative n has the roots of x^|n| = 1/v, so the roots of unity are counted to |n|.

  • A negative power is never zero, so x^(-2) = 0 is still answered { }, now deliberately.
  • x^0 is not inverted at all.
  • x^(-2) = 4 on its own was already answered correctly by another route, and is unchanged.

Checked:

  • NegativePowerInversionTest: every root is in the answer and a non-root is not; a symbolic right-hand side gives the two roots, which at y = 1/2 are 1 and −1; and a negative power is never zero.
  • The full unit suite: 17,089 passed, 0 failed, 13 skipped.
  • The BREAKING-CHANGES entry was measured on the 2.6.0 package and on this branch.

Found while reading Modenov's Problems in Geometry for #2131.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Inverting x^n = v for a whole n multiplies an n-th root of v by each
root of unity of order n, which GetAllRootsOf1 lists by counting up to
n. For a negative n it counted nothing, so the inversion found no roots,
and an equation that reached one inside another was answered with the
empty set, a claim that it has none: 1/(1 + x^(-2)) = 1/2 came back { }
where its roots are 1 and -1, and 1/(1 + x^(-2)) = y came back { } for
every y. x^(-2) = 4 on its own was answered correctly by another route.

x^n = v for a negative n has the roots of x^|n| = 1/v, and an n-th root
of v times a root of unity of order |n| is each of them, so the roots of
unity are now counted to |n|. A negative power is never zero, so
x^(-2) = 0 is still answered with none, now on purpose; x^0 is not
inverted at all.

Measured on 2.6.0 and on this branch, in BREAKING-CHANGES.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 27, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 27, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit a0373a4 into master Oct 27, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 27, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-negative-power-equation-is-not-answered-empty branch October 27, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1/(1 + x^(-2)) = 1/2 is answered with the empty set, though x = 1 and x = -1 are roots

1 participant