我的最终目标是最小化某个给定的单变量函数。为此,我使用Apache Commons Math。
因此,我实际上有一个类,如下所示:
import org.apache.commons.math3.analysis.UnivariateFunction;
import com.imsl.math.JMath;
public class FindRoughness implements UnivariateFunction {
final private double hubWindSpeed;
final private double hubHeight;
final private double latitude;
final private double sigma_target;
final private double OMEGA = 72.9E-06;
FindRoughness(double v, double z, double lat, double ti ){
this.hubWindSpeed = v;
this.hubHeight = z;
this.latitude = lat*(JMath.PI/180);
this.sigma_target = ti*this.hubWindSpeed/100;
}
private double calc_sigma( double z0){
final double F = 2*OMEGA*JMath.sin(this.latitude);
double ustar = ( .4*this.hubWindSpeed - 34.5*F*this.hubHeight )/JMath.log(this.hubHeight/z0);
double mu = 1 - ( (6*F*this.hubHeight)/(ustar) );
double p = JMath.pow(mu, 16);
return ( sigma_target - ((7.5*mu*ustar*JMath.pow((.538 + .09*JMath.log(this.hubHeight/z0)), p))/(1.0 + .156*JMath.log(ustar/(F*z0)))) );
}
public double value(double z0){
return calc_sigma(z0);
}
public UnivariateFunction find_z0(){
return new UnivariateFunction(){
public double value(double z0){
return calc_sigma(z0);
}
};
}
}
因此,给定构造函数的参数和初始值z0
,我想找出z0
let calc_sigma
retrieve的确切值0
。
尽管我不仅仅查看了他的 API,但我仍然不明白如何进行并获得我想要的结果。