Re: Pi vs its decimal approximation
- To: mathgroup at smc.vnet.net
- Subject: [mg113178] Re: Pi vs its decimal approximation
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 16 Oct 2010 13:13:36 -0400 (EDT)
- Reply-to: hanlonr at cox.net
You did not include a space between the Pi and x so they make a single symbol which is undefined. In the numeric case the multiplication is implied so it works as expected. Bob Hanlon ---- John Accardi <accardi at accardi.com> wrote: ============= Thanks in advance for any insights ... In my notebook below, why doesn't cosine2 graph? When I replace the symbol for Pi with the decimal approx in the definition of cosine3, it graphs correctly. . Why does Mathematica not interpret Pi correctly in the first definition of cosine2? In[29]:= cosine2:= 2/3 Cos[2\[Pi]x - \[Pi]/2 ] +1 In[30]:= yline:=1 In[31]:= Plot[Tooltip[{cosine2, yline}], {x, 0, 1.5}, Ticks -> {{0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5}, Automatic}] The plot that appears here only shows the y=1 line, not the cosine2. But now I replace the symbol Pi with a decimal approximation in the definition of cosine3 .. and it graphs correctly. In[20]:= cosine3:= 2/3 Cos[2(3.141592653589793`)x- \[Pi]/2 ] +1 In[14]:= yline:=1 In[15]:= Plot[Tooltip[{cosine3, yline}], {x, 0, 1.5}, Ticks -> {{0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5}, Automatic}] The plot that shows here is correct. It contains both y=1 and cosine3. The only difference is the use of Pi vs 3.14159265... (I inputted Pi using the Greek letter on the Classroom Assistant.) *.nb file here: http://www.accardi.com/PiQuery.nb Gianni