Ask Your Question
1

Question for formatted output

asked 1 year ago

pfeifhns gravatar image

updated 1 year ago

Emmanuel Charpentier gravatar image

Hello, when executing the commands

t=var('t')
g(t)=t^2
diff(g,t)

I get as a result:

t -> 2t

I only want 2t and not the leading t ->

What can I do?

Thank you for your efforts,

Hans

Preview: (hide)

Comments

Edited for legibility.

Delimit your inline code fragments by backticks and code snippets in lines indented by four spaces, or use the "010101" button...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 1 year ago )

2 Answers

Sort by » oldest newest most voted
0

answered 1 year ago

Emmanuel Charpentier gravatar image

The point is that g(t)=t^2 creates g as a "symbolic function" (properly a callable symbolic expression), whereas t^2 is a symbolic expression.

sage: g
t |--> t^2
sage: g(t)
t^2
sage: g.is_callable()
True
sage: g(t).is_callable()
False

Differentiating a functin gets you a function, whereas differentiating a symbolic expression gets you a symbolic expression :

sage: g.diff(t)
t |--> 2*t
sage: g(t).diff(t)
2*t

HTH,

Preview: (hide)
link
0

answered 1 year ago

pfeifhns gravatar image

Thank you very much! It works !!

Preview: (hide)
link

Comments

Please post such feedback as a comment to the answer, not as a new answer.

slelievre gravatar imageslelievre ( 1 year ago )

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: 1 year ago

Seen: 304 times

Last updated: Jul 16 '23