-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
diff function for finding local extrema #227
Comments
Thanks for your suggestion. I've read your readme but I don't raelly understand what the function does exactly (I don't understand the outcome of the given example for example). Can you explain this a little bit more? |
Ok so it basically simply finds local maximum and local minimum values in a 2D graph. Or more precisely it finds the x-values at which those y-values are to be found. You can see the term "local maximum" / "local minimum" explained on Wiki. The wiki image is a bit sloppy though: a "global maximum" / "global minimum" can also be a "local maximum" / "local minimum". Simply put, in the algorithm I implemented a local maximum is any "valley" or "peak" in a 2D graph. To my understanding this is one of the most commonly needed calculations in math & science - I was surprised not to find a JS function for it. edit: I would appreciate any hints how to improve the docs. |
Ah, get it. Yes this is indeed a common, useful function. I think we can best introduce this together with a set of related functions like numerical integration, differentiation and others. Do you have any suggestion on what other related functions we definitely need here? As for the docs: I would include an API description. The |
As for what functions to provide: I think the list is very short if one plans to handle vectors / values only. Basically only differentiation to the n-th degree remains to be done and I will gladly do that since it's really trivial. One has to do:
Im not sure how much sense integration then makes as one can only calculate one special case (of infinite possible cases) but it could be done like this if I'm not mistaken:
|
Ok thanks for your feedback. Let's keep this in mind when composing functionality in this area. |
Ok so I've implemented all of the above now. Take a look and if you decide that you want to have it, I can make a pull request. |
its been a while : D i pushed some commits to https://github.com/milahu/diff-js now todo: detect rise-plateau-rise and fall-plateau-fall (delta y is near zero for multiple points in a row) my use case: from a scatterplot, generate interpolations for x → y and for y → x similar projects:
|
Thanks for your inputs @milahu . Any idea on how we could integrate this nicely in mathjs? "Just" import these as new functions? |
i suggest adding a new category for "numerical analysis" or "finite element algebra" ... maybe "array analysis"? (more intuitive for programmers) for the local extrema function, i would prefer a longish name like i only worked a bit on |
Makes sense to create a new category for this. Preferably a short name. How about "numerical"? So this new category would basically contain numerical functions like |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I went through your lib looking for this. Since I could not find it I implemented it myself - any interest including it to your lib?
I'm going to add two versions, the current one taking [values] and another one operating on an [x] and an [y] vector.
edit: done
The text was updated successfully, but these errors were encountered: