🤖 Complex fixes - #1917
Open
KristofferC wants to merge 3 commits into
Open
Conversation
Raising a `Complex{Num}` (or any complex number) to a symbolic power went
through a method that still referenced `Symbolics.Pow`, which no longer
exists, so e.g. `(1 + im*sin(t))^0.5` threw an `UndefVarError`. Build the
power term through `term`/`wrap` instead.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both helpers only built a term when `symtype(n) === Real` exactly, and silently returned `nothing` otherwise. Any complex-symtype argument -- e.g. the Cardano-formula roots emitted by `symbolic_solve` for a cubic with complex coefficients, or such a root after substituting a complex value -- therefore produced errors like `MethodError: no method matching *(::Int64, ::Nothing)`. Fall through to `term(...)` unconditionally, as `slog` already did. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1917 +/- ##
===========================================
- Coverage 80.83% 23.90% -56.93%
===========================================
Files 59 59
Lines 5733 5701 -32
===========================================
- Hits 4634 1363 -3271
- Misses 1099 4338 +3239 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SymbolicUtils restricts `//` to integer/rational symtypes, so the cubic and quartic formulas in `get_roots_deg3`/`get_roots_deg4` (and the log attract rule) threw a MethodError as soon as a coefficient was a float or a symbolic expression, e.g. `symbolic_solve(x^3 + x^2*cos(t) + x*sin(t) + 1, x)`. For symbolic arguments `//` builds the same `Div` as `/` anyway, so add an `sdiv` helper that uses `/` for symbolic arguments and keeps exact rational division for plain numbers, and use it at those call sites. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AayushSabharwal
approved these changes
Jul 6, 2026
Member
|
Requires JuliaSymbolics/SymbolicUtils.jl#1003 |
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.
I saw a slack thread with some issues w.r.t complex numbers. This is what the robot identified.