Re: Equivalent functions generate different plots
- To: mathgroup at smc.vnet.net
- Subject: [mg26148] Re: Equivalent functions generate different plots
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 30 Nov 2000 01:03:56 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <8vvoh0$2p8@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Plot[Evaluate[{f[t], g[t]}], {t, 0, 2.2}] resolve your problem. Plot[] has the attribute HoldAll, because you may have assigned a value to "t" like x = 1; Plot[Sin[x], {x, 0, Pi}]. If Plot[] would evaluate it's arguments, the last example would give Plot[Sin[1],{1,0,Pi}] and that is clearly nonsense. Your delayed assigment for g[t] cause Mathematica to evaluate the function inside the Plot[] command and this create your problem. Hope that helps Jens > Then, I can define the regression function in two different, but > equivalent ways: > > First: copying and pasting the last output: > > In[3]:= > f[t_] := > 79.68214285714285`+ 0.21249999999984936` t - 16.741071428571246 t^2 > > Second: using directly the *Fit* function in the right hand: > > In[4]:= > g[t_] := Fit[data, {1, t, t^2}, t] > > In this conditions: > > In[5]:= > f[t] == g[t] > > Out[5]= > True > > However: > > In[6]:= > Plot[{f[t], g[t]}, {t, 0, 2.2}] > > Out[6]= > > (GRAPHICS ...!!!) > > genere two different plots (a straight line and a curve). The curve is > well, but the straight line not. I DON'T UNDERSTAND. Can somebody > explain to me this inconsistency? >