Ask Your Question
0

Get TypeError: 'tuple' object is not callable

asked 2017-11-30 11:26:36 +0200

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

Comments

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

eric_g gravatar imageeric_g ( 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 ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 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.

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

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-12-01 03:28:22 +0200

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
0

answered 2017-11-30 21:17:51 +0200

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

Comments

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-12-01 06:44:07 +0200 )edit

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-11-30 11:26:36 +0200

Seen: 10,782 times

Last updated: Dec 01 '17