# Get TypeError: 'tuple' object is not callable

Just downloaded sage-8.0-Debian_GNU_Linux_8-x86_64.tar.bz2. Seems to be working well. Great work as always!

Trying to solve simultaneous equations. Get error "TypeError: 'tuple' object is not callable."

Found exactly the examples I needed in Basic Algebra and Calculus. Solving Equations (online Sage reference). Copied and pasted Jason Grout's example and also the examples above it. Get error message "TypeError: 'tuple' object is not callable." in notebook() , but examples work in terminal.

Here is one of the examples that gives the error in notebook() (but works in terminal). sage: x, b, c = var('x b c') sage: solve([x^2 + b*x + c == 0],x)

What am I missing here?

Any ideas? Thanks.

edit retag close merge delete

Your example works for me both in a terminal and in a notebook.

( 2017-11-30 21:26:21 +0200 )edit

A couple questions :

The only reference to a "Jason Groult's example" on equation solving seems to be http://doc.sagemath.org/html/en/tutor... (in the Tutorial, not in the Reference manual). Is that right ?

I cut'n pasted all the examples of the "Solving equations" section in a Jupyter notebook, and they work as advertised. What did you do exactly ?

( 2017-12-01 09:00:59 +0200 )edit

Emmanuel, you're right about the examples being in the tutorial. Thanks for taking the time to run the equations. Since they worked out for you, the problem is not in the code or Sage. In fact, I no longer get the error about calling tuples. Apparently, there was a conflict with other software on my computer. When I just used the python interpreter, I had to unset PYTHONHOME in order to start the interpreter. Looks like Sage is not the problem here.

( 2017-12-02 02:29:32 +0200 )edit

Sort by » oldest newest most voted

eric__g's comment that the code ran fine for him in both terminal and notebook() suggested that the problem was in my system as opposed to being a bug in Sage.

I was going to unset PYTHONHOME, but first I ran the code again in notebook() and it ran without error. I am going to mark this question as solved as it is no longer reproducible.

I would give credit to eric__g, but don't see any way to do mark a comment as an answer.

It seems unlikely that running the code in terminal would change anything on my computer that would allow the code to subsequently run in notebook() without error. All I can say is that the code (one example is in my original post) now runs without error, while originally it did not.

Not much of an answer, but the best I can do, Bob.

more

Indeed, a tuple is not callable!

What does it mean... a tuple is a Python datastructure and you can use is at a function: if t is a tuple t() will not work

sage: t = (1,2)
sage: t()
Traceback (most recent call last):
...
TypeError: 'tuple' object is not callable


If you want help on your specific question you should provide details about what you did cut and paste...

more

Thanks for the info. This definitely helps me understand what the error message normally means. However, in this case I don't know if the error message really relates to the input; for example:
sage: x, b, c = var('x b c') sage: solve([x^2 + b*x + c == 0],x) gave the error message in notebook(), but in terminal the standard solution for the quadratic formula with no error .

( 2017-12-01 06:44:07 +0200 )edit