Ask Your Question

variables vs arguments

asked 2013-02-08 19:26:22 -0500

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



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 01:55:55 -0500 )edit

You may also find and the rest of the tutorials at helpful.

kcrisman gravatar imagekcrisman ( 2013-02-09 01:56:27 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-02-10 02:30:12 -0500

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):
            return self._parent.arguments()
        except AttributeError:
            return self.variables()

For callable expressions, they differ:

sage: t.arguments()
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


Asked: 2013-02-08 19:26:22 -0500

Seen: 87 times

Last updated: Feb 10 '13