A graph of 9^x + 12^x - 16^x indicates this function is decreasing from positive to negative between x=1 and x=2, allowing a binary search for the zero:
low = 1: high = 2
Do
DoEvents
prev = m
m = (low + high) / 2
If m = prev Then Exit Do
v = 9 ^ m + 12 ^ m - 16 ^ m
If v > 0 Then
low = m
If v = 0 Or low >= high Then Exit Do
Else
high = m
If v = 0 Or low >= high Then Exit Do
End If
Loop
Text1.Text = Text1.Text & m & " done"
settles down to
1.67272093446233
while this is close (sort of) to the golden ratio (1.618033988749895), it is definitely not that, which I had thought the title was alluding to.
Trying to identify it via Wolfram Alpha, I get really complicated expressions, like:
(121 e e! + 74 + 55 e + 57 e^2)/(450 e) ˜= 1.6727209344623327097
sqrt(1/29 (87 + 316 e - 315 p + 180 log(2))) ˜= 1.67272093446229078
I'm sure the log function is the natural log, and e! means the Gamma function of 1+e.
|
Posted by Charlie
on 2019-12-11 12:47:13 |