本文介绍了高斯消元 - 在k点内插入范围(1,...,n)内的结果。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到高斯消除结果的插值。我已经对插值进行了编码,但输出中的位置没有出现,或者有时出现错误的位置。



double interpolationSearch(double X [],int n,int e)

{

int start,结束,pos;

start = 0;

end = n - 1;



while(start< ; =结束&& e> = X [开始]&& e< = X [结束])

{



pos = start +(((double)(end - start)/(X [end] - X [start]))*(e - X [start]));



if(X [pos] == e)

返回pos;

if(e> X [pos])

start = pos + 1;

else

end = pos - 1;

}

返回-1;

}



我尝试过:



有人可以指导我吗?我试过改变了while循环很多但仍然无法解决它

I need to find interpolation for the result of gauss elimination. I have coded the interpolation but the position in the output is not appearing or sometimes wrong position appears.

double interpolationSearch(double X[], int n, int e)
{
int start, end, pos;
start = 0;
end = n - 1;

while (start <= end && e >= X[start] && e <= X[end])
{

pos = start + (((double)(end - start) / (X[end] - X[start]))*(e - X[start]));

if (X[pos] == e)
return pos;
if (e > X[pos])
start = pos + 1;
else
end = pos - 1;
}
return -1;
}

What I have tried:

Can somebody guide me? I have tried changing the while loops alot but still could not get it solved

推荐答案


这篇关于高斯消元 - 在k点内插入范围(1,...,n)内的结果。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 16:33