From: Zsolt on
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: dh on


Hi,

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

Daniel



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! :)

>



From: Tony Harker on
Let Mathematica check it:

eq = D[y[x], x, x] == -Cos[x]/(1 + Sin[x])^2
sol = DSolve[eq, y, x]
eq /. sol[[1]] // Simplify

returns True.

So the solution is correct, and if you think about it the difference
between Mathematica's solution and the other one is only a matter of a
difference in the additive constant.

Tony

]-> -----Original Message-----
]-> From: Zsolt [mailto:phyhari(a)gmail.com]
]-> Sent: 04 January 2010 10:59
]-> To: mathgroup(a)smc.vnet.net
]-> Subject: Wrong ODE solution in Mathematica 7?
]->
]-> 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: David Park on
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[1] + x C[2] + (2 Sin[x/2])/(Cos[x/2] + Sin[x/2])

Check the solution:

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

Here is your second solution:

y2[x_] = C[1] + C[2] 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[1], 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(a)comcast.net
http://home.comcast.net/~djmpark/



From: Zsolt [mailto:phyhari(a)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[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: Kevin J. McCann on
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

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! :)
>