【Java开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了Java开源代码-d4r22.java的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
import java.text.*;
import java.io.*;
public class d4r22
{
public static void main (String[] args)
{
//program d4r22
//driver for routine bessi1
int i,n;
double nval,actual,x;
double pi = 3.1415926;
String s = new String();
d4r22F g = new d4r22F();
DecimalFormat form = new DecimalFormat("0.000000");
try
{
RandomAccessFile fin = new RandomAccessFile("d:\\Java常用数值算法集\\data\\fncval.dat","r");
String temp = new String("Modified Bessel Function I1");
String temp1 = new String();
while(s.compareTo(temp) != 0)
{
s = fin.readLine();
s = s.trim();
}
temp = fin.readLine();
temp1 = temp.substring(0,3);
double nval1 = Double.valueOf(temp1).doubleValue();
System.out.println("Modified Bessel Function I1");
System.out.println("x actual bessi1(x)");
for (i = 1; i <= (int)nval1; i++)
{
temp = fin.readLine();
temp1 = temp.substring(0,5);
x = Double.valueOf(temp1).doubleValue();
temp1 = temp.substring(6);
actual = Double.valueOf(temp1).doubleValue();
System.out.print(x + " ");
System.out.print(form.format(actual) + " ");
System.out.println(form.format(g.bessi1(x)));
}
fin.close();
}
catch(FileNotFoundException e)
{
System.out.println("FileStreamTest:" + e);
}
catch(IOException e)
{
System.out.println("FileStreamTest:" + e);
}
}
}
上一篇:
d4r21F.java
下一篇:
宽量程高精度电池数据采集系统的研究