任意の曲線 (一連の点で定義) があり、その曲線に任意の精度で適合する多項式を生成したいと考えています。この問題に取り組む最善の方法は何ですか? または、このタスクを実行する図書館またはオンライン サービスが既に存在しますか?
ありがとう!
任意の曲線 (一連の点で定義) があり、その曲線に任意の精度で適合する多項式を生成したいと考えています。この問題に取り組む最善の方法は何ですか? または、このタスクを実行する図書館またはオンライン サービスが既に存在しますか?
ありがとう!
If your "arbitrary curve" is described by a set of points (x_i,y_i) where each x_i is unique, and if you mean by "fits" the calculation of the best least-squares polynomial approximation of degree N, you can simply obtain the coefficients b of the polynomial using
b = polyfit(X,Y,N)
where X is the vector of x_i values, Y is the vector of Y_i values. In this way you can increase N until you obtain the accuracy you require. Of course you can achieve zero approximation error by calculating the interpolating polynomial. However, data fitting often requires some thought beforehand - you need to give thought to what you want the approximation to achieve. There are a variety of mathematical ways of assessing approximation error (by using different norms), the choice of which will depend on your requirements of the resulting approximation. There are also many potential pitfalls (such as overfitting) that you may come across and blindly attempting to fit curves may result in an approximation that is theoritically sound but utterly useless to you in practical terms. I would suggest doing a little research on approximation theory if the above method does not meet your requirements, as has been suggested in the comments on your question.