// ***************************************** //
// Integration Function //
// ***************************************** //
FLOAT_POLY FLOAT_POLY::integral()
{
FLOAT_POLY_CELL *temp,*before;
if(head==NULL){
//the current polynomial is degenerate
FLOAT_POLY INTEGRAL;
return(INTEGRAL);
}
else{
//this is non NULL
FLOAT_POLY INTEGRAL = *this;
temp = INTEGRAL.head;
temp->power += 1;
temp->element /= (FLOAT)(temp->power);
before = temp;
temp = temp->next;
//
while(temp!=NULL){
temp->power += 1;
temp->element /= (FLOAT)(temp->power);
before = temp;
temp = temp->next;
}
//at end of list; head holds highest power
//so add a constant to tail
before->next = new FLOAT_POLY_CELL(1.0,0);
return(INTEGRAL);
}
}