mathnet-symbolics
mathnet-symbolics copied to clipboard
Missing pattern matching for ComplexInf operations in Evaluate.fs
I found missing matching patterns in several arithmetic functions in Evaluate.fs where operations with complex infinity aren't handled correctly, resulting in "not supported" errors instead of returning mathematically correct results.
The issue occurs when adding finite values to complex infinity (-1 + ComplexInf) or multiplying non-zero values with complex infinity. These operations should generally return ComplexInf but currently fail with errors.
I think the following may fix the missing patterns:
// in fadd function:
| ComplexInf, _ | _, ComplexInf -> ComplexInf
// In fmultiply function:
| ComplexInf, Real 0.0 | Real 0.0, ComplexInf -> Undef // 0 × ⧝ = undefined
| ComplexInf, _ | _, ComplexInf -> ComplexInf