MathGroup Archive 2001

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

Search the Archive

Re: Can Fit give function coefficients?

  • To: mathgroup at
  • Subject: [mg31130] Re: Can Fit give function coefficients?
  • From: bap at (Brett Patterson)
  • Date: Fri, 12 Oct 2001 03:36:48 -0400 (EDT)
  • References: <9pu3u0$bc8$> <9q0udq$nlt$>
  • Sender: owner-wri-mathgroup at

"Paul Lutus" <nospam at nosite.zzz> wrote in message news:<9q0udq$nlt$1 at>...
> "Brett Patterson" <bap at> wrote in message
> news:9pu3u0$bc8$1 at
> > I have a set of functions that I wish to fit to some data.
> > Is there a way to succinctly get Mathematica to give me
> > the coefficients of these functions in the fit.
> >
> > For example, say I have
> > f1[x_] := 2 x^2
> > f2[x_] := 3 x^3
> >
> > Normally, if I say: Fit[data, {1, f1[x], f2[x]}, x]
> > I get a result in the form: a1 + b1 x^2 + c1 x^3,
> > but I want a result of the form: a2 + b2 f1[x] + c2 f1[x].
> > In this case, a2 = a1, b2 = b1/2, and c2 = c1/3.
> >
> > Is this possible?
> No AFAIK, because the numerical coefficients cannot refer to functions that
> are not defined, as you are showing them. Why do you want this feature? If
> you change the functions, the generated numerical coefficients lose all
> meaning. If the functions' definitions are included (true by default), the
> output is valid.
> Fit[] provides a numerical solution, not a symbolic one. You are asking for
> a symbolic representation of a numerical solution.

Hi Paul,

I don't quite understand your comments.
I do give example function definitions in my post.
Of course the coefficients change when the functions change, and
I don't think it's accurate to say I'm asking for a symbolic representation.

I think it's reasonable and not uncommon to want to know the numerical
coefficients to functions f1, f2, f2, ..., in a fit to some data
where the functions f1, f2, f3, ... may themselves contain multipliers.
I'm just asking for the multipliers to be separated from the coefficients.

The solutions to this problem given by
Jens-Peer Kuska (kuska at --- using NumericQ
BobHanlon at (BobHanlon at --- using NonlinearFit
are succinct and easy to implement, so I'm happy now! 8-)

Thanks for your post.

Brett Patterson

  • Prev by Date: Re: Newbie Plot-Fit Questions.
  • Next by Date: patterns
  • Previous by thread: Re: Can Fit give function coefficients?
  • Next by thread: Re: Can Fit give function coefficients?