Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when using sympy symbols as initial conditions. #129

Open
LilithHafner opened this issue Oct 30, 2023 · 0 comments
Open

Segfault when using sympy symbols as initial conditions. #129

LilithHafner opened this issue Oct 30, 2023 · 0 comments

Comments

@LilithHafner
Copy link
Member

LilithHafner commented Oct 30, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant