拉格朗日插值

it2022-05-05  120

#include <iostream> using namespace std; int main() { double x[4]={1.1275,1.1503,1.1735,1.1972}; double y[4]={0.1191,0.13954,0.15932,0.17903}; double yy=0; double xx=1.13; for(int i=0;i<4;i++) { double p=1; for(int j=0;j<4;j++) { if(j!=i) p=p*(xx-x[j])/(x[i]-x[j]); } yy+=p*y[i]; } cout<<yy<<endl; return 0; }

 

转载于:https://www.cnblogs.com/jiangnanyanyuchen/p/6126393.html

相关资源:拉格朗日插值算法C 实现

最新回复(0)