Skip to content

Segfault when using sympy symbols as initial conditions. #129

@LilithHafner

Description

@LilithHafner

This segfaults:

from diffeqpy import de
from sympy import Symbol

# Exponential decay
def f(u, p, t):
    return [-u[0] * p]

u0 = Symbol('u0') # or 1.0
p = Symbol('p') # or 1.0
t = (0.0, 1.0)

problem = de.ODEProblem(f, [u0], t, p)
solution = de.solve(problem)

Changing p and u0 to floats instead of symbolic variables fixes the problem:

u0 = 1.0 u0 = Symbol('u0')
p = 1.0 Correct answer Segfault
p = Symbol('p') Error Segfault

Versions

Python 3.11.6 (main, Oct  2 2023, 20:46:14) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
diffeqpy 2.2.0
sympy 1.12
DifferentialEquations 7.11.0
Julia Version 1.9.3
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M2
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions