Re: Simple DSolve equation
- To: mathgroup at smc.vnet.net
- Subject: [mg122627] Re: Simple DSolve equation
- From: "Dr. Wolfgang Hintze" <weh at snafu.de>
- Date: Fri, 4 Nov 2011 05:58:26 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j8tkpb$f14$1@smc.vnet.net>
"Rui" <rui.rojo at gmail.com> schrieb im Newsbeitrag news:j8tkpb$f14$1 at smc.vnet.net... > Why does something like this not give the correct answer with > restrictions over k? > How would you go about getting the right general solutions in these > kind of basic differential equations? > > Thanks > > DSolve[{y''[x] == k y[x], y[0] == 0, y[10] == 0}, y[x], x] > Out={{y[x] -> 0}} > Interesting question. Because I always had in mind to put down the procedure I'll do it here though the elaborated version might be a little lengthy. I have deleted the Ins and Outs and the error messages for ease of reading. We will find all solutions (the trivial and he non-trivial ones) in the following way. First we DSolve the differential equation with just one condition (at x= 0, say), and then impose the second condition as a Solve requirement on the set of solutions thus obtained. We shall see that Solve does all the fine "quantization" we expect, i.e it gives us the possible values of the parameter k. For better transparency we shall first apply Reduce, and Solve afterwards. The code is found below Best regards, Wolfgang Begin of code f[x_] = y[x] /. DSolve[{Derivative[2][y][x] == k*y[x], y[0] == 0}, y[x], x][[1]] (-E^((-Sqrt[k])*x))*(-1 + E^(2*Sqrt[k]*x))*C[2] First Reduce, r = Reduce[Simplify[f[10]] == 0] (E^Sqrt[k] == -1 - E^(2*Sqrt[k]) - E^(3*Sqrt[k]) - E^(4*Sqrt[k]) && 1 + E^(2*Sqrt[k]) + E^(3*Sqrt[k]) + E^(4*Sqrt[k]) != 0) || (E^Sqrt[k] == 1 + E^(2*Sqrt[k]) - E^(3*Sqrt[k]) + E^(4*Sqrt[k]) && 1 + E^(2*Sqrt[k]) - E^(3*Sqrt[k]) + E^(4*Sqrt[k]) != 0) || (E^(2*Sqrt[k]) == -1 && E^Sqrt[k] != 0) || (E^(2*Sqrt[k]) == 1 + E^(4*Sqrt[k]) - E^(6*Sqrt[k]) + E^(8*Sqrt[k]) && E^Sqrt[k] != 0) || (C[2] == 0 && E^Sqrt[k] != 0) || E^Sqrt[k] == -1 || E^Sqrt[k] == 1 Length[r] 7 now Solve, one by one n = 1; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] E^Sqrt[k] == -1 - E^(2*Sqrt[k]) - E^(3*Sqrt[k]) - E^(4*Sqrt[k]) && 1 + E^(2*Sqrt[k]) + E^(3*Sqrt[k]) + E^(4*Sqrt[k]) != 0 {{k -> -((16*Pi^2)/25)}, {k -> -((4*Pi^2)/25)}, {k -> Log[-(-1)^(1/5)]^2}, {k -> Log[-(-1)^(3/5)]^2}} {-2*I*C[2]*Sin[(4*Pi*x)/5], -2*I*C[2]*Sin[(2*Pi*x)/5], -2*I*C[2]*Sin[(4*Pi*x)/5], -2*I*C[2]*Sin[(2*Pi*x)/5]} n = 2; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] E^Sqrt[k] == 1 + E^(2*Sqrt[k]) - E^(3*Sqrt[k]) + E^(4*Sqrt[k]) && 1 + E^(2*Sqrt[k]) - E^(3*Sqrt[k]) + E^(4*Sqrt[k]) != 0 {{k -> -((9*Pi^2)/25)}, {k -> -(Pi^2/25)}, {k -> Log[-(-1)^(2/5)]^2}, {k -> Log[-(-1)^(4/5)]^2}} {-2*I*C[2]*Sin[(3*Pi*x)/5], -2*I*C[2]*Sin[(Pi*x)/5], -2*I*C[2]*Sin[(3*Pi*x)/5], -2*I*C[2]*Sin[(Pi*x)/5]} n = 3; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] E^(2*Sqrt[k]) == -1 && E^Sqrt[k] != 0 {{k -> -(Pi^2/4)}} {-2*I*C[2]*Sin[(Pi*x)/2]} n = 4; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] E^(2*Sqrt[k]) == 1 + E^(4*Sqrt[k]) - E^(6*Sqrt[k]) + E^(8*Sqrt[k]) && E^Sqrt[k] != 0 {{k -> -((81*Pi^2)/100)}, {k -> -((49*Pi^2)/100)}, {k -> -((9*Pi^2)/100)}, {k -> -(Pi^2/100)}, {k -> Log[-(-1)^(1/10)]^2}, {k -> Log[-(-1)^(3/10)]^2}, {k -> Log[-(-1)^(7/10)]^2}, {k -> Log[-(-1)^(9/10)]^2}} {-2*I*C[2]*Sin[(9*Pi*x)/10], -2*I*C[2]*Sin[(7*Pi*x)/10], -2*I*C[2]*Sin[(3*Pi*x)/10], -2*I*C[2]*Sin[(Pi*x)/10], -2*I*C[2]*Sin[(9*Pi*x)/10], -2*I*C[2]*Sin[(7*Pi*x)/10], -2*I*C[2]*Sin[(3*Pi*x)/10], -2*I*C[2]*Sin[(Pi*x)/10]} n = 5; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] C[2] == 0 && E^Sqrt[k] != 0 {0} n = 6; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] E^Sqrt[k] == -1 {{k -> -Pi^2}} {-2*I*C[2]*Sin[Pi*x]} n = 7; r[[n]] Solve[r[[n]]] fs[n] = FullSimplify[f[x] /. %, x \[Element] Reals] E^Sqrt[k] == 1 {{k -> 0}} {0} Finally, we put everything together (and letting C[2] -> 1/(-2*I) which gives the list a nicer appeal) Union[Flatten[Table[fs[i], {i, 1, 7}]]] /. C[2] -> 1/(-2*I) {0, Sin[(Pi*x)/10], Sin[(Pi*x)/5], Sin[(3*Pi*x)/10], Sin[(2*Pi*x)/5], Sin[(Pi*x)/2], Sin[(3*Pi*x)/5], Sin[(7*Pi*x)/10], Sin[(4*Pi*x)/5], Sin[(9*Pi*x)/10], Sin[Pi*x]} End of code