Repository navigation
The complex conjugate and the principal argument are functions - #2181
Merged
Merged
Conversation
Chapter III of Modenov's Problems in Geometry writes every point as a complex number and every statement in z and its conjugate, and its angles are arguments. conjugate was refused by name, and conj and arg since #2136. conjugate(z), also conj(z), is Entity.Conjugatef. A number is conjugated, and the conjugate is an involution. It is a field automorphism, so it is carried through sums, differences, products, quotients and whole powers, which keeps it on the symbols, and an identity between conjugates is then decided as one between symbols. It is not carried through a root or a logarithm, whose cuts break the reflection: conj(sqrt(-1)) is -i, sqrt(conj(-1)) is i. What is known to be real is its own conjugate: a modulus, and a symbol declared real. The codomain setting is not read, since InnerSimplified is cached on the node and the setting is not. conj(f) = v is solved as f = conj(v), and the derivative is taken along the variable's real line, as the modulus's is: that of conj(f) is conj(f'). arg(z) is Entity.Argf, the principal argument in (-pi, pi], real, with no value at 0. A number's argument is exact: the axes are 0, pi and +-pi/2, and elsewhere arctan(b/a), turned by pi into the left half-plane and gathered with a table value of the arctangent, so arg(-1 - i) is -3/4 * pi. Numerically it is the phase. Both print by name, draw as \overline{z} and \arg(z), and export to SymPy's conjugate and arg. The MCP server's syntax document names them, the native smoke test evaluates both, and re and im are still read as products. Part of #2145. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2181 +/- ##
==========================================
- Coverage 86.44% 86.44% -0.01%
==========================================
Files 296 297 +1
Lines 65332 65406 +74
Branches 19180 19198 +18
==========================================
+ Hits 56479 56541 +62
- Misses 4802 4812 +10
- Partials 4051 4053 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
arg(prime(x)) simplified to 0, because prime's codomain is the primes. But at x = -3 prime(x) has no value, and neither has its argument, so BoundCheck found the simplification defined where the original was not. A codomain says what a node's values are and not where it has one; the argument is now decided for numbers only. Part of #2145. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chapter III of Modenov's Problems in Geometry writes every point as a complex number and every statement in
zand its conjugate, and its angles are arguments.conjugatewas refused by name, andconjandargsince #2136. Both are now functions, which Happypig375's answer on #212 opened up: "You can add new functions as you see fit as long as they are mathematically precise and unambiguous".conjugate(z), alsoconj(z), isEntity.Conjugatef, andMathS.Conjugate.conj(3 + 4i)being3 - 4i, and the conjugate is an involution:conj(conj(z))isz.conj((z_2 - z_1)/(z_3 - z_1)) - (conj(z_2) - conj(z_1))/(conj(z_3) - conj(z_1))is0where the quotient is defined.conj(sqrt(-1))is-iandsqrt(conj(-1))isi.domain(x, RR). A bare symbol keeps its conjugate. TheMathS.Settings.Codomainsetting is not read, becauseInnerSimplifiedis cached on the node and the setting is not; a test pins that.conj(x) = 2 + iis solved to{ 2 - i }. The derivative is taken along the variable's real line, as the modulus's is: that ofconj(f)isconj(f'). A matrix is conjugated entry by entry.arg(z)isEntity.Argf, andMathS.Arg: the principal argument, in(-pi, pi], so thatz = abs(z) e^(i arg(z)). It is real, and has no value at0, where every angle fits; its domain condition says so.0,piand+-pi/2, soarg(-1)ispi, the end of the interval that is included, as the principal logarithm's imaginary part is.arctan(b/a), turned bypiinto the left half-plane and gathered with a table value of the arctangent:arg(-1 - i)is-3/4 * piandarg(-2 + i)isarctan(-1/2) + pi. Numerically it is the phase.Im(f'/f), and there is no node for that.Both print by name, draw as
\overline{z}and\arg\left(z\right), and export tosympy.conjugateandsympy.arg. Neither is compiled byCompileyet.Also
truncis still refused by name.(z + conj(z))/2for a real part, sincereandimare still read as products, asTheTwoLetterNamesAreLeftAsProductsrecords.conjugate(z)UnrecognizedFunctionParseExceptionconjugate(z)conj(z)conj * zconjugate(z)conj(3 + 4i), simplified(3 + 4i) * conj3 - 4iarg(z)arg * zarg(z)arg(-1), simplified-argpiMeasured
"3 + 4 i"inMathS.Conjugate's own example, which reads as3 + 4 ^ i(3 iparses as3 ^ i: an imaginary literal after a factor is read as its exponent #1503); the example says3 + 4inow.arg(prime(x))simplified to0, fromprime's codomain, where atx = -3the original has no value. The second commit decides the argument for numbers only and adds the row. Then, locally: BoundCheck 1076 shapes with 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, SimpSweep 10463/10463, CrashCheck 0 crashed, PropCheck and RuleCheck clean, CanonCheck (2091) and Confluence (3) matching their baselines; suite 17,288 passed, 0 failed.Part of #2145.
reandimare left for a PR of their own, since they change howre(x)reads.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura