First time here? Check out the FAQ!

Ask Your Question
1

variables vs arguments

asked 12 years ago

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!

Preview: (hide)

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 ( 12 years ago )

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 ( 12 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 12 years ago

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)
Preview: (hide)
link

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: 12 years ago

Seen: 371 times

Last updated: Feb 10 '13