Strange constants in desolve_system result for first-order linear system
I'm trying to find the general solution of a first-order linear system with desolve_system
. I solved it first with initial conditions, and then wanted to find the general solution:
var('t') y=function('y')(t) x=function('x')(t) print(desolve_system([diff(x,t) == y, diff(y,t) == -10*x + -2*y], [x,y], ics=[0,-1,1])) print(desolve_system([diff(x,t) == y, diff(y,t) == -10*x + -2*y], [x,y]))
The output is:
[x(t) == -cos(3*t)*e^(-t), y(t) == (cos(3*t) + 3*sin(3*t))*e^(-t)] [x(t) == 1/3*((x(0) + 1)*sin(3*t) + 3*cos(3*t)*x(0))*e^(-t), y(t) == -1/3*((10*x(0) + 1)*sin(3*t) - 3*cos(3*t))*e^(-t)]
In the general solution, there ought to be two unknown constants x(0)
and y(0)
, but instead there's only x(0)
, and a very strange-looking x(0) + 1
.
If I omit the preceding desolve_system
with initial values, then I get the expected output
[x(t) == 1/3*((x(0) + y(0))*sin(3*t) + 3*cos(3*t)*x(0))*e^(-t), y(t) == -1/3*((10*x(0) + y(0))*sin(3*t) - 3*cos(3*t)*y(0))*e^(-t)]
This is reproducible on SageMathCell and also with SageMath version 10.4, Release Date: 2024-07-19
on MacOS arm64 installed from the Homebrew cask.
At Sagecell (running Sage 10.2) and at my local Sage 10.5beta, result is
I updated the test case. It seems that an earlier command had an effect.
It looks like a bug. Please report at https://github.com/sagemath/sage/issues
This may or may not be a bug :
This strange-looking solution does check the original equations :
But this solution may be only part of the solution.
To be continued...
Follow-up.
Sympy offers a more complete solution :
which does check the original differential equations: