Re: real valued solutions?

*To*: mathgroup at smc.vnet.net*Subject*: [mg23492] Re: [mg23449] real valued solutions?*From*: BobHanlon at aol.com*Date*: Fri, 12 May 2000 22:54:30 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

In a message dated 5/10/2000 2:55:33 AM, robert.schuerhuber at gmx.at writes: >i guess my problem is rather simple to solve, but i counld't figure it >out :-( > >i'd like to solve ordinary differential equations with constant >coefficients with mathematica, where everything is real-valued. so the >solution is real-valued, too. how can i avoid the complex exponentials >in the solution? > >e.g. > >DSolve[{y''[x]-y'[x]+y[x]==0,y[0]==1,y'[0]==0},y[x],x] > >gives > >{{y[x]->Exp[-(-1)^2/3 x ( ... }} > >as the result instead of the real-valued solution y[x]=Exp[x/2] >(Cos[Sqrt[3]/2 x]-1/Sqrt[3] Sin[Sqrt[3]/2 x). > y[x] /. Flatten[ DSolve[{y''[x] - y'[x] + y[x] == 0, y[0] == 1, y'[0] == 0}, y[x], x]] // ComplexExpand // Simplify -(1/3)*E^(x/2)*(Sqrt[3]*Sin[(Sqrt[3]*x)/2] - 3*Cos[(Sqrt[3]*x)/2]) Bob BobHanlon at aol.com