Minkowski question-mark function: Difference between revisions

m
used an over/under style for the two possible continued fraction representations.
m (→‎{{header|REXX}}: added a TRANS.)
m (used an over/under style for the two possible continued fraction representations.)
Line 9:
The question-mark function is continuous and monotonically increasing, so it has an inverse.
 
* Produce a function for {{math|?(x)}}. &nbsp; Be careful: rational numbers have two possible continued fraction representations — {{math|[a<sub>0</sub>;a<sub>1</sub>,... a<sub>n−1</sub>,a<sub>n</sub>]}} and {{math|[a<sub>0</sub>;a<sub>1</sub>,... a<sub>n−1</sub>,a<sub>n</sub>−1,1]}} — choose the one that will give a binary expansion ending with a 1.:
:::* &nbsp; {{math|[a<sub>0</sub>;a<sub>1</sub>,... a<sub>n−1</sub>,a<sub>n</sub>]}} &nbsp; &nbsp; and
:::* &nbsp; {{math|[a<sub>0</sub>;a<sub>1</sub>,... a<sub>n−1</sub>,a<sub>n</sub>−1,1]}}
* Choose one of the above that will give a binary expansion ending with a &nbsp; '''1'''.
* Produce the inverse function {{math|?<sup>-1</sup>(x)}}
* Verify that {{math|?(φ)}} = 5/3, where {{math|φ}} is the Greek golden ratio.