"Cody" wrote in message <firstname.lastname@example.org>... > Hello everyone, I'm trying to solve the standard 2nd order differential equation with constant coefficients listed below under the specified boundary conditions: > > -dP(x)^2/dx^2 = C * P(x) where C=(2*E*m)/h^2 > > under the boundary conditions P(-L/2)=0 and P(L/2)=0 for some constant L>0. > > Matlab is able to solve the equation with the expected general solution, however, when I apply the boundary conditions, the 'dsolve' command fails. I know a solution exists under these boundary conditions because I can successfully solve the equation by hand, and the solution is listed in a textbook. > > Matlab correctly calculates the general solution 'P(x)': > > syms C E m h P(x) real > C=(E*2*m)/h^2; > assume(C>0 & E>0 & m>0 & h>0) > P(x)=dsolve( -diff(P,2)==C*P ) > > However, when I attempt to apply the boundary conditions Matlab calculates P(x)=0. I would appreciate any advice on how to correctly setup Matlab to solve this type of differential equation. > > syms C E m h L P(x) real > C=(E*2*m)/h^2; > assume(C>0 & E>0 & m>0 & h>0 & L>0) > P(x)=dsolve( -diff(P,2)==C*P, P(-L/2)==0, P(L/2)==0 ) > > Thank you, > -MntGoat
P(x)=0 actually _is_ the solution of your ODE under the prescribed boundary conditions. Insert it in your differential equations and you will see that it satisfies both the differential equation and the boundary conditions.