Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: FindFit Mathematica 7

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113924] Re: FindFit Mathematica 7
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 18 Nov 2010 07:05:16 -0500 (EST)

$Version

"7.0 for Mac OS X x86 (64-bit) (February 19, 2009)"

I also get the 1/0 error with

FindFit[{{0., 1.}, {1., -1}},
 {a x + b, b == 0}, {a, b}, x]

However, in addition to your workaround, these work

FindFit[{{0., 1.}, {1., -1}},
 a x + b /. b -> 0, {a, b}, x]

{a -> -1., b -> 0.}

FindFit[{{0., 1.}, {1., -1}},
 a x, {a, b}, x]

{a -> -1., b -> 0.}

Fit[{{0., 1.}, {1., -1}}, x, x]

-1. x


Bob Hanlon

---- Derivator <derivatorb at gmail.com> wrote: 

=============
Hi. I have a question regarding the use of constraints in FindFit.

In the version 6 the following command

 FindFit[{{0., 1.}, {1., -1}}, {a x + b, b==0}, {a, b}, x]

yields a -> -1, b -> 0 (b==0 is a constraint).

 I find in the version 7 that the same command produces an error of
the type 1/0.
Of course I still could use something like

FindFit[{{0., 1.}, {1., -1}}, {a x + b, Abs[b] < 0.001}, {a, b}, x]

or

With[{b=0},FindFit[{{0., 1.}, {1., -1}}, {a x + b}, {a}, x]

but this is not very natural. Is this a bug or is there a way around?

Regards

L.L.




  • Prev by Date: Re: Mathematica 8: first impressions
  • Next by Date: Re: Mathematica 8
  • Previous by thread: FindFit Mathematica 7
  • Next by thread: Re: FindFit Mathematica 7