Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10084 > unrolled thread

Phase Plot of Simple Harmonic Motion using Mathematica ??

Started byRahul Chakraborty <rahul.6sept@gmail.com>
First post2012-05-15 08:56 +0000
Last post2012-05-16 08:23 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Phase Plot of Simple Harmonic Motion using Mathematica ?? Rahul Chakraborty <rahul.6sept@gmail.com> - 2012-05-15 08:56 +0000
    Re: Phase Plot of Simple Harmonic Motion using Mathematica ?? "Nasser M. Abbasi" <nma@12000.org> - 2012-05-16 08:26 +0000
    Re: Phase Plot of Simple Harmonic Motion using Mathematica ?? DC <b.gatessucks@gmail.com> - 2012-05-16 08:23 +0000

#10084 — Phase Plot of Simple Harmonic Motion using Mathematica ??

FromRahul Chakraborty <rahul.6sept@gmail.com>
Date2012-05-15 08:56 +0000
SubjectPhase Plot of Simple Harmonic Motion using Mathematica ??
Message-ID<jot5nd$aok$1@smc.vnet.net>
Hi all,

 Plz check my code below for Phase plot of Simple Harmonic motion. The output should be a circle with x along X-axis and dxdt along y-axis.

I'm not getting the output. kindly let me know where i'm wrong.

 Clear[k, m];
k = 1;
m = 3;
solution = 
 NDSolve[{x''[t] + k/m x[t] == 0, x[0] == 5, x'[0] == 0}, 
  x, {t, 0, 250}, MaxSteps \[RightArrow] 50000, 
  WorkingPrecision \[RightArrow] 25]
ParametricPlot[Evaluate[{x[t], x'[t]} /. solution], {t, 0, 100}, 
 PlotRange \[RightArrow] All, 
 AxesLabel -> {"x", "\!\(\*OverscriptBox[\(x\), \(.\)]\)"}]


Following are the errors:

1)NDSolve::dvlen: The function x[t] does not have the same number of arguments as independent variables (3). >>

2)ReplaceAll::reps: {NDSolve[{x[t]/3+(x^\[Prime]\[Prime])[t]==0,x[0]==5,(x^\[Prime])[0]==0},x,{t,0,250},MaxSteps\[RightArrow]50000,WorkingPrecision\[RightArrow]25]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

3)ParametricPlot::pllim: Range specification PlotRange\[RightArrow]All is not of the form {x, xmin, xmax}. >>


Regards,

rc

[toc] | [next] | [standalone]


#10092

From"Nasser M. Abbasi" <nma@12000.org>
Date2012-05-16 08:26 +0000
Message-ID<jovobf$mj5$1@smc.vnet.net>
In reply to#10084
On 5/15/2012 3:56 AM, Rahul Chakraborty wrote:
> Hi all,
>
>   Plz check my code below for Phase plot of Simple Harmonic motion. The output should be a circle with x along X-axis and dxdt along y-axis.
>
> I'm not getting the output. kindly let me know where i'm wrong.
>
>   Clear[k, m];
> k = 1;
> m = 3;
> solution =
>   NDSolve[{x''[t] + k/m x[t] == 0, x[0] == 5, x'[0] == 0},
>    x, {t, 0, 250}, MaxSteps \[RightArrow] 50000,
>    WorkingPrecision \[RightArrow] 25]
>
>
> Following are the errors:
>

This works for me. Just changed your \[RightArrow] with normal
ascii ->

NDSolve[{x''[t] + (k/m)*x[t] == 0, x[0] == 5,
    x'[0] == 0}, x, {t, 0, 250}, MaxSteps -> 50000,
   WorkingPrecision -> 25]

--Nasser

[toc] | [prev] | [next] | [standalone]


#10096

FromDC <b.gatessucks@gmail.com>
Date2012-05-16 08:23 +0000
Message-ID<jovo5n$mhb$1@smc.vnet.net>
In reply to#10084
I would change the definition of solution so it's a simple function of t, then you'd take its derivative/do the plot in the usual way.

solution[t_] = 
 NDSolve[{x''[t] + k/m x[t] == 0, x[0] == 5, x'[0] == 0}, 
   x[t], {t, 0, 250}][[1, 1, 2]]
ParametricPlot[{solution[t], solution'[t]}, {t, 0, 100}]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web