Ask Your Question

Get TypeError: 'tuple' object is not callable

asked 2017-11-30 04:26:36 -0500

bbtp gravatar image

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 flag offensive close merge delete


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

eric_g gravatar imageeric_g ( 2017-11-30 14:26:21 -0500 )edit

A couple questions :

The only reference to a "Jason Groult's example" on equation solving seems to be (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 ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2017-12-01 02:00:59 -0500 )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.

bbtp gravatar imagebbtp ( 2017-12-01 19:29:32 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2017-11-30 14:17:51 -0500

vdelecroix gravatar image

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...

edit flag offensive delete link 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 .

bbtp gravatar imagebbtp ( 2017-11-30 23:44:07 -0500 )edit

answered 2017-11-30 20:28:22 -0500

bbtp gravatar image

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.

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


Asked: 2017-11-30 04:26:36 -0500

Seen: 1,518 times

Last updated: Nov 30 '17