Message Boards Message Boards

Least squares fitting of a quadratic function through the origin

This project is for educational purposes and can be done more directly by existing functionality. This post refers more to students trying to figure out how to solve the following problem for the first time

3 Replies
Posted 1 year ago

I'm lazier than you.

data = {{-1, 3}, {1, 1}, {2, 5}};
lm = LinearModelFit[data, {x, x^2}, x, IncludeConstantBasis -> False, 
  WorkingPrecision -> \[Infinity]];
lm["BestFitParameters"]
(* {-(12/11), 20/11} *)
POSTED BY: Jim Baldwin

Might want to mention built-in capabilities as well as the PseudoInverse function. Or at least note that this is for educational purposes and can be done more directly by existing functionality.

POSTED BY: Daniel Lichtblau

You are right. I'll mention it at the beginning of the post. Thank you very much

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract