Skip to content

Algorithm to construct a linear equation from a list with >= 2 points proof of concept

License

Notifications You must be signed in to change notification settings

lbirkert/LinearEquationFromPoints

Repository files navigation

LinearEquationFromPoints

This is a proof of concept demo for an algorithm which converts an array of points >= 2 (x, y) to a linear equation y = x * m + c.


We firstly calculate the slope of each point to its left neighbour (Note that the list must be sorted by x). We can now use this value to construct the c for each point. (c = y - m * x)

We can now take the average value of both and we will get a linear equation which is in theory as close as possible to all of the points in the list.


Demo here

About

Algorithm to construct a linear equation from a list with >= 2 points proof of concept

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published