MathGroup Archive 2006

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

Search the Archive

Re: critical points of a third order polynomial fit (simplification)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68488] Re: [mg68466] critical points of a third order polynomial fit (simplification)
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Mon, 7 Aug 2006 01:41:09 -0400 (EDT)
  • References: <27716710.1154867941078.JavaMail.root@eastrmwml01.mgt.cox.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I was afraid of that. I am torn about using Rationalize on the input,
because the general result of these calculations is part of a package
I am writing that numerically finds minima.

Thank you for the demonstration.

On 8/6/06, Bob Hanlon <hanlonr at cox.net> wrote:
> The diffrerent results are due to loss of precision in the calculations. Use exact numbers (Rationalize) until the end and they come out the same (and different from your initial results).
>
> bracket=Rationalize[{0.040911501042171394,9.797734083340343,0.\
> 003643048928782312,
>       9.939642325021731,0.0007478278717134088,10.027346441664564,
>       0.028647147834538127,10.169254683345951},0];
>
> eqn[1]=Plus@@
>         Table[Times[c[i],Power[x,i-1]],{i,4}]==y;
> eqn[2]=eqn[1]/.{x->x[#],y->y[#]}&/@Range[4];
> rep[1]=FullSimplify@Solve[eqn[2],
>     Array[c,{4}]];
> rep[2]=FullSimplify@Solve[D[eqn[1],x],x];
> rep[3]=Simplify[rep[2]/.rep[1][[1]]];
> rep[4]=rep[2]/.rep[1][[1]];
> rep[5]={x[num_]:>bracket[[2 num]],y[num_]:>bracket[[2 num-1]]};
>
> x/.rep[3]/.rep[5]//N//InputForm
>
> {-1.7354138825983832*^13, 10.001481270475566}
>
> x/.rep[4]/.rep[5]//N//InputForm
>
> {-1.7354138825983832*^13, 10.001481270475566}
>
>
> Bob Hanlon
>
> ---- Chris Chiasson <chris at chiasson.name> wrote:
> > Here are some commands that find the (two) critical locations of a
> > cubic polynomial fitted to four points. The four points are given as
> > bracket={y1,x1,y2,x2,y3,x3,y4,x4}, where y is the range and x is the
> > domain location. The code produces two sets of critical points. Both
> > solution sets involve substituting the coefficients obtained from the
> > four point "fit" into the general solution of the critical points
> > (from calculus D[poly,x]==0). The only difference is that one of them
> > calls a Simplify command that the other doesn't (compare rep[3] with
> > rep[4]).
> >
> > Why are the answers for the second critical point so different? Do you
> > think the simplification made in rep[3] is invalid? Does your computer
> > give the same results that mine gives?
> >
> > In[1]:=
> > $Version
> >
> > Out[1]=
> > 5.2 for Microsoft Windows (June 20, 2005)
> >
> > In[2]:=
> > bracket={0.040911501042171394,9.797734083340343,0.003643048928782312,
> >       9.939642325021731,0.0007478278717134088,10.027346441664564,
> >       0.028647147834538127,10.169254683345951};
> >
> > In[3]:=
> > eqn[1]=Plus@@Table[Times[c[i],Power[x,i-1]],{i,4}]\[Equal]y;
> > eqn[2]=eqn[1]/.{x\[Rule]x[#],y\[Rule]y[#]}&/@Range[4];
> > rep[1]=FullSimplify@Solve[eqn[2],Array[c,{4}]];
> > rep[2]=FullSimplify@Solve[D[eqn[1],x],x];
> > rep[3]=Simplify[rep[2]/.rep[1][[1]]];
> > rep[4]=rep[2]/.rep[1][[1]];
> > rep[5]={x[num_]\[RuleDelayed]bracket[[2 num]],
> >       y[num_]\[RuleDelayed]bracket[[2 num-1]]};
> >
> > In[10]:=
> > x/.rep[3]/.rep[5]//InputForm
> >
> > Out[10]//InputForm=
> > {-1.4838127878952383*^10,
> >  17.999998818597952}
> >
> > In[11]:=
> > x/.rep[4]/.rep[5]//InputForm
> >
> > Out[11]//InputForm=
> > {-1.4838127878952383*^10,
> >  9.999999069105009}
> >
> > --
> > http://chris.chiasson.name/
> >
>
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Re: Deleting charachter from a text file
  • Next by Date: Re: Using Map with function that has options...
  • Previous by thread: Re: critical points of a third order polynomial fit (simplification)
  • Next by thread: NDSolve with boundary condition(s) at infinity?