Add Slope property and Plot function to Equation struct #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am aware this library may not be maintained, but I was using it and wanted some additional functionality so I figured I would at least submit a pull request.
I implemented two changes:
Added a
Slope
property to theEquation
struct which lets you get the slope of an equation as a float usingequation.Slope
Added a
Plot
function to theEquation
struct which lets you plot any point on the new linear approximation.This is so that you can pass in a bunch of points and then generate equations, and from the equations get back a new set of points that fit to the linear equations. You pass in the
x
coordinate is a float and get back the y coordinate.Arguably it might be better to get back an array of all of the new points on the linear graph instead of the individual equations, but these changes made what I wanted to do easier.
Thanks for the library!