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

  • Home
  • SEARCH
  • 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 143373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:05:06+00:00 2026-05-11T08:05:06+00:00

I have a little math problem. I would like to have a function with

  • 0

I have a little math problem. I would like to have a function with these properties:

  1. for x much bigger than 0: lim f(x) = x
  2. for x much smaller than 0: lim f(x) = 0
  3. and f(0) = 1 (sorry, I had here f(1)=1 which was wrong!)
  4. f(x) should be monotonically increasing

So the function should look somewhat like this:

        ^         |   /         |  /         | /    ___.-+´ --´-----+------>         | 

The best I got so far is x/(1 + e^(-x)) but then I recognized that it drops below 0 and is not monotonically increasing.

A great help for playing around with these function is GraphFunc Online.

Also, it would be helpful if the function is fast to calculate as I need to execute it very often.

EDIT: I am using this in a program to limit values. I have an optimization algorithm, that uses curve fitting with a Levenberg-Marquardt algorithm. But this algorithm does not allow constraints, and optimizes over the full range of real values. So I need a function like this so that I can add an artificial constraint so that the function is bigger than 0. A simple approach would be to use f(x) = x² but then the function is not monotonically increasing and it has two minimas.

The Levenberg-Marquardt approximates derivatives, so I think it would be best when the function is smooth too. But I am not sure if this is absolutely necessary.

  • 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-11T08:05:07+00:00Added an answer on May 11, 2026 at 8:05 am

    Except for a discontinuty at 0, x/(1 - e^(-x)) works. So define f(0) to be 1, and you’re set.

    #define E 2.71828183 double SimpleFunc(double x) {    if (x == 0)       return 1;    return x / (1 - pow(E, (-x))); } 

    Likely faster:

    double SimpleFunc2(double x) {    if (x < 0)      return 1/(1 - x);    return x+1; } 

    Both are continuous in the first derivative, but the second one has a jump at 1 in the second derivative)

    If you really don’t want to do the piece-wise function, try this: (x^2+.1)^.5 / ((1 - e^(-x))^2+.1)^.5

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

Sidebar

Ask A Question

Stats

  • Questions 84k
  • Answers 84k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Have you tried this? http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx I had the same problem… May 11, 2026 at 5:01 pm
  • Editorial Team
    Editorial Team added an answer Did you try to enforce the use of the index?… May 11, 2026 at 5:01 pm
  • Editorial Team
    Editorial Team added an answer It may be that realpath() is helpful to you. realpath()… May 11, 2026 at 5:01 pm

Related Questions

I am maintaining a data warehouse with multiple sources of data about a class
My Situation I have a N rectangles The rectangles all have the same shape
I have created a dynamic typing system in C in order to create a
We are developing a web application that will be sold to many clients. There

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.