【Java开源代码栏目提醒】:网学会员Java开源代码为您提供d11r8.java参考,解决您在d11r8.java学习中工作中的难题,参考学习。
import java.text.*;
public class d11r8
{
public static void main (String[] args)
{
//program d11r8
//driver for routine frprmn
int iter, k, ndim = 3;
double fret, angl, pio2 = 1.5707963;
double ftol = 0.000001;
double p[] = new double[4];
d11r8F g = new d11r8F();
DecimalFormat form = new DecimalFormat("0.000000");
fret = 0;
iter = 0;
System.out.println("Program finds the minimum of a function");
System.out.println("with different trial starting vectors.");
System.out.println("True minimum is (0.5, 0.5, 0.5)");
for (k = 0; k <= 4; k++)
{
angl = pio2 * k / 4.0;
p[1] = 2.0 * Math.cos(angl);
p[2] = 2.0 * Math.sin(angl);
p[3] = 0.0;
System.out.println();
System.out.print("Starting vector: (");
System.out.print(form.format(p[1]) + " ");
System.out.print(form.format(p[2]) + " ");
System.out.println(form.format(p[3]) + ")");
g.frprmn(p, ndim, ftol, iter, fret);
iter = g.frprmn_iter;
fret = g.frprmn_fret;
System.out.println("Iterations: "+iter);
System.out.print("Solution vector: (");
System.out.print(form.format(p[1]) + " ");
System.out.print(form.format(p[2]) + " ");
System.out.println(form.format(p[3]) + ")");
System.out.println("func. value at solution " + fret);
}
}
}
上一篇:
d11r7F.java
下一篇:
法律专业开题报告范文