MathGroup Archive 2003

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

Search the Archive

RE: data fitting function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40833] RE: [mg40823] data fitting function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 21 Apr 2003 06:58:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

gong,

Use

f[x_] = Fit[X,{functions},x]

Use = and not := in this case. That defines f[x] once and for all. Then you
should be able to use it rather efficiently in other expressions.

Function has the attributes HoldAll so when your f is used, the Fit is
reevaluated with each use. That's not efficient.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: gong [mailto:gongli at cutey.com]
To: mathgroup at smc.vnet.net

hi

i would like to fit some data X = {{x1,y1},...,{xn,yn}} to a set of
functions, then have this assigned to a function i can call:

fittedfunc[x1] \approx y1

moreover, i need fittedfunc to be as fast as possible in terms of
evaluation, since it will be used in a loop.  i think it should be
ideally a compiled function.

i tried

f=Function[x,Fit[X,{functions},x]

bit im finding a major speed hit here, i think every time i call f[x]
it refits the data.

any help would be greatly appreciated.

-gong



  • Prev by Date: books on *problem solving* using mathematica
  • Next by Date: Re: Finding derivatives of a list?
  • Previous by thread: data fitting function
  • Next by thread: Re: data fitting function