Ask Your Question
1

Solving system of ODE gets "ValueError"

asked 2017-07-16 01:16:48 +0100

xuesen_umd gravatar image

updated 2023-01-09 23:59:47 +0100

tmonteil gravatar image

I'm trying to solve a system of ODE using desolve_system but get "ValueError":

t=var('t'); f=function('f')(t); g=function('g')(t);
de1 = diff(f,t) == f*sin(t);
de2 = diff(g,t) == 0;
desolve_system([de1, de2], [f,g])

gets:

Traceback (click to the left of this block for traceback)
...
ValueError: The name "+" is not a valid Python identifier

the problem seems to be sin(t) factor, without it the system solves with no problem. Also desolve(de1, f) has no problem. What is going on here?

Thanks in advance!

edit retag flag offensive close merge delete

Comments

Your equations are independent. Note that solving the equation one by one does work

sage: desolve(de1, f)
_C*e^(-cos(t))
sage: desolve(de2, g)
_C
vdelecroix gravatar imagevdelecroix ( 2017-07-16 13:11:19 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-07-16 19:48:14 +0100

vdelecroix gravatar image

The problem comes from the fact that Sage is not able to understand Maxima's answer

f(_SAGE_VAR_t) = ilt((%i laplace(f(_SAGE_VAR_t), _SAGE_VAR_t, g2579 + %i)
 - %i laplace(f(_SAGE_VAR_t), _SAGE_VAR_t, g2579 - %i) + 2 f(0))/(2 g2579), g2579, _SAGE_VAR_t)

I opened the ticket #23445 to track the issue.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-07-16 01:16:07 +0100

Seen: 374 times

Last updated: Jul 16 '17