protected static Ptg calcCovar( Ptg[] operands ) throws CalculationException
	{
		Ptg[] xMeanPtg = new Ptg[1];
		xMeanPtg[0] = operands[0];
		Ptg[] yMeanPtg = new Ptg[1];
		yMeanPtg[0] = operands[1];
		PtgNumber pnum = (PtgNumber) calcAverage( xMeanPtg );
		double xMean = pnum.getVal();
		pnum = (PtgNumber) calcAverage( yMeanPtg );
		double yMean = pnum.getVal();
		double[] xVals = PtgCalculator.getDoubleValueArray( xMeanPtg );
		double[] yVals = PtgCalculator.getDoubleValueArray( yMeanPtg );
		if( (xVals == null) || (yVals == null) )
		{
			return new PtgErr( PtgErr.ERROR_NA );//propagate error
		}
		double xyMean = 0;
		if( xVals.length == yVals.length )
		{
			int addvals = 0;
			for( int i = 0; i < xVals.length; i++ )
			{
				addvals += (xVals[i] * yVals[i]);
			}
			xyMean = addvals / xVals.length;
		}
		else
		{
			return new PtgErr( PtgErr.ERROR_NA );
		}

		double retval = xyMean - (xMean * yMean);
		return new PtgNumber( retval );
	}