Wrong ODE solution in Mathematica 7?

Discussion in 'Mathematica' started by Zsolt, Jan 4, 2010.

  1. Zsolt

    Zsolt Guest

    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! :)
    Zsolt, Jan 4, 2010
    1. Advertisements

  2. Zsolt

    dh Guest


    both are correct. You may check this by calculating the second

    derivative of both expressions and show that they are equal:

    D[-2/(Tan[(1/2)*x] + 1), {x, 2}] ==

    D[(2 Sin[x/2])/(Cos[x/2] + Sin[x/2]), {x, 2}] // Simplify


    dh, Jan 5, 2010
    1. Advertisements

  3. If you take the second derivative of your answer and compare it with the
    rhs you will see that it is true, i.e.

    Y''[x]== -Cos[x]/(1 + Sin[x])^2//FullSimplify
    Kevin J. McCann, Jan 5, 2010
  4. 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])

    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, Jan 5, 2010
  5. Hello,
    what makes you think, that this solution is wrong?
    You should know, that the same function can often be written in many
    different ways.

    To check the solution, you could simply compare the plots of its 2nd derivative
    and the right hand side of the ODE or use TrigExpand[] on both functions
    and their difference.

    Alois Steindl, Jan 5, 2010
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.