Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if it is possible to manipulate a FindFit[] function. As a basic example, if I had an equation $ax^2+bx+c$ and a set of data, would it be possible to manipulate the c value, while Mathematica outputs the best fit values for a and b for that c value?

share|improve this question
Yes, just use an explicit value for c in the model you provide to FindFit. – Sjoerd C. de Vries Jul 12 '13 at 20:10
One can theoretically Manipulate any expression. But see the SynchronousUpdating option to Manipulate for handling expressions that take a long time to compute. – Michael E2 Jul 12 '13 at 23:38

Extending @bills answer a little further:

p = Table[Prime[x], {x, 20}];

 Show[ListPlot@p, Plot[y /. FindFit[p, y = a x^2 + b x + c, {a, b}, x], {x, 1, 20}, 
                       Evaluated -> True]], 
{c, -10, 10}]

Mathematica graphics

share|improve this answer

Here's one way:

 p = Table[Prime[x], {x, 20}]; 
 Manipulate[FindFit[p, a x^2 + b x + c, {a, b}, x], {c, -10, 10}]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.