Ask Your Question

Revision history [back]

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:

var('t')
y=function('y')(t)
x=function('x')(t)
desolve_system([diff(x,t) == y, diff(y,t) == -10*x + -2*y], [x,y])

The output is: [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)]

There ought to be two unknown constants, possibly x(0) and y(0), but instead there's only x(0), and a very strange-looking x(0) + 1. Is this a bug, or do I need to interpret it somehow?

When I specify initial conditions (ics=(0,1,2)) everything works fine.

This is with SageMath version 10.4, Release Date: 2024-07-19 on MacOS arm64 installed from the Homebrew cask.

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)
desolve_system([diff(x,t) print(desolve_system([diff(x,t) == y, diff(y,t) == -10*x + -2*y], [x,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: 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),
 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)]

There 3*cos(3*t))*e^(-t)]

Try it on SageMathCell

In the general solution, there ought to be two unknown constants, possibly constants x(0) and y(0), but instead there's only x(0), and a very strange-looking x(0) + 1. Is this a bug, or do

If I need to interpret 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)]

Try it somehow?

When I specify initial conditions (ics=(0,1,2)) everything works fine.on SageMathCell

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.

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)]

Try it on SageMathCell

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)]

Try it on SageMathCell

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.

Update: Still reproducible with SageMath 10.5. I have now reported it on Github as #39104.