Replies: 10 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? |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
Ok thanks for your feedback. Let's keep this in mind when composing functionality in this area. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your inputs @milahu . Any idea on how we could integrate this nicely in mathjs? "Just" import these as new functions? |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions