def _golden(self, triplet, fun):
self.num_golden = <NUM_LIT:0><EOL>(qa, fa), (qb, fb), (qc, fc) = triplet<EOL>while True:<EOL><INDENT>self.num_golden += <NUM_LIT:1><EOL>qd = qa + (qb-qa)*phi/(<NUM_LIT:1>+phi)<EOL>fd = fun(qd)<EOL>if fd < fb:<EOL><INDENT>(qa, fa), (qb, fb) = (qb, fb), (qd, fd)<EOL><DEDENT>else:<EOL><INDENT>(qa, fa), (qc, fc) = (qd, fd), (qa, fa)<EOL><DEDENT>if abs(qa-qb) < self.qtol:<EOL><INDENT>return qc, fc<EOL><DEDENT><DEDENT>
Reduce the size of the bracket until the minimum is found