First time here? Check out the FAQ!

Ask Your Question
1

function vs expression

asked 3 years ago

eyal gravatar image

Hi there,

Is there a difference between, e.g.,

g=x^2

and

f(x)=x^2

?

In the literature the first is considered to be an expression while the other is a function, but checking their types gives

<class 'sage.symbolic.expression.Expression'>

in both cases.

Preview: (hide)

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 3 years ago

tmonteil gravatar image

You should check their parent:

sage: g.parent()
Symbolic Ring

sage: f.parent()
Callable function ring with argument x

sage: f(x).parent()
Symbolic Ring
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

1 follower

Stats

Asked: 3 years ago

Seen: 271 times

Last updated: Aug 29 '21