Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Phase Plot of Simple Harmonic Motion using Mathematica ??
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rahul Chakraborty  
View profile  
 More options May 15 2012, 4:56 am
Newsgroups: comp.soft-sys.math.mathematica
From: Rahul Chakraborty <rahul.6s...@gmail.com>
Date: Tue, 15 May 2012 08:56:13 +0000 (UTC)
Local: Tues, May 15 2012 4:56 am
Subject: Phase Plot of Simple Harmonic Motion using Mathematica ??
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nasser M. Abbasi  
View profile  
 More options May 16 2012, 4:26 am
Newsgroups: comp.soft-sys.math.mathematica
From: "Nasser M. Abbasi" <n...@12000.org>
Date: Wed, 16 May 2012 08:26:23 +0000 (UTC)
Local: Wed, May 16 2012 4:26 am
Subject: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
On 5/15/2012 3:56 AM, Rahul Chakraborty wrote:

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DC  
View profile  
 More options May 16 2012, 4:23 am
Newsgroups: comp.soft-sys.math.mathematica
From: DC <b.gatessu...@gmail.com>
Date: Wed, 16 May 2012 08:23:19 +0000 (UTC)
Local: Wed, May 16 2012 4:23 am
Subject: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
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}]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bob Hanlon  
View profile  
 More options May 16 2012, 4:24 am
Newsgroups: comp.soft-sys.math.mathematica
From: Bob Hanlon <hanlonr...@gmail.com>
Date: Wed, 16 May 2012 08:24:20 +0000 (UTC)
Local: Wed, May 16 2012 4:24 am
Subject: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
When I copied and pasted your input I had the same error. However,
after I manually re-entered the line defining solution all worked
well. You must have some invisible character in your input.

Bob Hanlon

On Tue, May 15, 2012 at 4:54 AM, Rahul Chakraborty

<rahul.6s...@gmail.com> 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.

ments 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,Work=
ingPrecision\[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

--
Bob Hanlon

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Lhotka  
View profile  
 More options May 16 2012, 4:25 am
Newsgroups: comp.soft-sys.math.mathematica
From: Christoph Lhotka <christoph.lho...@fundp.ac.be>
Date: Wed, 16 May 2012 08:25:22 +0000 (UTC)
Local: Wed, May 16 2012 4:25 am
Subject: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexei Boulbitch  
View profile  
 More options May 17 2012, 4:07 am
Newsgroups: comp.soft-sys.math.mathematica
From: Alexei Boulbitch <Alexei.Boulbi...@iee.lu>
Date: Thu, 17 May 2012 08:07:51 +0000 (UTC)
Local: Thurs, May 17 2012 4:07 am
Subject: Re: Phase Plot of Simple Harmonic Motion using Mathematica ??
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\), \(.\)]\)"}]

Regards, Rc

Hi, Rahul,

Try this:

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}] // Flatten
ParametricPlot[Evaluate[{x[t], x'[t]} /. solution], {t, 0, 100},
 AxesLabel -> {"x", "x'"}, PlotRange -> All]

The main difference in the function Flatten that I apply to the solution. I t removes the extra parentheses. The latter have prevented you from getting solution.

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbi...@iee.lu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »