"Cody" wrote in message <keekng$cpo$1@newscl01ah.mathworks.com>...
> 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
Your equation is secondorder nonlinear, and represents diffusion in most systems. As the continuous eigenspace of this equation is known to be stable, without an inital condition that is nonzero, or a differential set of BC's, I'm not sure that you could expect anything other than 0. Think the timemarching heat equation  an initial hot spot fades to a uniform value over the domain (assuming no energy loss). If you clamp the BC's to be 0 on the hot domain, the whole system will, in time, diffuse to zero  which is exactly what you have done here.
Putting a perturbation into the system shows this:
>> N(x)=dsolve( diff(P,2)==C*P, P(L/2)==0.001, P(L/2)==0.000 )
N(x) =
(exp((2^(1/2)*L*(E*m)^(1/2))/(2*h))*exp((2^(1/2)*x*(E*m)^(1/2))/h))/(1000*(exp((2^(1/2)*L*(E*m)^(1/2))/h)  exp((2^(1/2)*L*(E*m)^(1/2))/h)))  (exp((2^(1/2)*L*(E*m)^(1/2))/(2*h))*exp((2^(1/2)*x*(E*m)^(1/2))/h))/(1000*(exp((2^(1/2)*L*(E*m)^(1/2))/h)  exp((2^(1/2)*L*(E*m)^(1/2))/h)))
Alternativly, solving your unclamped case for zero at the ends is not possible, and with a perturbation, the result is still zero.
>> solve(log(C1/C2)/C^(1/2)==log(C2/C1)/C^(1/2)+eps)
ans =
20282409603651670423947251286016*(log(C1/C2)  log(C2/C1))^2
When the BC's go to 0, matlab is solving a quoteit of 1/Inf, producing zero.
Cheers
