I have a small program in Python that calculates 4 equations based on a function and its derivatives.
The problem comes when I use the solution of the first equation and try to replace it in another equation. I get the error of:
the list attribute is not compatible with subs.
Does anyone know how I can modify the following equations based on the first result?
Note. the program continues later but I am interested first to solve this error that focuses on the last lines.
import sympy as sp
g, a, A, C, D, K, x = sp.symbols("g a A C D K x")
X=(A*sp.cos(g*x/a))+(sp.sin(g*x/a))+(C*sp.exp(-g*x/a))+(D*sp.exp(-g*(a-x)/a))
dx1=sp.diff(X,x,1)
dx2=sp.diff(X,x,2)
eq1= sp.Eq(X.subs(x,0),0)
eq2= sp.Eq(dx2.subs(x,0)/dx1.subs(x,0),K)
eq3= sp.Eq(X.subs(x,a),0)
eq4= sp.Eq(dx2.subs(x,a)/dx1.subs(x,a),-K)
D1=sp.solve(eq1,D)
eq33=D1.subs(D,D1)