How to get both sides of an equation in SymPy?

Suppose I have the code below. I want to get either the right side of the equation (C1 + x ...). How to do it?

My problem: I have some boundary conditions for derivatives of f (x) at certain points, so I want to calculate them and find out the constants. I also have different values ​​for w (x), so the final code will start to determine the variable wx instead of the function w (x).

from __future__ import division
from sympy import *
x, y = symbols('x y')
w, f = symbols('w f', cls=Function)
init_printing(use_unicode=True)

diffeq = f(x).diff(x,x,x,x)-w(x)
expr = dsolve(diffeq, f(x))

print diffeq
print expr

results:

-w(x) + Derivative(f(x), x, x, x, x)
f(x) == C1 + x**3*(C4 + Integral(w(x)/6, x)) + x**2*(C3 - Integral(x*w(x)/2, x)) + x*(C2 + Integral(x**2*w(x)/2, x)) - Integral(x**3*w(x)/6, x)
+4
source share
1 answer

expr.lhsand expr.rhsgive you the left and right sides of the equation.

+3
source

All Articles