[General Information]
Function Name=Rational2D
Brief Description=X-Y Rationals
Function Source=fgroup.Rational2D
Function Type=Built-in
Function Form=Expression
Number Of Parameters=10
Number Of Independent Variables=2
Number Of Dependent Variables=1
Analytical Derivatives for User-Defined=Off


[Fitting Parameters]
Naming Method=User-Defined
Names=z0,A01,B01,B02,B03,A1,A2,A3,B1,B2
Meanings=?
Initial Values=--(V)
Lower Bounds=--(X, OFF)
Upper Bounds=--(X, OFF)
Number Of Significant Digits=


[Formula]
 z = (z0 + A01*x + B01*y + B02*y^2 + B03*y^3)/(1 + A1*x + A2*x^2 + A3*x^3 + B1*y + B2*y^2)


[Constraints]



[Constants]


[Parameters Initialization]

	Curve x_curve, y_curve;
	bool bRes = get_interpolated_xz_yz_curves_from_3D_data(x_curve, y_curve, x_data, y_data, z_data );

	if(!bRes)
	{
		return;
	}
	
	vector vCoeff1, vCoeff2;
	fitpoly(x_curve, 1, vCoeff1);	
	fitpoly(y_curve, 3, vCoeff2);
	double dTemp;
	if ( fabs(vCoeff2[0] ) < 1e-6 )
		dTemp = 1;
	else
		dTemp = vCoeff2[0];
	z0 = vCoeff1[0] / dTemp;
	if ( z0 == NANUM ) z0 = 0;
	A01 = vCoeff1[1];
	B01 = vCoeff2[1];
	B02 = vCoeff2[2];
	B03 = vCoeff2[3];
	
	x_curve = 1 / x_curve;
	y_curve = 1 / y_curve;
	fitpoly(x_curve, 3, vCoeff1);
	fitpoly(y_curve, 2, vCoeff2);
	A1 = vCoeff1[1];
	A2 = vCoeff1[2];
	A3 = vCoeff1[3];
	B1 = vCoeff2[1];
	B2 = vCoeff2[2];


[Initializations]



[After Fitting]



[On Param Change]



[Independent Variables]
x=
y=


[Dependent Variables]
z=


[Controls]
General Linear Constraints=Off
Initialization Scripts=Off
Scripts After Fitting=Off
Number Of Duplicates=N/A
Duplicate Offset=N/A
Duplicate Unit=N/A
Generate Curves After Fitting=Yes
Curve Point Spacing=Uniform on X-Axis Scale
Generate Peaks After Fitting=Yes
Generate Peaks During Fitting=Yes
Generate Peaks with Baseline=Yes
Paste Parameters to Plot After Fitting=Yes
Paste Parameters to Notes Window After Fitting=Yes
Generate Residuals After Fitting=No
Keep Parameters=No
Enable Parameters Initialization=0
Compile On Param Change Script=1


[Compile Function]
Compile=0
Compile Parameters Initialization=1
On Param Change Scripts Enabled=N/A


[Origin C Function Header]



[Origin C Parameter Initialization Header]
#include <origin.h>
#include <Nag_utils.h>


