Ask Your Question
1

Question for formatted output

asked 2023-07-15 18:03:23 +0100

pfeifhns gravatar image

updated 2023-07-16 20:32:27 +0100

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

edit retag flag offensive close merge delete

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 ( 2023-07-16 20:45:49 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2023-07-16 20:43:56 +0100

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,

edit flag offensive delete link more
0

answered 2023-07-16 12:14:34 +0100

pfeifhns gravatar image

Thank you very much! It works !!

edit flag offensive delete link more

Comments

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

slelievre gravatar imageslelievre ( 2023-07-21 15:48:55 +0100 )edit

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: 2023-07-15 18:03:23 +0100

Seen: 287 times

Last updated: Jul 16 '23