1 | initial version |
Do not use the same identifier for a symbolic function and the symbolic expression resulting from the evaluation of this function at T_s, e.g. write BT = function('B')(T_s)
instead of B = function('B')(T_s)
. Then define a callable symbolic expression for the explicit form you want to substitute, e.g. H0(T_s) = T_s^2
. Finally use substitute_function
instead of subs
. Here is the full code:
sage: var('T_s')
T_s
sage: BT = function('B')(T_s)
sage: ET = function('E')(T_s)
sage: HT = function('H')(T_s)
sage: eq_B_TS = BT == HT/ET
sage: eq1 = diff(eq_B_TS, T_s)
sage: eq1
diff(B(T_s), T_s) == -H(T_s)*diff(E(T_s), T_s)/E(T_s)^2 + diff(H(T_s), T_s)/E(T_s)
sage: H0(T_s) = T_s^2
sage: eq1.substitute_function(H, H0)
diff(B(T_s), T_s) == -T_s^2*diff(E(T_s), T_s)/E(T_s)^2 + 2*T_s/E(T_s)