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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:13:35+00:00 2026-05-11T11:13:35+00:00

edit So based on the answers so far (thanks for taking your time) I’m

  • 0

edit

So based on the answers so far (thanks for taking your time) I’m getting the sense that I’m probably NOT looking for a Normal Distribution function. Perhaps I’ll try to re-describe what I’m looking to do.

Lets say I have an object that returns a number of 0 to 10. And that number controls ‘speed’. However instead of 10 being the top speed, I need 5 to be the top speed, and anything lower or higher would slow down accordingly. (with easing, thus the bell curve)

I hope that’s clearer ;/

-original question
These are the times I wish I remembered something from math class.

I’m trying to figure out how to write a function in obj-C where I define the boundries, ex (0 – 10) and then if x = foo y = ? …. where x runs something like 0,1,2,3,4,5,6,7,8,9,10 and y runs 0,1,2,3,4,5,4,3,2,1,0 but only on a curve

Something like the attached image.

I tried googling for Normal Distribution but its way over my head. I was hoping to find some site that lists some useful algorithms like these but wasn’t very successful.

So can anyone help me out here ? And if there is some good sites which shows useful mathematical functions, I’d love to check them out.

TIA!!!

-added
I’m not looking for a random number, I’m looking for.. ex: if x=0 y should be 0, if x=5 y should be 5, if x=10 y should be 0…. and all those other not so obvious in between numbers

alt text http://dizy.cc/slider.gif

  • 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. 2026-05-11T11:13:36+00:00Added an answer on May 11, 2026 at 11:13 am

    Okay, your edit really clarifies things. You’re not looking for anything to do with the normal distribution, just a nice smooth little ramp function. The one Paul provides will do nicely, but is tricky to modify for other values. It can be made a little more flexible (my code examples are in Python, which should be very easy to translate to any other language):

    def quarticRamp(x, b=10, peak=5):     if not 0 <= x <= b:         raise ValueError   #or return 0     return peak*x*x*(x-b)*(x-b)*16/(b*b*b*b) 

    Parameter b is the upper bound for the region you want to have a slope on (10, in your example), and peak is how high you want it to go (5, in the example).

    Personally I like a quadratic spline approach, which is marginally cheaper computationally and has a different curve to it (this curve is really nice to use in a couple of special applications that don’t happen to matter at all for you):

    def quadraticSplineRamp(x, a=0, b=10, peak=5):     if not a <= x <= b:         raise ValueError   #or return 0     if x > (b+a)/2:         x = a + b - x     z = 2*(x-a)/b     if z > 0.5:         return peak * (1 - 2*(z-1)*(z-1))     else:         return peak * (2*z*z) 

    This is similar to the other function, but takes a lower bound a (0 in your example). The logic is a little more complex because it’s a somewhat-optimized implementation of a piecewise function.

    The two curves have slightly different shapes; you probably don’t care what the exact shape is, and so could pick either. There are an infinite number of ramp functions meeting your criteria; these are two simple ones, but they can get as baroque as you want.

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

Sidebar

Related Questions

EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
I would like to display certain meta data fields in the edit form based
Edit: From another question I provided an answer that has links to a lot
I'm looking into developing an application that will process data from a line-scan camera
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know

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.