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 8185595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:54:14+00:00 2026-06-07T01:54:14+00:00

I am working on a method wich should decide whether or not a curve

  • 0

I am working on a method wich should decide whether or not a curve has a nearly constant slope or not.

There are of course x,y points involved. What I did so far is dividing y of each data point by its x to get the slope of that data point. I store this slopes in a List<double>

I think so far I am on the right track (tell me please, if I am not!). Now it’s time to decide about being dealing with a constant curve or not, so I ended up with the method below:

private bool IsConstantSlope(List<double> slopes)
{            
    var max = slopes.Max();
    var min = slopes.Min();
    var diff = max - min;

    return (diff > 0.01) ? false : true;        
}

So what I do here checking for maximum and minimum values of slopes and compare it to a custom threshold which I beleive is not good at all.

This method works good for perfectly constant sloped lines, but I want to give it some felexibility, I don’t think comparing the difference of max and min values to a constant number is a good practice.

I will appriciate more ideas!

  • 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-06-07T01:54:16+00:00Added an answer on June 7, 2026 at 1:54 am

    There are ofcource x,y points involved. what I did so far is dividing
    y of each data point by its x to get the slope of that data point. I
    store this slopes in a List

    Strictly speaking a point does not have a slope, what you are measuring here is the slope of the line that connects your point (x,y) and the point (0,0). So if you are doing this for an ordered set of points, then the notion of having a single line is not quite correct. You dont even have the set of slopes of lines that connect adjacent points. Also in your function

     return (max > 0.01) || (min < -0.01);
    

    is better if your threshold is 0.01.

    If what you really want is a line that fits or approximates the set of points then you first need to perform some kind of straight line regression to your data and test the gradient of this approximating line to see if it is within your threshold limits.

    This might be a useful read http://en.wikipedia.org/wiki/Simple_linear_regression

    Alternatively, you can order your points by their x value, then work out the slope between each consecutive pair (effectively generating a polyline) and store these in your list and then use your slope camparison function.

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

Sidebar

Related Questions

Both methods MyBehavior::CreateSerializer() are not called of some reason, but ReplaceBehavior() method is working.
My delete method is not working, here is what is happening at the moment.
As the reverse of i.toString(32) is there a better (i.e. working) method to use
I can't get the .delay method working in jQuery: $.delay(3000); // not working $(queue).delay(3000);
Possible Duplicates: Javascript toSource() method not working Implementing Mozilla’s toSource() method in Internet Explorer.
createThumb() method working with localhost on apache server.But, the same function not working with
This method is working totally right in matlab. but, when I compiled it in
I am working in getView() method in the code below. I am trying to
I am working on a method that will allow me to pull in the
I'm working on a Method which does some task asynchronously. Let's call it: AsyncMethod();

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.