Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It depends on exactly what you are looking for: Are you looking for the unique polynomial which is defined by those three points, or are you looking for a library which will generate a polynomial which passes through all points? </p> <p>If you are looking at the first, the best technique is to construct the coefficient matrix(That is, the set of three linear equations which uniquely constrain this quadratic equation)and apply Gaussian Elimination to get your result. This can be done by hand the most efficiently, but you can also use <a href="http://commons.apache.org/math/api-2.0/index.html" rel="nofollow noreferrer">The Apache Commons Math Library's Real Matrix</a> <code>solve</code> methods. (<strong>EDIT</strong> Thanks for the correction--I speak before I think sometimes ;)</p> <p>If you are looking at the second, this is specific case of a general class of problems called <em>Interpolation by Polynomials</em>, and there are several ways of solving--Splines are my personal favorite, but all have their strengths and weaknesses. Luckily, <a href="http://commons.apache.org/math/api-2.0/index.html" rel="nofollow noreferrer">Apache Commons Math</a> implements several such methods. I would look at the <code>SplineInterpolator</code> class. Splines use cubics instead of quadratics, but they tend to be very good approximations. They also don't fail if one point is a linear multiple of another.</p> <p>For just three points, both methods should be about equal in performance characteristics. If you are doing more than three points, however, I would strongly recommend using interpolation, as using Guassian Elimination scales incredibly poorly( O(n^3)), and Splines(Or another interpolation technique) are less likely to fail.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload