[General Information]

Function Name=RectHyperbola 		; name show up in the select function dialog
Brief Description=Rectangular Hyperbola Function
Function Type=Built-in		; source type, built-in, user-defined, external dll
Function Form=Expression	; function form;
Function Source=fgroup.RectHyperbola
Number Of Parameters=2
Number Of Independent Variables=1
Number Of Dependent Variables=1


[Fitting Parameters]                        

Naming Method=user-defined
Names=a,b
Lower bounds=--,--
Upper bounds=--,--
Meanings=coefficient, coefficient

[Independent Variables]
x = 

[Dependent Variables]
y = 

[Constants]

[Formula]
y = a*b*x/(1+b*x)

[Constraints]

[Parameters Initialization]
//smooth(x_y_curve, 2);
sort(x_y_curve);
if( fabs(xatymax(x_y_curve)-xatymin(x_y_curve))<(max(x_data)-min(x_data))*2/3 ) {
   a=(yatxmin(x_y_curve)+yatxmax(x_y_curve))/2.0;
   b=-2.0/(xatymin(x_y_curve)+xatymax(x_y_curve));
}
else {
   double dy1=Curve_yfromX(&x_y_curve,0.9*min(x_data)+0.1*max(x_data))-yatxmin(x_y_curve);
   double dy2=yatxmax(x_y_curve)-Curve_yfromX(&x_y_curve,0.1*min(x_data)+0.9*max(x_data));
   if( fabs(dy1)<fabs(dy2) ) {
      a=yatxmin(x_y_curve);
      b=-1.0/max(x_data);
     }
   else {
      a=yatxmax(x_y_curve);
      b=-1.0/min(x_data);
     }
      
}
                               
[Initializations]

[After fitting]

[Controls]
General Linear Constraints=Off
Initialization scripts=Off
Scripts After fitting=Off
