Ask Your Question
1

variables vs arguments

asked 2013-02-09 02:26:22 +0100

hacaoideas gravatar image

I'm a newbie so please excuse me with this silly question. I just move from Mathematica to SAGE.

I cannot tell the difference between arguments and variables in SAGE. What're the differences?

Please help.

Thank you in advance!

edit retag flag offensive close merge delete

Comments

2

The right answer to your question is probably "read a Python tutorial", but I think we want to help more than that. Can you give a specific example of where you are finding things confusing (such as a command that works differently)? That would help us a lot in tailoring the answer.

kcrisman gravatar imagekcrisman ( 2013-02-09 08:55:55 +0100 )edit

You may also find http://sagemath.org/doc/prep/Intro-Tutorial.html and the rest of the tutorials at http://sagemath.org/doc/prep/ helpful.

kcrisman gravatar imagekcrisman ( 2013-02-09 08:56:27 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-02-10 09:30:12 +0100

For symbolic expressions, variables() and arguments() methods return the same result. You can observe this by adding ?? at the end of the function name and taking a look at the code.

sage: var('a,b')
(a, b)
sage: t = a*x^2
sage: t.arguments??
    def arguments(self):
...
        try:
            return self._parent.arguments()
        except AttributeError:
            return self.variables()

For callable expressions, they differ:

sage: t.arguments()
(x,)
sage: t.variables()
(a, x)
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

Stats

Asked: 2013-02-09 02:26:22 +0100

Seen: 330 times

Last updated: Feb 10 '13