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