【Java开源代码栏目提醒】:网学会员为广大网友收集整理了,d9r6.java,希望对大家有所帮助!
import java.text.*;
public class d9r6
{
public static void main (String[] args)
{
//program d9r6
//driver for routine fpoly
int nval = 15;
double dx = 0.1;
int npoly = 5;
double afunc[] = new double[6];
double x;
d9r6F g = new d9r6F();
DecimalFormat form = new DecimalFormat("0.0000");
System.out.println(" Powers of x");
System.out.println(" x x^0 x^1 x^2 x^3 x^4");
for (int i = 1; i <= nval; i++)
{
x =i * dx;
g.fpoly(x, afunc, npoly);
System.out.println(" ");
System.out.print(form.format(x) + " ");
for (int j = 1; j <= npoly; j++)
{
System.out.print(form.format(afunc[j]) + " ");
}
}
}
}