TypeError: 'tuple' object is not callable on notebook but not on terminal

asked 2021-02-24 12:41:31 +0100

math1styearstudent gravatar image

Code :

x=var('x')
y=function('y')(x)
k= var('k')
assume(k>0)
harmonic2 = diff(y,x,2)+k*y == 0
desolve(harmonic2, y, ivar = x)

Error :

TypeError                              Traceback (most recent call last) <ipython-input-54-ef4195c42a80> in <module>
      4 assume(k>Integer(0))
      5 harmonic2 = diff(y,x,Integer(2))+k*y == Integer(0)
----> 6 desolve(harmonic2, y, ivar = x)

TypeError: 'tuple' object is not callable

Why does this happen when i tried it in notebook but when i tried it in notepad but it ran fine on the terminal

edit retag flag offensive close merge delete

Comments

1

I do not see the problem. I get this answer both in a terminal and in a Jupyter notebook:

_K2*cos(sqrt(k)*x) + _K1*sin(sqrt(k)*x)
Juanjo gravatar imageJuanjo ( 2021-02-24 14:04:01 +0100 )edit

@math1styearstudent -- by any chance was desolve redefined in the notebook?

Does the problem persist after reset('desolve')?

slelievre gravatar imageslelievre ( 2021-02-24 18:50:07 +0100 )edit

I cannot reproduce the problem either. The code works well both in the notebook and the terminal.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-02-25 18:45:39 +0100 )edit

@math1styearstudent -- what OS? what version of Sage? How was it installed?

slelievre gravatar imageslelievre ( 2021-02-25 21:25:36 +0100 )edit

In my case it's Sage 9.2 with Python 3.8.5 in Ubuntu 20.04.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-02-25 21:37:33 +0100 )edit