https://github.com/optimization-js/optimization-js
https://stackoverflow.com/questions/957537/how-can-i-display-a-javascript-object
<script src="./../static/optimization.js"></script>
</p>
<p id="result"></p>
<p>
<script>
// objective that needs to be minimized
fnc = function (v) {
var result = 0.0;
for (var i = 0; i < v.length; i++){
result = result + v[i] * v[i]
}
return result;
};
var x0 = [1.0, -1.0, 0.5, -0.5, 0.25, -0.25]; // a somewhat random initial vector
// Powell method can be applied to zero order unconstrained optimization
var solution = optimjs.minimize_Powell(fnc, x0);
output = JSON.stringify(solution, null, 4);
document.getElementById("result").innerHTML = output;
</script>