[Date Index] [Thread Index] [Author Index]
Re: Wrong ODE solution in Mathematica 7?
The result given by Mathematica is correct. Before claiming that it is wrong, I would certainly consider learning about other ways of checking the correctness of the answer other than literal comparison with the answer from the book. Your equation can be solved by simply integrating both parts twice over x. The part with unknown constants emerges as a result of this integration and is a solution of the homogeneous equation (with the zero r.h.s). Integrating the r.h.s: In:= Integrate[-Cos[x]/(1 + Sin[x])^2, x] Out= 1/(1 + Sin[x]) In:= Integrate[1/(1 + Sin[x]), x] Out= (2 Sin[x/2])/(Cos[x/2] + Sin[x/2]) The first integral is also trivial to do by hand. One way to do the second integral manually is to expand Sin : In:= 1/(1 + Sin[x]) /. Sin[x] -> 1/(2 I) (Exp[I*x] - Exp[-I*x]) // Simplify Out= (2 I E^(I x))/(I + E^(I x))^2 By substituting Exp[I*x]->t we have an integral Integrate[2/(I+t)^2,t], which is trivial. The result is In:= Integrate[2/(I + t)^2, t] /. t -> Exp[I*x] Out= -(2/(I + E^(I x))) This can be simplified to be a desired answer plus a constant (I -1), the latter can be absorbed in the constant part C of the solution: In:= FullSimplify[-(2/(I + E^(I x))) - (2 Sin[x/2])/( Cos[x/2] + Sin[x/2])] Out= -1 + I You could also check the final result by a direct differentiation: In:= D[C + x C + (2 Sin[x/2])/(Cos[x/2] + Sin[x/2]), x, x] == -Cos[x]/(1 + Sin[x])^2 // FullSimplify Out= True As to a seeming discrepancy with the other sources, I think you should pay more attention to signs. Perhaps, observing this may be helpful: In:= 1/(1 + Tan[x]) + 1/(1 + Cot[x]) // FullSimplify Out= 1 As before, constants don't matter - they are absorbed into the definition of C. Hope this helps. Regards, Leonid On Mon, Jan 4, 2010 at 2:58 AM, Zsolt <phyhari at gmail.com> wrote: > Hi! > I tried solve the ODE: > DSolve[D[y[x], x, x] == -Cos[x]/(1 + Sin[x])^2, y[x], x] > > The solution what M7 (and Wolfram Alpha) gives is: > y[x] -> C + x C + (2 Sin[x/2])/(Cos[x/2] + Sin[x/2]) > > I think, it's wrong! (Does anybody know how to check?) Another system gives > for the same diff.eq: > y(x) = -2/(tan((1/2)*x)+1)+_C1*x+_C2 > (similar, but not the same->ctan vs tan...) > I found the problem in one of my math books, and the solution there > concours with the other system. > How can I trust Mathematica, if it makes mistakes in such simple > things?? :( > Thank you for your answer! :) > >