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

Calculating the coefficients from values of X and Y. #519

Open
drindt opened this issue Jul 3, 2023 · 4 comments
Open

Calculating the coefficients from values of X and Y. #519

drindt opened this issue Jul 3, 2023 · 4 comments
Assignees
Labels
use case A use case for library or feature

Comments

@drindt
Copy link

drindt commented Jul 3, 2023

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.

@SPC-code
Copy link
Contributor

SPC-code commented Jul 3, 2023

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.

@drindt
Copy link
Author

drindt commented Jul 3, 2023

@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.

@SPC-code SPC-code self-assigned this Jul 3, 2023
@SPC-code SPC-code added the use case A use case for library or feature label Jul 3, 2023
@SPC-code
Copy link
Contributor

SPC-code commented Jul 7, 2023

@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.

@SPC-code
Copy link
Contributor

SPC-code commented Jul 7, 2023

Please feel free to start a discussion in #mathematics channel in Kotlin Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
use case A use case for library or feature
Projects
None yet
Development

No branches or pull requests

2 participants