Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to rectify the error for NDSolve ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127178] Re: How to rectify the error for NDSolve ?
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Wed, 4 Jul 2012 03:32:35 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201207030219.WAA20662@smc.vnet.net>

You still have multiple syntax errors.

If you are going to specify a working precision, all input numbers
must be at least that precision. For example, 0.5 must be either exact
(i.e., 1/2) or high precision (e.g., 0.5`25).

 I shortened the interval since the plot is too dense for wider ranges.

Clear[x, \[Tau], Q, \[CapitalGamma], \[Phi], V, t];
Q = 100;
\[CapitalGamma] = 50;
Subscript[\[Omega], 0] = 10;
Subscript[V, p] = 1/2;
Subscript[c, 0] = 406*10^-6;
\[Phi] = 90;
Subscript[V, 1][t] =
  Sqrt[2] Subscript[V, p] Sin[2 Subscript[\[Omega], 0] t];

eqn = x''[t] + Subscript[\[Omega], 0]/Q x'[t] +
     Subscript[\[Omega], 0]^2*
      (1 + Subscript[c, 0] Subscript[V, 1][t]) x[
       t] ==
    \[CapitalGamma] Sin[Subscript[\[Omega], 0] t + \[Phi]] //
   Simplify;

sol = NDSolve[{eqn, x[0] == 1/2, x'[0] == 0},
    x[t], {t, 0, 25}][[1]];

ParametricPlot[Evaluate[
  {x[t] /. sol, D[x[t] /. sol, t]}],
 {t, 0, 25},
 Frame -> True,
 AxesLabel -> {"t", Overscript[\[Theta], "."]},
 AspectRatio -> 1]


Bb Hanlon


On Mon, Jul 2, 2012 at 10:19 PM, Rahul Chakraborty
<rahul.6sept at gmail.com> wrote:
> Dear all,
>
>  Thanks to Murray for your reply. I have made changes as per advice but still no result. The differential eqn is also changed to make it simpler.
>
>  Here is my code:
>
>  Clear[x,\[Tau],Q,\[CapitalGamma],\[Phi]];
> Q=100;
> \[CapitalGamma]=50;
> Subscript[\[Omega], 0]=10;
> Subscript[V, p]=0.5;
> Subscript[C, 0]=4.06 * 10^-4;
> \[Phi]=90;
> Subscript[V, 1](t)=Sqrt[2] Subscript[V, p]Sin(2Subscript[\[Omega], 0]t);
> eqn= x''[t]+Subscript[\[Omega], 0]/Q x'[t]+Subscript[(\[Omega]^2), 0][1+Subscript[c, 0] Subscript[V, 1](t)]x[t]==\[CapitalGamma]Sin[Subscript[\[Omega], 0]t+\[Phi]];
> sol=NDSolve[{eqn,x[0]==0.5,x'[0]==0},x[t],{t,0,250},MaxSteps-> 500000,WorkingPrecision-> 25][[1]]
> ParametricPlot[Evaluate[{x[t],x'[t]}/.sol],{t,0,100},Frame->True,PlotRange-> All,AxesLabel-> {"t","Overscript[\[Theta], .]"}]
>
> Regards,
> rc
>



  • Prev by Date: Re: Evaluate code fragment without making new cell for it?
  • Next by Date: Re: Rearranging terms - user-defined
  • Previous by thread: Re: How to rectify the error for NDSolve ?
  • Next by thread: Re: How to rectify the error for NDSolve ?