Bugs when solving a system of ODEs

23 views
Skip to first unread message

Moe

unread,
Jul 7, 2025, 9:46:14 AMJul 7
to sympy
Greetings

I am having trouble  solving a system of ODEs:
__________________________
from sympy import *

r=Symbol('r')
A=Function('A')(r)
B=Function('B')(r)

A1 = Derivative(A, r)
B1 = Derivative(B, r)

#eqs = [Eq(A*B, 0), Eq(B, 0)] #line1
#sol = dsolve(eqs, [A, B]) #line2

#eqs = [Eq(A1*B1, 0), Eq(A*B-1, 0)] #line3
#sol = dsolve(eqs, [A, B]) #line4

#eqs = [Eq(A1-B, 0), Eq(B1-B, 0)] #line5
#sol = dsolve(eqs, [A, B]) #line6

print(sol)
__________________________
uncommenting lines 1 and 2, I get the error:
File "C:\...\sympy\solvers\ode\systems.py", line 2097, in dsolve_system
    t = list(list(eqs[0].atoms(Derivative))[0].atoms(Symbol))[0]
IndexError: list index out of range

uncommenting lines 3 and 4, I get the error:
 KeyError: Derivative(B(r), r)

uncommenting lines 5 and 6, I get no errors.

So are these errors bugs?
Reply all
Reply to author
Forward
0 new messages