Re: Wrong ODE solution in Mathematica 7?
- To: mathgroup at smc.vnet.net
- Subject: [mg106207] Re: [mg106177] Wrong ODE solution in Mathematica 7?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Tue, 5 Jan 2010 01:44:40 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <201001041058.FAA21179@smc.vnet.net>
- Reply-to: murray at math.umass.edu
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@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 at 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
- References:
- Wrong ODE solution in Mathematica 7?
- From: Zsolt <phyhari@gmail.com>
- Wrong ODE solution in Mathematica 7?