|
[Date Index]
[Thread Index]
[Author Index]
Re: Wrong ODE solution in Mathematica 7?
- To: mathgroup at smc.vnet.net
- Subject: [mg106229] Re: [mg106177] Wrong ODE solution in Mathematica 7?
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Tue, 5 Jan 2010 01:49:04 -0500 (EST)
- References: <201001041058.FAA21179@smc.vnet.net>
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 at 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! :)
>
>
Prev by Date:
Re: Combining data from indexed lists efficiently
Next by Date:
Re: Wrong ODE solution in Mathematica 7?
Previous by thread:
Re: Wrong ODE solution in Mathematica 7?
Next by thread:
Re: Wrong ODE solution in Mathematica 7?
|