What algorithm makes such a curve (img) and can it be done in javascript for the fleet?

And can you give me an example algorithm? alt text http://ryancalderoni.com/archive/ideal_curve.jpg

EDIT: And then, how would I calculate math using Javascript? Can someone add this? Sorry for not including this context initially.

NOTE. I use the "fleet" to build it, and the input for the fleet is a javascript array like this:

[[x, y], [x, y], [x, y] ...]

Therefore, given the values ​​that change the curve, I output all the points to an array with a loop and spit it out to fit into the graph.

+5
source share
7 answers

- tanh (x).

,

  tanh(x) = sinh(x) / cosh(x) =
          = [(1/2) (e^x - e^-x)] / [(1/2) (e^x + e^-x)] =
          = (e^x - e^-x) / (e^x + e^-x) = 
          = (e^(2x) - 1) / (e^(2x) + 1)


( )

, . tanh , :

y = 1 + (e^(2x - 6) - 1) / (e^(2x - 6) + 1)


( )

JavaScript

exp2x = Math.exp(2*x)
y = (exp2x - 1) / (exp2x + 1)

()

, , y 0 100, x - 0 100,

y = 50 + 50*tanh((xβˆ’50)/10)


( )

y = 50 + 50 * tanh((xβˆ’50)/10)
  = 50 + 50 * (e^((xβˆ’50)/5) - 1) / (e^((xβˆ’50)/5) + 1)

erf , ( JavaScript erf).


(OP) : !

var y = 50 + 50 * tanh((n-50)/10);

function tanh (arg) {
    return (Math.exp(arg) - Math.exp(-arg)) / (Math.exp(arg) + Math.exp(-arg));
}
+4

, ArcTangent Hyperbolic Tangent , . , , Exp [-1/x ^ n], n >= 1. , .

+3
+2

A ? .

+1

:

  • (erf(x) C)
  • (0.5 * erfc(-x/sqrt(2)))
  • (1.0 / (1.0 + exp(-x)))
+1

, , Sigmoid. . , , . .

0

All Articles