Skip to content

StackOverflowError if HomotopyContinuation.System is passed a SymEngine.Basic #716

Description

@GGooeytoe

I was trying to use SymEngine's slightly more powerful symbolic facilities to build by expressions for eventual use in a HomotopyContinuation.System when I discovered that if you pass a SymEngine.Basic to HomotopyContinuation.System, it will try to convert it, fail, and overflow the stack. Presumably this capability is not supported, but this seems like a pretty undesirable way to fail. On a related note, is there a recommended way to interface SymEngine and HomotopyContinuation/ModelKit? I see from the source that ModelKit uses some SymEngine features, but they apparently aren't transparently compatible.

Reproducer:

import HomotopyContinuation
import SymEngine
x=SymEngine.symbols("x")
C=HomotopyContinuation.System([x],variables=[x])

Produces:

Warning: detected a stack overflow; program state may be corrupted, so further execution might be unreliable.
ERROR: StackOverflowError:
Stacktrace:
     [1] convert(::Type{HomotopyContinuation.ModelKit.Expression}, x::SymEngine.Basic)
       @ Base .\number.jl:7
     [2] HomotopyContinuation.ModelKit.Expression(T::SymEngine.Basic)
       @ HomotopyContinuation.ModelKit C:\Users\gmgutow\.julia\packages\HomotopyContinuation\98yZ2\src\model_kit\symengine.jl:46
--- the above 2 lines are repeated 39990 more times ---
 [79983] convert(::Type{HomotopyContinuation.ModelKit.Expression}, x::SymEngine.Basic)
       @ Base .\number.jl:7

System Info
Windows 11
Julia 1.12.6
HomotopyContinuation v2.20.0
SymEngine v0.13.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions