largelangre1.java

来自「数值算法例子,牛顿插值,拉格朗日,三次样条」· Java 代码 · 共 27 行

JAVA
27
字号
/*@author 邱宇峰 ,software project031,
 *2004,9,19
 */
import java.awt.*;

class largeLangre1{
	int X;
	double p;
	public largeLangre1(int location[][],int count,Graphics g){

			for(X=location[0][0];X<location[count-1][0];X++){
				for(long h=0;h<1000000;h++);
				double s=0;
  				for(int i=0;i<count;i++){
					p=(double)location[i][1];
					for(int j=0;j<count;j++){
						if(j!=i)  p=p*(((double)X-(double)location[j][0])/((double)location[i][0]-(double)location[j][0]));
					}
					s=s+p;
				}
			g.setColor(Color.red);
			g.drawString("。",X,(int)s);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?