Ask Your Question
1

symbolic differentiation of unknown function

asked 2020-01-04 14:10:03 -0500

asger gravatar image

updated 2020-01-04 17:34:45 -0500

slelievre gravatar image

I want to do some formal calculus with unknown functions for the purpose of solving differential equations.

Say F(t) = v(t)*t^2, where v is an unknown differentiable function.

Then I would like to declare v as such and be able to get

F.diff(t) = 2*t*v+t^2*v.diff(t)

It is similar to Ask Sage question 8822 but the solution does not seem to work anymore, as function() takes only one argument and not 2 as in the description.

Anyone know what the syntax is in 8.9? Or in 9.0, when that becomes available?

edit retag flag offensive close merge delete

Comments

Note: I updated the answer to Ask Sage question 8822.

slelievre gravatar imageslelievre ( 2020-01-04 17:34:29 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2020-01-04 17:30:27 -0500

slelievre gravatar image

Here is how to do it.

Works with the following version of Sage.

sage: version()
'SageMath version 9.0, Release Date: 2020-01-01'

Declare variable t and function v, and define function F in terms of those:

sage: t = SR.var('t')
sage: v = function('v')
sage: F(t) = v(t)*t^2

Derivative of the function:

sage: F.diff(t)
t |--> t^2*diff(v(t), t) + 2*t*v(t)

Derivative of the expression:

sage: F(t).diff(t)
t^2*diff(v(t), t) + 2*t*v(t)
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

1 follower

Stats

Asked: 2020-01-04 14:10:03 -0500

Seen: 40 times

Last updated: Jan 04