MathGroup Archive 2007

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

Search the Archive

Re: using units and plotting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80878] Re: using units and plotting
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 5 Sep 2007 02:28:35 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fbj32s$nlr$1@smc.vnet.net>

phillman5 wrote:

> Is there any hints how to plot things other than downloading custom
> packages when you use units?  To plot position verus time.
> 
> <<Units`
> dist:= a t^2
> a=9.8 Meter/Second^2
> Plot[dist,{t, 0 Second, 10 Second}]
> 
> Does not work.  Of course you can use
> 
> Plot[dist/Meter,{t, 0 Second, 10 Second}]
> 
> to make the y axis unitless, but how about the x axis?

You could use a set of transformation rules as shown below in In[5].

In[1]:= << Units`
dist := a t^2
a = 9.8 Meter/Second^2
Plot[dist, {t, 0 Second, 10 Second}]

Out[3]= (9.8 Meter)/Second^2

During evaluation of In[1]:= Plot::plln: Limiting value 10 Second in \
{t,0 Second,10 Second} is not a machine-size real number. >>

Out[4]= Plot[dist, {t, 0 Second, 10 Second}]

In[5]:= Plot[dist /. {Meter -> 1, Second -> 1}, {t, 0, 10}]

[... graphic deleted ...]

-- 
Jean-Marc


  • Prev by Date: Re: StringCases kills Kernel
  • Next by Date: Formula simplify for Solve
  • Previous by thread: Re: using units and plotting
  • Next by thread: Re: using units and plotting