Suppose I have the code below. I want to get either the right side of the equation (C1 +x...). How do I do that?
My problem is I have some boundary conditions for derivatives of f(x) at specific points, so I want to calculate those and find out the constants. I have also different values for w(x), so the final code will begin defining a variable called wx instead of having 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)
expr.lhs
and expr.rhs
will give you the left- and right-hand sides of the equation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With