Differentiating the equation

I want to differentiate the following equation

from sympy import * init_printing() x, t, r, phi = symbols('x, t, r, phi') # this is how I want to do it eq = Eq(x(t), r*phi(t)) eq.diff(t) 

enter image description here

The result is differentiated only on the left side. I would like it to be evaluated on both sides. Is this possible in a simple way?

I am currently doing the following:

 Eq(eq.lhs.diff(t), eq.rhs.diff(t)) 
+5
source share
1 answer

Borrowing part of the Sympy logic : working with equalities manually , you can do something like this:

 eq.func(*map(lambda x: diff(x, t), eq.args)) 

A bit ugly, but it works. Alternatively, you can simply raise the .do() method and use it if you want to do this several times.

+1
source

Source: https://habr.com/ru/post/1234700/


All Articles