Talk:Minkowski's question-mark function: Difference between revisions

Content deleted Content added
Meldor (talk | contribs)
iw: new section
Line 75:
 
Is the interwiki link to Russian correct? --[[User:Meldor|Meldor]] 00:10, 8 November 2007 (UTC)
 
== Algorithm to compute ?(x) ==
 
Some time ago, I wrote a program to compute ?(x) and made a graph of it (much like the one in the article) before I even knew what the function was called. I just wanted to see what this function looked like whose derivative was zero at all the rationals. Since this function is continuous, defining it at the rationals is sufficient to define it for all the reals. An algorithm to compute the function (or more precisely, to approximate it to any desired degree of accuracy) would be nice in the article, and would also serve as an alternative definition. Something on the order of:
 
a := floor(x)
 
b := a + 1
 
d := 1
 
y := a
 
while (b - a < tolerance)
: c := [[Mediant_(mathematics)|mediant]](a,b)
: d := d / 2
: if (x >= c) then
:: y := y + d
:: a := c
: else
:: b := c
output y
 
Of course a, b, and c have to be implemented as pairs of integers, and I like them to be proper fractions in practice. [[Special:Contributions/198.145.196.71|198.145.196.71]] ([[User talk:198.145.196.71|talk]]) 10:02, 2 March 2008 (UTC)