|
-
January 29th, 2010, 07:35 PM
#1
Recursion Help
I cant get this function to recursively call itself what do i have in wrong i go through debugger and it just slides right over the recursive call
double recursive (double left, double permaRight,double permaTol, double right, double tol)
{
double leftArea, rightArea, fullArea, areaAB, finalArea=0, recursiveAreaDifference=0, midpointer;
leftArea = funcArea(F(left), F(midpoint(left,right)), midpoint(left,right),left);
rightArea = funcArea(F(right), F(midpoint(left,right)), midpoint(left,right),right);
fullArea = funcArea(F(left),F(right),(midpoint(left,right)*2),0);
areaAB = (leftArea +rightArea);
midpointer = midpoint(left,right);
finalArea += areaAB;
if(left == permaRight)//if the changing left bound = the user defined right limit
{
return finalArea; //progressive addition of the area
}
if((areaAB) <= ((fullArea + tol)||(fullArea -tol)))
{
permaTol -( fabs(areaAB - fullArea));
recursiveAreaDifference += fabs((areaAB - fullArea));
left = right;
right = permaRight;
return (recursive(left,permaRight,permaTol, right, tol));
}
else
{
return recursive(left,permaRight, permaTol, midpoint(left,right), tol/2);
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|