Assuming a function is constant in computing later expressions

33 views
Skip to first unread message

Mauricio Calvao

unread,
Aug 31, 2017, 3:59:03 PM8/31/17
to sage-support
I have declared a function Omega of a single variable t through:

Omega = function('Omega')(t)

Afterwards, I have calculated a quantity whose generic result is given in terms of the derivative of Omega (let us call it dOmega), for instance:

quanti = Omega(t)*cos(t) + dOmega(t)

Since I know the particular form for this quantity in the case Omega is constant, how can I make Sage assume, in this generic result, that Omega is constant, so that I can really verify the validity of the generic expression in this particular case? Of course we have to recover then:

quanti = Omega(t)*cos(t)

Eric Gourgoulhon

unread,
Sep 1, 2017, 5:29:11 AM9/1/17
to sage-support
What about something like:

sage: t = var('t')
sage
: Omega = function('Omega')
sage
: quanti = Omega(t)*cos(t) + diff(Omega(t), t)
sage
: quanti
Omega(t)*cos(t) + diff(Omega(t), t)
sage
: Omega0 = var('Omega0')
sage
: Omega_const(t) = Omega0
sage
: quanti.substitute_function(Omega, Omega_const)
Omega0*cos(t)


Eric.
Reply all
Reply to author
Forward
0 new messages