       Re: Problem in solving Differential Equation

• To: mathgroup at smc.vnet.net
• Subject: [mg130240] Re: Problem in solving Differential Equation
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Thu, 28 Mar 2013 04:05:59 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <20130306031441.3FE5E665F@smc.vnet.net>

```Your DE can be solved exactly using DSolve.

Manipulate[
eqn = x'[t] + lambda*x[t] == 0;
sol[t_] = x[t] /. DSolve[
{eqn, x == 1/2}, x[t], t][];
ParametricPlot[
{sol[t], sol'[t]},
{t, 0, 25},
PlotRange -> {{-0.1, 0.6}, {-3, 0.5}},
Frame -> True,
Axes -> False,
FrameLabel -> (Style[#, "Courier", Bold, 16] & /@
{x, Overscript[x, "."]}),
AspectRatio -> 1,
PlotStyle -> {{Red, AbsoluteThickness}}],
{{lambda, 0.5}, 0, 5, 0.01, Appearance -> "Labeled"}]

Bob Hanlon

On Wed, Mar 27, 2013 at 11:29 PM, Rahul Chakraborty
<rahul.6sept at gmail.com> wrote:
> Sir,
>
>  Can you kindly see what is the mistake in this code of mine. Its not
> giving me the output.
>
>
>  Clear [x,t];
> eqn=x'[t]+lambda*x[t]==0;
> Manipulate[[sol_]=NDSolve[{eqn,x==1/2},x[t],{t,0,50}][];
> ParametricPlot[Evaluate[{x[t]/.sol,D[x[t]/.sol,t]}],{t,0,25},PlotRange->{{-20,20},{-25,25}},Frame->True,Axes->False,FrameLabel->(Style[#,"Courier",Bold,16]&/@{"x",Overscript[x,"."]}),AspectRatio->1,PlotStyle->{{Red,AbsoluteThickness}}],{{lambda,0.5},0,5}]
>
>
>
> Sincerely,
>
>  Rahul
>
> On 3/6/13, Bob Hanlon <hanlonr357 at gmail.com> wrote:
>> Arguments to functions (e.g., Sin, Cos) must be enclosed in squares
>> brackets: Sin[x[t]] and Cos[x[t]]
>>
>> Clear[x];
>> \[Omega] = -2;
>> eqn =
>>   x''[t] + Sin[x[t]] - \[Omega]^2 Sin [x[t]] Cos[x[t]] == 0 //
>>    Simplify;
>> sol = NDSolve[
>>     {eqn, x == 1/2, x' == 0},
>>     x[t], {t, 0, 25}][];
>> ParametricPlot[
>>  Evaluate[{x[t] /. sol, D[x[t] /. sol, t]}],
>>  {t, 0, 25},
>>  Frame -> True,
>>  Axes -> False,
>>  FrameLabel -> (Style[#, "Courier", Bold, 16] & /@
>>     {x, Overscript[x, "."]}),
>>  AspectRatio -> 1,
>>  PlotStyle -> {{Red, AbsoluteThickness}}]
>> ParametricPlot[
>>  Evaluate[{t, x[t] /. sol}],
>>  {t, 0, 10},
>>  Frame -> True,
>>  Axes -> False,
>>  FrameLabel -> (Style[#, "Courier", Bold, 16] & /@
>>     {t, x}),
>>  AspectRatio -> .5,
>>  PlotStyle -> {{Green, AbsoluteThickness}}]
>>
>>
>> Bob Hanlon
>>
>>
>> On Tue, Mar 5, 2013 at 10:14 PM, Rahul Chakraborty
>> <rahul.6sept at gmail.com> wrote:
>>> Dear all,
>>>
>>>  Following differential equation seems to have some error in coding by me.
>>> kindly let me know where i have gone wrong.
>>>
>>> Clear[x];
>>>  \[Omega]:=-2;
>>> eqn=x''[t]+ Sin  x[t]-\[Omega]^2  Sin  x[t]Cos  x[t]==0//Simplify;
>>> sol=NDSolve[{eqn,x==1/2,x'==0},x[t],{t,0,1000}][]
>>> ParametricPlot[Evaluate[{x[t]/.sol,D[x[t]/.sol,t]}],{t,0,25},Frame->True,AxesLabel->{"x",Overscript[x,"."]},AspectRatio->1,PlotStyle->{{Red,AbsoluteThickness}},TextStyle->{FontFamily->"Courier",FontWeight->"Bold",FontSize->16}]
>>> ParametricPlot[Evaluate[{t,x[t]/.sol}],{t,0,10},Frame->True,AxesLabel->{"t","x"},AspectRatio->.5,PlotStyle->{{Green,AbsoluteThickness}},TextStyle->{FontFamily->"Courier",FontWeight->"Bold",FontSize->16}]
>>>
>>> Regards,
>>>
>>>  rahul
>>>
>>

```

• Prev by Date: Re: Problem in solving Differential Equation
• Next by Date: Re: Problem in solving Differential Equation
• Previous by thread: Re: Problem in solving Differential Equation
• Next by thread: Re: Problem in solving Differential Equation