MathGroup Archive 1999

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

Search the Archive

Re: Modulus Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16561] Re: Modulus Question
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Tue, 16 Mar 1999 04:00:28 -0500
  • Organization: University of Western Australia
  • References: <7c5c7i$7so@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Guy Gilliland wrote:

> I am trying to take the modulus of a function and am having difficulty.
> The following is my code:
> 
> soln=NDSolve[{x'[t]==y[t],x[0]==0.4,
>       y'[t]==-gamma1 * y[t] - Sin[x[t]] + A1 * Cos[z[t]],
> y[0]==1.2,z'[t]==w,
>       z[0]==0},{x,y,z},{t,0,1500},MaxSteps\[Rule]50000]
> 
> Before I do a parametric plot, I want to do the following:
> 
> x[t] = x[t] Mod 2*pi    (* limit x to belong to interval from 0 to 2*pi
> 
> I don't know how to do this.  Using the Mod function gives recursion
> errors (i.e., Mod[x[t],2*pi] doesnt' work).

Just apply Mod to x[t], e.g.,

	Plot[Evaluate[Mod[x[t] /. soln, 2Pi]], {t, 0, 1500}];

or, in 3D, 
	
	ParametricPlot3D[Evaluate[{Mod[x[t], 2Pi], y[t], z[t]} /. soln], 
		{t, 0, 1500}, BoxRatios -> {1, 1, 1}]

Cheers,
	Paul

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia           
Nedlands WA  6907                     mailto:paul at physics.uwa.edu.au 
AUSTRALIA                        http://www.physics.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________


  • Prev by Date: Re: Urgent aid needed
  • Next by Date: Re: Bug in Coefficient[ ]
  • Previous by thread: Re: Modulus Question
  • Next by thread: Graphics Packages Facilitating Combination of Plots