javascript - js implements the algorithm of upper parabola
欧阳克2017-06-14 10:52:30
0
4
953
It’s not about drawing this line, it’s a function, the parameter is an x, and the return value increases with the value of x, showing the trend in the picture above. Please provide such a function, thank you!
Upper Parabola? It looks like a quarter circle from the picture. .
Exponential function
For example, quadratic function
y = ax^2 + bx + c
About this
Trigonometric functions
Have a look and this one is more consistent. . .
y = -cos wx + o
Probably like this. . . .
Parabola
The mathematical form is
x^2 = 2p * y
that is
y = x ^ 2 / 2p
Same as the exponential function form
Power function
Probably looks like this
Quarter of a circle
Use...canvas' arc to draw an arc
Probably looks like this
However, when
x
reaches outside the radius, there is no real solution. .canvas part
Probably like this. . But it is easy to stack overflow. .
Isn’t this a math problem, f(x)=ax*x + bx + c
function(x) { return x**2; }
function fn(x) {
}
console.log(fn(9));