## Is there a C++ library that implement similarly as in function Fit designating specific bi-variable polynomial form and then find fit coefficients?

Wong Slocked

### Wong Slocked (view profile)

님이 질문을 제출함. 23 Aug 2019
최근 활동 Steven Lord

### Steven Lord (view profile)

님이 댓글을 추가함. 28 Aug 2019
Is there a C++ library that implement similarly as in function Fit designating specific bi-variable polynomial form and then find fit coefficients?
ie
g = fittype( @(a,b,c,x,y) a*x.^2+b*x.*y+c*y.^2 ), ...
'independent', {'x', 'y'}, ...
'dependent', 'z' );
Is there such a C++ library also able to desianate specific bi-variable polynomial form?(up to 20th polynomial) I find it rather slow when it comes to high order polynomial using matlab Fit and want to find some C++ libs to accelerate such process.

Steven Lord

### Steven Lord (view profile)

28 Aug 2019
(up to 20th polynomial)
That smells a bit fishy. Does the underlying problem have some physical reason you expect the data to be fit well by such a high order polynomial or are you using up to a 20th order polynomial because you can? As Jeff Goldblum's character Ian Malcolm said in Jurassic Park, "Your scientists were so preoccupied with whether they could that they didn’t stop to think if they should."
What is the range of x and y data you're planning to pass into this fit object? Are you likely to encounter loss of significance when adding and subtracting multiples of x^20 and y^20?

로그인 to comment.

## 답변 수: 1

Gaurav Garg

### Gaurav Garg (view profile)

님의 답변 28 Aug 2019

Hi,
I understand that you wish to know a C++ library that is faster than fittype function in MATLAB for higher order polynomial equations. You can use cmath library in C++, where you can create a coefficient matrix, perform gaussian elimination and then back-substitute the values to get the final answer.

로그인 to comment.