Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Phase Plot of Simple Harmonic Motion using Mathematica ??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126510] Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
  • From: Christoph Lhotka <christoph.lhotka at fundp.ac.be>
  • Date: Wed, 16 May 2012 04:21:54 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Dear Rahul,

this makes your code work:

replace in your expression \[RightArrow] by \[Rule] (delete the arrows 
and retype them properly).

If you look on the documentation for \[RightArrow]
you will find that it has no built-in meaning and that it can be entered
as [ESC]_->[ESC], where _ stands for an extra space, while \[Rule] is
entered as [ESC]->[ESC] only.

In the email text it is easy to see the difference between \[RightArrow] 
and \[Rule], to
see the difference in your notebook just press Shift+Ctrl+E inside the 
cell or use
Hold[expr]//FullForm to see the unevaluated fullform of the expression.

Best,

Christoph

Addendum: another issue is, that the error messages of the present 
example are not really
related to the problem, does anyone know why?




On 05/15/2012 10:54 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]
> 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
>




  • Prev by Date: Re: Is Mathematica v8 slower than v7 ?
  • Next by Date: Re: unexpected behaviour of Sum
  • Previous by thread: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
  • Next by thread: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??