Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PolyFit is not working as reqired #16

Closed
HarshitSingh1509 opened this issue Dec 22, 2020 · 5 comments
Closed

PolyFit is not working as reqired #16

HarshitSingh1509 opened this issue Dec 22, 2020 · 5 comments

Comments

@HarshitSingh1509
Copy link

I was performing PolyFit(x, y, 3) but the equation which I got after this is of order 8. My x and y array are of length 9. Please help me.

@polotto
Copy link
Collaborator

polotto commented Dec 22, 2020

Hello. What is your expected results? Can you share all the values that you used?

@HarshitSingh1509
Copy link
Author

[0.01, 0.012],
[0.02, 0.024],
[0.03, 0.040],
[0.04, 0.050],
[0.05, 0.062],
[0.06, 0.075],
[0.07, 0.091],
[0.08, 0.099],
[0.09, 0.115]
these are the x and y values. after PolyFit(x,y,3). I was expecting a 3 degree polynomial but I am getting something like this 37450396823.87154 x^8 + -14811507935.892578 x^7 + 2471180555.4509788 x^6 + -226305555.54582798
x^5 + 12373211.80501761 x^4 + -410070.1388709476 x^3 + 7937.929563144283 x^2 + -79.11511904410882 x + 0.315999999986331 (R^2 = -5539833555322.959).
my code is something like
List x = [];
List y = [];
for (int i = 0; i < n; i++) {
x.add(ar[i][0]);
y.add(ar[i][1]);}
var xf = Array(x);
var yf = Array(y);
const int s = 3;
var eq = PolyFit(xf, yf, s);
print(eq);
and the result I have shown above that is 8 degree polynomial
Thankyou for such an amazing package

@polotto
Copy link
Collaborator

polotto commented Dec 22, 2020

I got it. I need time to analyse the problem, maybe this can be a fault in the polyfit algorithm, all that statical approximation it's really hard to implement and debug.
It's really great see someone enjoying the package, if possible, tell me more about what you doing. A show case of SciDart is amazing thing to put in your official website.

@HarshitSingh1509
Copy link
Author

I am working on a college project, which is going to be applied on industrial practices of absorbing columns. Actually this project is based on the application of graphical techniques like plotting graph of the data and doing calculation on the curve. I want to make a 3 degree polynomial equation, Kindly help me for this project and I am very grateful that you are helping me.

polotto pushed a commit that referenced this issue Dec 29, 2020
- Dart lint wanings removed
- test case created for issue #16
- Order added Vander matrix calculation
@polotto
Copy link
Collaborator

polotto commented Dec 29, 2020

I fixed the PolyFit degree problem, please, update to version scidart 0.0.1-dev.9

@polotto polotto closed this as completed Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants