protected static Ptg calcTrend( Ptg[] operands ) throws CalculationException
	{
		if( operands.length < 1 )
		{
			return new PtgErr( PtgErr.ERROR_VALUE );
		}
// KSC: THIS FUNCTION DOES NOT WORK AS EXPECTED: TODO: FIX!

		if( true )
		{
			return new PtgErr( PtgErr.ERROR_VALUE );
		}
// 	Ptg[] forecast = new Ptg[3];
		Ptg[] forecast = new Ptg[2];
		forecast[0] = operands[0];
		if( operands.length > 1 )
		{
			forecast[1] = operands[1];
		}
// TODO: 	
// 	else // If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.
		Ptg[] newXs;
		if( operands.length > 2 )
		{
			newXs = PtgCalculator.getAllComponents( operands[2] );
		}
		else
		{
			newXs = PtgCalculator.getAllComponents( operands[1] );
		}

		String retval = "";
		for( Ptg newX : newXs )
		{
			//forecast[0] = newXs[i];
			PtgNumber p = (PtgNumber) calcForecast( forecast );
			double forcst = p.getVal();
			retval += "{" + String.valueOf( forcst ) + "},";
		}
		// get rid of trailing comma
		retval = retval.substring( 0, retval.length() - 1 );
		PtgArray pa = new PtgArray();
		pa.setVal( retval );
		return pa;
	}