int count = dt.Rows.Count;
double heX = he(dt,0);
double heY = he(dt,1);
double x_ = heX / count;
double y_ = heX / count;
double xxl = 0;
for (int i = 0; i < count; i++)
{
xxl += Math.Pow(double.Parse(dt.Rows[i][0].ToString()),2);
}
double xyl = 0;
for (int i = 0; i < count; i++)
{
xyl += double.Parse(dt.Rows[i][0].ToString())*double.Parse(dt.Rows[i][1].ToString());
}
double xy2 = heX * heY / count;
double xy = xyl - xy2;
double yy1 = 0;
for (int i = 0; i < count; i++)
{
yy1 += Math.Pow(double.Parse(dt.Rows[i][0].ToString()),2);
}
Math.Pow求几次幂
![](https://img-home.csdnimg.cn/images/20240711042549.png)