简单的js问题:请问怎么在js里面实现求一个矩阵的数学期望值?


简单的js问题:请问怎么在js里面实现求一个矩阵的数学期望值?

芜湖不芜
浏览 620回答 5
5回答

繁花不似锦

var variance = function(numbers) {var mean = 0;var sum = 0;for(var i=0;i<numbers.length;i++){sum += numbers[i];}mean = sum / numbers.length;sum = 0;for(var i=0;i<numbers.length;i++){sum += Math.pow(numbers[i] - mean , 2);}return sum / numbers.length;};

杨__羊羊

var sum=0arr.foreach((value,index)=>{sum+=arr[index]})var mean=sum/arr.length()

侃侃尔雅

var mean = 0;var sum = 0;for(var i=0;i<numbers.length;i++){sum += numbers[i];
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript