Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
dsolve fails for a system of independent equations #15574
Test case in Sympy 1.3:
If there are two independent equations the result is correct.
If there are three independent equations, the results from dsolve is wrong : it should be solvable but it is not in
Thanks for reporting this.
This is still the case on master. In fact for 4 equations it's even worse:
In : f1, f2, f3, f4 = symbols('f1 f2 f3 f4', cls=Function) In : eqs = [Eq(f(x).diff(x), f(x)) for f in (f1, f2, f3, f4)] In : eqs Out: ⎡d d d d ⎤ ⎢──(f₁(x)) = f₁(x), ──(f₂(x)) = f₂(x), ──(f₃(x)) = f₃(x), ──(f₄(x)) = f₄(x)⎥ ⎣dx dx dx dx ⎦ In : dsolve(eqs[:2]) Out: ⎡ x x⎤ ⎣f₁(x) = C₁⋅ℯ , f₂(x) = C₂⋅ℯ ⎦ In : dsolve(eqs[:3]) Out: ⎡ x ⎤ ⎣f₁(x) = C₁⋅ℯ , False, False⎦ In : dsolve(eqs[:4]) Out: ⎡ 2 x 3 x 2 x ⎤ ⎢ x x C₃⋅x ⋅ℯ C₄⋅x ⋅ℯ x x C₄⋅x ⋅ℯ x x x⎥ ⎢f₁(x) = C₁⋅ℯ + C₂⋅x⋅ℯ + ──────── + ────────, f₂(x) = C₂⋅ℯ + C₃⋅x⋅ℯ + ────────, f₃(x) = C₃⋅ℯ + C₄⋅x⋅ℯ , f₄(x) = C₄⋅ℯ ⎥ ⎣ 2 6 2 ⎦
The case with 4 equations is fixed by #15449:
In : dsolve(eqs[:4]) Out: ⎡ x x x x⎤ ⎣f₁(x) = C₁⋅ℯ , f₂(x) = C₂⋅ℯ , f₃(x) = C₃⋅ℯ , f₄(x) = C₄⋅ℯ ⎦
The other cases would be fixed by removing the various 2eq and 3eq functions that handle them and leaving it the fixed neq solver provided by #15449.