Calculating the coefficients from values of X and Y.
drindt opened this issue · 4 comments
Dear community,
I'm kindly asking for an example of calculating coefficients of a 4th line polynomial.
Then I want to calculate the Y value I am looking for from the known X.
I am grateful for any help.
Could you please elaborate? Do you need to interpolate a fourth-degree polynomial from points? Or you need to fit points with fourth degree polynomial?
I think it is the second one because interpolation does not make a lot of sense with degree higher than 3. The fit example could be found here:
. You need to bind additional symbol so it would be four polynomial coefficients and then fit it. I will add an example later.We can probably add a simplified polynomial fit as well since we have support for polynomials.
@SPC-code I'm not a mathematician, so please be careful with my question.
I would like to do fitting, but it should also be possible to search for Y outside, but it doesn't have to be precise.
To be a bit more detailed, I have X(0-30000) and Y(0-50.0) values. Now I want to get the Y calculated for the X value.
Thank you for your efforts, which I appreciate very much.
@drindt I checked the code. Adding simplified support for polynomial functions will require some minor additions to polynomials API. I will do it later. Right now here is the example using current API: https://datalore.jetbrains.com/view/notebook/DDsWb8KgH71TgC7qsKDGs1. It requires some additional code to set up.
You can call on resultPolynomial.value(arg)
both for interpolation and extrapolation. It is also possible to estimate errors for those values, but it would require adding new concepts to the probability part of the framework. Exciting idea, but my time is sadly limited.
Please feel free to start a discussion in #mathematics channel in Kotlin Slack.