From: Peter Breitfeld on 5 Jan 2010 01:43 Zsolt 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[1] + x C[2] + (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! :) > There is no mistake, because the solutions are equivalent. Mathematica solution: f[x_]=C[1] + x*C[2] + (2*Sin[x/2])/(Cos[x/2] + Sin[x/2]) Other solution: g[x_]= B + A*x - 2/(1 + Tan[x/2]) Comparison: f[x]-g[x] //FullSimplify Out= 2 - B - A x + C[1] + x C[2] So the solutions are identical, supposed you choose A=C[2] and B=2+C[1] as integration constants. -- _________________________________________________________________ Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de
From: Murray Eisenberg on 5 Jan 2010 01:44 Mathematica has NOT made any error there! How would YOU check that a purported solution of an ODE is in fact a solution? I hope you would know to do that by simply "plugging in". (And if you don't know that, then you have no business trying to solve differential equations, with any CAS or by hand!) Let's try it: y[x_] = C[1] + x*C[2] + (2*Sin[x/2])/(Cos[x/2] + Sin[x/2]) y''[x] == -Cos[x]/(1 + Sin[x])^2 // Simplify True (I presume you trust that Mathematica knows how to take derivatives and do simple algebraic and trig simplifications!) Now what about the solution provided by the "other system"? Let's plug that in and check: z[x_] = -2/(Tan[(1/2)*x] + 1) + C1*x + C2 z''[x] == -Cos[x]/(1 + Sin[x])^2 // Simplify True Hmm... two solutions for the same 2nd order ODE. If we specify a set of two initial conditions, we hope the solution will be unique (on some suitable interval). Let's use the values of the function and its derivative at 0. cstRules=First(a)Solve[{y[0],y'[0]}=={z[0],z'[0]},{C1,C2}] {C2 -> 2 + C[1], C1 -> C[2]} w[x_] = z[x] /. cstRules; w[x] == y[x] // Simplify True Tada! I leave it as an exercise to see why the two solutions are just different forms of the same function. Zsolt 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[1] + x C[2] + (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! :) > -- Murray Eisenberg murray(a)math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
From: DrMajorBob on 5 Jan 2010 01:45 Here are the two solutions: y1[x_] = y[x] /. First(a)DSolve[D[y[x], x, x] == -Cos[x]/(1 + Sin[x])^2, y[x], x] C[1] + x C[2] + (2 Sin[x/2])/(Cos[x/2] + Sin[x/2]) y2[x_] = -2/(Tan[(1/2)*x] + 1) + C[3]*x + C[4] x C[3] + C[4] - 2/(1 + Tan[x/2]) error[x_] = y1[x] - y2[x] // Simplify 2 + C[1] + x (C[2] - C[3]) - C[4] Now take the second derivative: D[error@x, x, x] 0 or... d1 = D[y1@x, x, x] // Simplify (-Cos[x/2] + Sin[x/2])/(Cos[x/2] + Sin[x/2])^3 d2 = D[y2@x, x, x] // TrigExpand // Simplify (-Cos[x/2] + Sin[x/2])/(Cos[x/2] + Sin[x/2])^3 d1 == d2 True Hence, both functions have the same second derivative. If either solves the problem, both of them do. Does either of them solve it? Simplify says, "Yes!" d1 == d2 == -Cos[x]/(1 + Sin[x])^2 // Simplify True To verify it in a more transparent manner: -(Cos[x]/(1 + Sin[x])^2) /. x -> 2 y; % // TrigExpand; % // Together; % /. y -> x/2 d1 === % (-Cos[x/2] + Sin[x/2])/(Cos[x/2] + Sin[x/2])^3 True TrigExpand applied double angle rules, and Together combined two fractions with the same denominator. Bobby On Mon, 04 Jan 2010 04:58:48 -0600, Zsolt <phyhari(a)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[1] + x C[2] + (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! :) > -- DrMajorBob(a)yahoo.com
From: Bob Hanlon on 5 Jan 2010 01:48 The arbitrary constants between the two are different. eqn = D[y[x], x, x] == -Cos[x]/(1 + Sin[x])^2; soln1 = DSolve[eqn, y[x], x][[1, 1]] y[x] -> C[2]*x + C[1] + (2*Sin[x/2])/(Sin[x/2] + Cos[x/2]) D[y[x] /. soln1, x, x] == (eqn // Last) // Simplify True The solution satisfies the equation. soln2 = (y[x] -> -2/(Tan[(1/2)*x] + 1) + C[4]*x + C[3]); Series[Evaluate[y[x] /. soln1], {x, 0, 1}] // Normal (C[2] + 1)*x + C[1] Series[Evaluate[y[x] /. soln2], {x, 0, 1}] // Normal (C[4] + 1)*x + C[3] - 2 (y[x] /. soln1) == (y[x] /. soln2 /. {C[3] -> C[1] + 2, C[4] -> C[2]}) // Simplify True The solutions are equivalent. Bob Hanlon ---- Zsolt <phyhari(a)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[1] + x C[2] + (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! :)
From: Leonid Shifrin on 5 Jan 2010 01:48 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[1]:= Integrate[-Cos[x]/(1 + Sin[x])^2, x] Out[1]= 1/(1 + Sin[x]) In[2]:= Integrate[1/(1 + Sin[x]), x] Out[2]= (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[3]:= 1/(1 + Sin[x]) /. Sin[x] -> 1/(2 I) (Exp[I*x] - Exp[-I*x]) // Simplify Out[3]= (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[4]:= Integrate[2/(I + t)^2, t] /. t -> Exp[I*x] Out[4]= -(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[1] of the solution: In[5]:= FullSimplify[-(2/(I + E^(I x))) - (2 Sin[x/2])/( Cos[x/2] + Sin[x/2])] Out[5]= -1 + I You could also check the final result by a direct differentiation: In[6]:= D[C[1] + x C[2] + (2 Sin[x/2])/(Cos[x/2] + Sin[x/2]), x, x] == -Cos[x]/(1 + Sin[x])^2 // FullSimplify Out[6]= 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[7]:= 1/(1 + Tan[x]) + 1/(1 + Cot[x]) // FullSimplify Out[7]= 1 As before, constants don't matter - they are absorbed into the definition of C[1]. Hope this helps. Regards, Leonid On Mon, Jan 4, 2010 at 2:58 AM, Zsolt <phyhari(a)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[1] + x C[2] + (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! :) > >
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: NDSolve problem with switching equations Next: inequality as constraints on NDSolve |