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

Add Slope property and Plot function to Equation struct #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ccampbell
Copy link

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 the Equation struct which lets you get the slope of an equation as a float using equation.Slope

  • Added a Plot function to the Equation 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!

Copy link
Owner

@brandenesmith brandenesmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah man, I made this to write equations that were used in a constraint database system a while back. I don't maintain it or use if for that anymore, so if you are using it and want to modify it to meet your needs go right ahead. LGTM

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

Successfully merging this pull request may close these issues.

None yet

2 participants