From what I remember of linear algebra, a quadratic solution can be found as follows (sorry, this is going to be poorly formatted; I don't know how to combine super/subscripts and pre tags):
Given (x1,y1), (x2,y2)...(xn, yn) are your data points, a least squares solution can be found by creating a matrix A as such:
x12 x1 1
x22 x2 1
...
xnn xn 1
and a vector b as such:
y1
y2
...
yn
We then want to solve for a vector x = (A, B, C) such that:
ATAx = ATb.
(Where AT is the matrix transpose of A). The A, B, and C that you find by solving that equation will be the coefficients in the quadratic polynomial y = Ax2 + Bx + C. If you know how to do matrix arithmetic, you should be able to swing it. I think that there are also modules on the CPAN that could help you with that.
thor
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.