2.1.17.2.6.3 ocmath_xatasymt


Description

Get the value of X at a vertical asymptote.

Syntax

int ocmath_xatasymt( UINT nSize, const double * vx, const double * vy, double * dXAsympt )

Parameters

nSize
[input] size of vx, vy
vx
[input] it contains curve's X coordinate's datas, should be rigid increasing
vy
[input] it contains curve's Y coordinate's datas
dXAsympt
[output] the value of X at a vertical asymtote

Return

Return OE_NOERROR if success.

Examples

EX1

void ocmath_xatasymt_ex1()
{
    double dXAtasymt;
    vector vx, vy;
    
    //******* Create sample data *****************
    vx.SetSize(13);
    vy.SetSize(13);
    vx[0] = -20;	vy[0] = -3.04762;
    vx[1] = -14;	vy[1] = -3.06667;
    vx[2] = -8;		vy[2] = -3.11111;
    vx[3] = -2;		vy[3] = -3.33333;
    vx[4] = -1;		vy[4] = -3.5;
    vx[5] = 0;		vy[5] = -4;
    vx[6] = 1;		vy[6] = NANUM;
    vx[7] = 2;		vy[7] = -2;
    vx[8] = 3;		vy[8] = -2.5;
    vx[9] = 4;		vy[9] = -2.66667;
    vx[10] = 10;	vy[10] = -2.88889;
    vx[11] = 16;	vy[11] = -2.93333;
    vx[12] = 22;	vy[12] = -2.95238;
    //******** End of Sample Data Creation *******            
    
    int nRet = ocmath_xatasymt(vx.GetSize(), vx, vy, &dXAtasymt);
    if(nRet != OE_NOERROR)
    {
      printf("Error in computing the horizontal asymptote of X\n.")
    }
    printf("The value of X at the vertical asymptote of Y = %f\n", dXAtasymt);
}

Remark

The function used for fitting function parameter initialization.

Get the value of X at a vertical asymptote. If the asymptote has two branches then X is defined as X = (xatymax+xatymin)/2 and if the asymptote has a single branch then X is defined as either xatymax or xatymin depending on where the reciprocal of the slope of the curve is closest to zero.

See Also

ocmath_yatasymt

Header to Include

origin.h

Reference