0% found this document useful (0 votes)
18 views

Algorithm For Obtaining First Bracket

The document provides an algorithm and Excel code for finding the first bracket of a function given boundary values and the sign of the function at those boundaries. The algorithm uses an if-then-else structure to update the lower and upper bounds (xlow and xhigh) based on the sign of the function (flow and fhigh) at the initial bounds and the middle point if the signs are opposite. The Excel code implements this algorithm to return the updated xlow or xhigh based on the same conditions.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Algorithm For Obtaining First Bracket

The document provides an algorithm and Excel code for finding the first bracket of a function given boundary values and the sign of the function at those boundaries. The algorithm uses an if-then-else structure to update the lower and upper bounds (xlow and xhigh) based on the sign of the function (flow and fhigh) at the initial bounds and the middle point if the signs are opposite. The Excel code implements this algorithm to return the updated xlow or xhigh based on the same conditions.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Algorithm for obtaining first bracket

IF (flow >0 AND fhigh > 0 , Then IF(flow > fhigh , Then xlow = xhigh xhigh = xhigh + x Else IF (flow < fhigh Then xhigh = xlow xlow = xlow - x ENDIF ELSEIF (flow <0 AND fhigh <0 , Then IF(flow > fhigh, Then xlow = xlow - x xhigh = xlow Else IF (flow < fhigh Then xlow = xhigh xhigh = xhigh + x ENDIF ELSEIF (flow * fhigh <0 , Then IF(flow * fmiddle<0 , Then xhigh = xmiddle else IF(fhigh * fmiddle>0 , Then xlow = xmiddle ENDIF ENDIF

Code in Excel for xlow


xlow=IF(AND(flow >0, fhigh >0), then IF(flow > fhigh, xhigh, xlow- x) else IF(AND(flow <0, fhigh <0), then IF(flow > fhigh, xlow -x, xhigh), else (bracket!!) IF(flow * fmiddle <0, xlow, xmiddle)))

IF (flow >0 AND fhigh > 0 , Then IF(flow > fhigh , Then xlow = xhigh xhigh = xhigh + x Else IF (flow < fhigh Then xhigh = xlow xlow = xlow - x ENDIF ELSEIF (flow <0 AND fhigh <0 , Then IF(flow > fhigh, Then xlow = xlow - x xhigh = xlow Else IF (flow < fhigh Then xlow = xhigh xhigh = xhigh + x ENDIF ELSEIF (flow * fhigh <0 , Then IF(flow * fmiddle<0 , Then xhigh = xmiddle else IF(fhigh * fmiddle>0 , Then xlow = xmiddle ENDIF ENDIF

Code in Excel for xhigh


xhigh=IF(AND(flow >0, fhigh >0), then IF(flow > fhigh, xhigh +x, xlow) , else IF(AND(flow <0, fhigh <0), then IF(flow > fhigh, xlow, xhigh +x), else (bracket!!) IF(flow * fmiddle <0, xmiddle, xhigh)))

You might also like