Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6783701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:53:56+00:00 2026-05-26T16:53:56+00:00

I have a date/some kind of value array. When I draw it as a

  • 0

I have a date/some kind of value array. When I draw it as a chart it looks like this:

enter image description here

I’d like to find its local min and max points. I signed them by blue points on my chart above.

Is there any built in support in .net/linq/c#/f# to get local min max values of an array/list? I googled this topic. I just want to double check it before coding it by my myself and before reinventing the wheel.

Pls. check my sample chart and the blue points on it, it is not just a simple getting min max values from an array!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:53:57+00:00Added an answer on May 26, 2026 at 4:53 pm

    There is no built-in function in .NET (or F# libraries) that would do that automatically.

    To give you some initial idea – it is quite easy to solve this in F# if you only had precise data (i.e. ignoring small spikes in your chart) such that no two following values in the array are the same.

    In that case, you can find a minimum by looking for three following values such that the middle value is smaller than the previous and also smaller than the next value. This detects shapes like:

    __  __
      \/
    

    For example, if you have values containing your data, you can write:

    let values = [ 1.0; 2.0; 1.5; 1.0; 4.0; 2.0 ]
    // Add indices as the first element of a tuple (so that we can identify positions)
    let valuesIndexed = values |> Seq.mapi (fun i v -> i, v)
    
    // Use 'windowed' to create sliding window of size 3 and then 'choose'
    // indices where previous value and following value are both larger
    let mins = 
      valuesIndexed |> Seq.windowed 3 |> Seq.choose (fun arr ->
        match arr.[0], arr.[1], arr.[2] with
        | (_, vpre), (i, v), (_, vpost) when vpre > v && vpost > v -> Some i
        | _ -> None)
    

    This is not going to work for the data in your chart, because it is oversimplified, but it should give you something to start with. In practice, you’ll probably need to add some smoothing (to avoid identifying all the spikes as local minima/maxima).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data, like this: BUG DATE STATUS ---- ---------------------- -------- 9012 18/03/2008
I have some code which builds an array of date ranges. I then call
I have a table with a row that looks like this: ( 20091231 48498429,
I'm using time() to store date in the database. I have some kind of
If I have a field in a table of some date type and I
Say I have a Date, or a Phone number, or some Class which I
Is it possible in javascript to convert some date in timestamp ? i have
I have some code that uses the Oracle function add_months to increment a Date
I have two large source trees. One of them has some out of date
I have a MySQL table like the following: date count 2010-01-01 5 2010-01-02 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.