       Re: New to mathematica: Question about solving

• To: mathgroup at smc.vnet.net
• Subject: [mg74694] Re: [mg74664] New to mathematica: Question about solving
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sat, 31 Mar 2007 01:39:19 -0500 (EST)

```I must have evaluated out of order. Change this to read

soln=DSolve[{y'[x] == y[x] + y[x]^3}, y[x], x]

{{y[x] -> -((I*E^(x + C))/
Sqrt[-1 + E^(2*x + 2*C)])},
{y[x] -> (I*E^(x + C))/Sqrt[-1 + E^(2*x + 2*C)]}}

soln=soln/.
expr1_*(expr2_)^(-1/
2):>(expr2/(expr1^2))^(-1/2)/.C:>-Log[C]/2//ExpandAll

{{y[x] -> 1/Sqrt[C/E^(2*x) - 1]},
{y[x] -> 1/Sqrt[C/E^(2*x) - 1]}}

Bob Hanlon

---- Bob Hanlon <hanlonr at cox.net> wrote:
> soln=DSolve[{y'[x] == y[x] + y[x]^3}, y[x], x]
>
> {{y[x] -> -((I*E^(x + C))/
>       Sqrt[-1 + E^(2*x + 2*C)])},
>   {y[x] -> (I*E^(x + C))/Sqrt[-1 + E^(2*x + 2*C)]}}
>
> soln=soln/.{
>         expr1_*(expr2_)^(-1/2):>(expr2/(expr1^2))^(-1/2),
>         C:>-Log[C]/2}//ExpandAll
>
> {{y[x] -> 1/Sqrt[C/E^(2*x) - 1]},
>   {y[x] -> 1/Sqrt[C/E^(2*x) - 1]}}
>
>
> Bob Hanlon
>
> ---- traz <t_raz at yahoo.com> wrote:
> > Whenever I try to solve differential equations in mathematica, I get a solution with an imaginary part different from the solution in a text book. For example:
> >
> > DSolve[{y'[x] == y[x] + y[x]^3}, y, x]
> >
> > will give me a solution that has an imaginary part and not the one I expect here from the text book:
> >
> > {+(Ce^(-2x)-1)^(-1/2), -(Ce^(-2x)-1)^(-1/2)}
> >
> > Can anyone give me a tip on how to do this? Also does anyone know of an online tuttorial that goes into details a little bit?
> >

```

• Prev by Date: Re: Closing All Input Cells at Once- KB shortcuts
• Next by Date: Designing a Flexible Mathematica Program for Data Analysis