I'm trying to make a function where you will input your variables in an HTML form and it will calculate all Y points, but for some reasons this line of code doesn't work: m * ( x * x ) + c * x + p = points;
I don't know if my syntax is wrong or something? Full code is here:
var m = document.getElementById("m").value;
var c = document.getElementById("c").value;
var p = document.getElementById("p").value;
var x = -10;
var points;
var y = -10;
var functionPoints = points[0];
function functionResolver(m, c, p) {
while ( x > -11 && x < 11 ) {
m * ( x * x ) + c * x + p = points;
points[y] = points;
y += 1;
x += 1;
};
};
The program will do it in order of PEMA. You can either place extra brackets around the calculations or break the calculation down into smaller parts.
•Parentheses •Exponents •Multiplication/Division (left to right) •Addition/Subtraction (left to right).
For example
(m * ( x * x )) + c * x + p = points;
would be different to
m * ( x * x ) + (c * x) + p = points;
which would be different to
**m * ( x * x ) + (c * (x + p)) = points;
Also the parts might not be numbers so convert to numbers using Number()
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments