📄 d9r9.java
字号:
import java.text.*;
public class d9r9
{
public static void main (String[] args)
{
//program d9r9
//driver for roution fgauss
int i, j, na, npt = 3;
int nlin = 2;
double x, y, e1, e2, f;
na = 3 * nlin;
double a[] = new double[7];
double dyda[] = new double[7];
double df[] = new double[7];
y = 0.0;
a[1] = 3.0; a[2] = 0.2; a[3] = 0.5; a[4] = 1.0; a[5] = 0.7; a[6] = 0.3;
d9r9F g = new d9r9F();
DecimalFormat form = new DecimalFormat("0.0000");
System.out.println(" x y data1 data2 data3 data4 data5 data6");
for (i = 1; i <= npt; i++)
{
x = 0.3 * i;
g.fgauss(x, a, y, dyda, na);
y = g.fgauss_y;
e1 = Math.exp(-Math.pow(((x - a[2]) / a[3]), 2));
e2 = Math.exp(-Math.pow(((x - a[5]) / a[6]), 2));
f = a[1] * e1 + a[4] * e2;
df[1] = e1;
df[4] = e2;
df[2] = a[1] * e1 * 2.0 * (x - a[2]) / (a[3] * a[3]);
df[5] = a[4] * e2 * 2.0 * (x - a[5]) / (a[6] * a[6]);
df[3] = a[1] * e1 * 2.0 * ((x - a[2]) * (x - a[2])) / (Math.pow(a[3], 3));
df[6] = a[4] * e2 * 2.0 * ((x - a[5]) * (x - a[5])) / (Math.pow(a[6], 3));
System.out.println("from fgauss");
System.out.print(form.format(x) + " ");
System.out.print(form.format(y) + " ");
for (j = 1; j <= 6; j++)
{
System.out.print(form.format(dyda[j]) + " ");
}
System.out.println();
System.out.println("independent calc.");
System.out.print(form.format(x) + " ");
System.out.print(form.format(f) + " ");
for (j = 1; j <= 6; j++)
{
System.out.print(form.format(df[j]) + " ");
}
System.out.println();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -