Question: If a function is f(x) = x^2+2, what is the product of f(x1)*f(x2)*f(x3)*f(x4)? The values of x1 to x4 are as follows.
x1 = 0.27702;
x2 = -0.30596;
x3 = -1.96758;
x4 = 5.99652;
Answer: 969
Solved using the script below:
console.log("********************************");
function func(x){
return Math.pow(x,2)+2;
}
X1 = 0.27702;
X2 = -0.30596;
X3 = -1.96758;
X4 = 5.99652;
product=func(X1)*func(X2)*func(X3)*func(X4);
console.log(product);
No comments:
Post a Comment