       Re: Wrong ODE solution in Mathematica 7?

• To: mathgroup at smc.vnet.net
• Subject: [mg106197] Re: [mg106177] Wrong ODE solution in Mathematica 7?
• From: "David Park" <djmpark at comcast.net>
• Date: Tue, 5 Jan 2010 01:42:36 -0500 (EST)
• References: <7588881.1262603794881.JavaMail.root@n11>

```Remember that the constants are arbitrary and so it is possible to obtain
different looking forms depending on how you pick the constants.

Clear[y]
DSolve[y''[x] == -Cos[x]/(1 + Sin[x])^2, y, x][[1, 1]];
y[x_] = y[x] /. %

C + x C + (2 Sin[x/2])/(Cos[x/2] + Sin[x/2])

Check the solution:

y''[x] == -Cos[x]/(1 + Sin[x])^2 // Simplify
True

y2[x_] = C + C x - 2/(Tan[x/2] + 1);

Check it:

y2''[x] == -Cos[x]/(1 + Sin[x])^2 // Simplify
True

Add the constant 2, which could be absorbed into C, to the y2 solution
and see if it is equal to the y solution:

y2[x] + 2 == y[x] // Simplify
True

How did I figure out how to add 2? By plotting and trying various constants.
Start out with zero and you can see that you need to shift the second curve
up.

Plot[{(2 Sin[x/2])/(
Cos[x/2] + Sin[x/2]), -(2/(Tan[x/2] + 1)) + 2}, {x, -2 \[Pi],
2 \[Pi]}]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

From: Zsolt [mailto:phyhari at gmail.com]

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?? :(