How to substitute variable in expression contains its derivative also

Starpower_Power
Tue, 04 Oct 2022 16:39:02 +0000
General Usage

using SymPy
using PyCall
sp  = pyimport("sympy")
t1 = sp.Function("theta_1")(t)
f = t1^2 +t1
df = sp.diff(f,t)
# so df = 2*t1*(d(t1)/d(t))+ (d(t1)/d(t))
# if substitution done of t1 value that is t1 = 2
s =  df.subs([(t1,2)])
# the s is  s = 2*2*(d(2)/d(t))+ (d(2)/d(t))
#  but i need s =2*2*(d(t1)/d(t))+ (d(t1)/d(t))

so i need that sympy will treat two different things t1 and d(t1)/dt
thanks…

3 posts - 2 participants