- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
此代码应该找到 Standard deviation ArrayList
中的随机整数。但是,我的标准偏差代码没有显示正确的结果。它显示了预期的另一个数字。
我做错了什么?
import java.io.*;
import java.util.*;
public class Assignment4 {
public static void main(String[] args)
{
ArrayList<Integer> values = new ArrayList<Integer>();
int count = 0;
int total = 0;
Random r = new Random();
for (int i = 1; i <= 10; i++) {
values.add(r.nextInt(90)+ 1);
System.out.println(values);
}
System.out.println(mean(values));
System.out.println(sd(values));
}
public static double mean (ArrayList<Integer> table)
{
int total = 0;
for ( int i= 0;i < table.size(); i++)
{
int currentNum = table.get(i);
total+= currentNum;
}
return total/table.size();
}
public static double sd (ArrayList<Integer> table)
{
double mean= mean(table);
double temp =0;
for ( int i= 0; i <table.size(); i++)
{
temp= Math.pow(i-mean, 2);
}
return Math.sqrt(mean( table));
}
public static void selectionSort(ArrayList<Integer> table)
{
int count = table.size();
for(int pos = 0; pos < count - 1; pos++)
{
int locMin = pos;
for(int i = pos + 1; i < count; i++)
{
if(table.get(i) < table.get(locMin))
locMin = i;
}
int temp = table.get(pos);
table.set(pos, table.get(locMin) );
table.set(locMin, temp);
}
}
}
我想要一个标准偏差的 std.m 文件。它位于 data fun 工具箱中,但是我错误地更改了代码,std 命令不再起作用。如何运行原始的 std(标准偏差)命令? 最佳答案 去掉所有注释,函数std
我们写了一个监控系统。这个监视器是由代理组成的。每个代理在不同的服务器上运行,并监控特定的服务器资源(RAM、CPU、SQL Server 状态、复制状态、可用磁盘空间、Internet 访问、特定业
如何在 numpy 数组中沿特定轴在掩码下获取标准偏差? data = array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9],
我已经在 GLSL 中实现了一个高斯模糊片段着色器。我理解这一切背后的主要概念:卷积、使用线性分离 x 和 y、多次通过以增加半径...... 不过我还有几个问题: 西格玛和半径有什么关系? 我读过
这是我的数据集: 我有很多测试(测试 1 和测试 2),并且对于每个测试,有 4 个条件(C1、C2、C3 和 C4)。 我正在寻找一种解决方案,在 Excel 上按条件从测试中选择数据。所以这里每四
作业是创建一个程序,将从标准输入(包含整数列表的文件)读取到数组中,然后查找这些整数的平均值、最大值、最小值、中位数和标准差。首先,这是代码: import java.io.*; import jav
我需要一个 javascript 函数来匹配 Excel 的 STDEV 函数中使用的数学。 当我使用数组 [1,2,4,6] 时,我发现每个 js 脚本的标准偏差为 1.9202。但是,当我通过 E
因此,我想创建一个表格,显示导入的 CSV 数据文件中两个变量的均值、标准差和所有缺失值。 csv 文件如下所示: Group Var1 Var2 1 10 100 1
我想要这样的图片: x轴上下限已给定,远大于/小于给定数据。 我找到的所有图都只有 ± 1* 标准差。 我也不确定如何像这样修复 x 轴。 我的数据是一个 float 的 python 列表。 现在,
我是一名优秀的程序员,十分优秀!