1

I'm not a mathematician, but a software developer. So I am much more comfortable reading code than I am math notation.

Could someone help provide some code for the following:

How would I create a exponential ramp function from 0,0 to 1,1 with a single value to explain curvature?

I don't mind which language (but would prefer C# or javascript), and would certainly prefer the usage of built in math functions.

Looking for an implementation of


// x is a value between 0 and 1.

// y is a value between 0 and 1.

float GetY(float x, float curvature)


Any guidance would be much appreciated, Regards, Daniel.

  • Here is an R version of such a function: myramp = function(x,curvature){y = x; if (curvature != 0) {y = (exp(curvature*x)-1)/(exp(curvature)-1)}; return(y}}. . – Hans Engler Mar 31 '18 at 16:56
  • thankyou for taking the time to answer this. This has been a great help. I have created the following for this: http://jsfiddle.net/V92Gn/6464/ With a curvature argument of 0.5, shouldn't the line be perfectly linear? It doesn't seem like it is. – user3772267 Apr 16 '18 at 19:24

0 Answers0