{"id":131,"date":"2012-05-07T19:58:00","date_gmt":"2012-05-07T11:58:00","guid":{"rendered":"http:\/\/localhost\/?p=125"},"modified":"2014-12-14T11:31:54","modified_gmt":"2014-12-14T03:31:54","slug":"matlab_practice__tuppers_self-referential_formula_equation_with_the_same_image_really_wonderful_interesting_mathematical_equation__","status":"publish","type":"post","link":"http:\/\/wp.tsui.ml\/?p=131","title":{"rendered":"MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~"},"content":{"rendered":"<p>\u6700\u8fd1\u90a3\u4e2a\u81ea\u76f8\u4f3c\u65b9\u7a0b\u597d\u706b\u7684\u8bf4\u3001\u3001\u53d1\u4e2amatlab\u7a0b\u5e8f\u5927\u5bb6\u5b9e\u8df5\u4e00\u4e0b\u5427~\u7ef4\u57fa\u767e\u79d1\u76f8\u5173\u94fe\u63a5\uff1ahttp:\/\/en.wikipedia.org\/wiki\/Tupper%27s_self-referential_formula \u4ee5\u4e0b\u6458\u81ea\u7ef4\u57fa~<\/p>\n<p>===================================<\/p>\n<p>Tupper&#8217;s self-referential formulaFrom Wikipedia, the free encyclopedia\u00a0\u00a0<!--more--><\/p>\n<p><strong>Tupper&#8217;s self-referential formula<\/strong>\u00a0is a\u00a0<a title=\"Self-reference\" href=\"http:\/\/en.wikipedia.org\/wiki\/Self-reference\">self-referential<\/a>\u00a0<a title=\"Formula\" href=\"http:\/\/en.wikipedia.org\/wiki\/Formula\">formula<\/a>\u00a0defined by Jeff Tupper that, when graphed in two dimensions, can visually reproduce the formula itself. It is used in various\u00a0<a title=\"Mathematics\" href=\"http:\/\/en.wikipedia.org\/wiki\/Mathematics\">maths<\/a>\u00a0and<a title=\"Computer science\" href=\"http:\/\/en.wikipedia.org\/wiki\/Computer_science\">computer science<\/a>\u00a0courses as an exercise in graphing formulae.<\/p>\n<p>The formula was first published in his 2001\u00a0<a title=\"SIGGRAPH\" href=\"http:\/\/en.wikipedia.org\/wiki\/SIGGRAPH\">SIGGRAPH<\/a>\u00a0paper that discusses methods related to the\u00a0<a href=\"http:\/\/www.peda.com\/grafeq\/\" rel=\"nofollow\">GrafEq<\/a>\u00a0formula-graphing program he developed.<\/p>\n<p>The formula is an\u00a0<a title=\"Inequality (mathematics)\" href=\"http:\/\/en.wikipedia.org\/wiki\/Inequality_(mathematics)\">inequality<\/a>\u00a0defined by:<\/p>\n<dl>\n<dd><img title=\"image of tsui.ml 1\" alt=\"tsui.ml|MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~| 1\" decoding=\"async\" src=\"http:\/\/wp.tsui.ml\/wp-content\/uploads\/previous\/5d9dd6fbb2fb431604d1a3c720a446230bf7d3b6.jpg\" alt=\"\" \/><\/dd>\n<\/dl>\n<p>where\u00a0<img title=\"image of tsui.ml 2\" alt=\"tsui.ml|MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~| 2\" decoding=\"async\" src=\"http:\/\/wp.tsui.ml\/wp-content\/uploads\/previous\/other_site\/upload_wikimedia_9e4ad7b5e0ade99483a57bfb8aacfdc9.png\" alt=\"\" \/>\u00a0denotes the\u00a0<a title=\"Floor and ceiling functions\" href=\"http:\/\/en.wikipedia.org\/wiki\/Floor_and_ceiling_functions\">floor function<\/a>\u00a0and\u00a0<em>mod<\/em>\u00a0is the\u00a0<a title=\"Modulo operation\" href=\"http:\/\/en.wikipedia.org\/wiki\/Modulo_operation\">modulo operation<\/a>.<\/p>\n<p>Let\u00a0<em>k<\/em>\u00a0equal the following:<\/p>\n<p>4858450636189713423582095962494202044581400587983244549483093085061934704708809928450644769865524364849997247024915119110411605739177407856919754326571855442057210445735883681829823754139634338225199452191651284348332905131193199953502413758765239264874613394906870130562295813219481113685339535565290850023875092856892694555974281546386510730049106723058933586052544096664351265349363643957125565695936815184334857605266940161251266951421550539554519153785457525756590740540157929001765967965480064427829131488548259914721248506352686630476300<\/p>\n<p>If one\u00a0<a title=\"Graph of a function\" href=\"http:\/\/en.wikipedia.org\/wiki\/Graph_of_a_function\">graphs<\/a>\u00a0the set of points\u00a0<em>(x,y-k)<\/em>\u00a0with\u00a0<img title=\"image of tsui.ml 3\" alt=\"tsui.ml|MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~| 3\" decoding=\"async\" src=\"http:\/\/wp.tsui.ml\/wp-content\/uploads\/previous\/982c5200baa1cd118498aa84b912c8fcc2ce2d5d.jpg\" alt=\"\" \/>\u00a0and\u00a0<img title=\"image of tsui.ml 4\" alt=\"tsui.ml|MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~| 4\" decoding=\"async\" src=\"http:\/\/wp.tsui.ml\/wp-content\/uploads\/previous\/350b31fb43166d2225b9cc29462309f79252d2b6.jpg\" alt=\"\" \/>\u00a0such that they satisfy the inequality given above, the resulting graph looks like this:<\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/File:Tupper%27s_self_referential_formula_plot.png\"><img title=\"image of tsui.ml 5\" alt=\"tsui.ml|MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~| 5\" decoding=\"async\" loading=\"lazy\" src=\"http:\/\/wp.tsui.ml\/wp-content\/uploads\/previous\/da514e11728b471041012568c3cec3fdfd03235d.jpg\" alt=\"\" width=\"400\" height=\"81\" \/><\/a><\/p>\n<p>The formula itself is a general purpose method of decoding a bitmap stored in the constant\u00a0<em>k<\/em>, so it could actually be used to draw any other image. When applied to the unbounded positive range\u00a0<img title=\"image of tsui.ml 6\" alt=\"tsui.ml|MAtlab\u5b9e\u8df5\uff1aTupper&#8217;s self-referential formula! \u65b9\u7a0b\u5f0f\u4e0e\u56fe\u50cf\u76f8\u540c\u7684\u6709\u8da3\u65b9\u7a0b~\u6570\u5b66\u771f\u5947\u5999~| 6\" decoding=\"async\" src=\"http:\/\/wp.tsui.ml\/wp-content\/uploads\/previous\/other_site\/upload_wikimedia_7159fe7eafa4356d26ea4d4a2d990137.png\" alt=\"\" \/>, the formula tiles a vertical swath of the plane with a pattern that contains all possible 17 pixel tall bitmaps. One horizontal slice of that infinite bitmap depicts the drawing formula itself, but this is not remarkable since other slices depict all other possible formulae that might fit in a 17 pixel tall bitmap. Tupper has disseminated, via email, extended versions of his original formula that rule out all but one slice (<a href=\"http:\/\/www.peda.com\/selfplot\/selfplot3big.png\" rel=\"nofollow\">[1]<\/a>,\u00a0<a href=\"http:\/\/www.peda.com\/selfplot\/selfplot2.png\" rel=\"nofollow\">[2]<\/a>,\u00a0<a href=\"http:\/\/www.peda.com\/selfplot\/selfplot.png\" rel=\"nofollow\">[3]<\/a>).<\/p>\n<p>The constant\u00a0<em>k<\/em>\u00a0is a simple\u00a0<a title=\"1-bit color\" href=\"http:\/\/en.wikipedia.org\/wiki\/1-bit_color\">monochrome<\/a>\u00a0<a title=\"Bitmap\" href=\"http:\/\/en.wikipedia.org\/wiki\/Bitmap\">bitmap image<\/a>\u00a0of the formula treated as a binary number and multiplied by 17. If\u00a0<em>k<\/em>\u00a0is divided by 17, the\u00a0<a title=\"Least significant bit\" href=\"http:\/\/en.wikipedia.org\/wiki\/Least_significant_bit\">least significant bit<\/a>\u00a0encodes the top right corner; the 17 least significant bits encode the rightmost column of pixels; the next 17 least significant bits encode the 2nd rightmost column, and so on.<\/p>\n<p>\u4ee5\u4e0b\u4e3amatlab\u7a0b\u5e8f~ =================================== %use the symbolic toolbox to represent the big integer k<br \/>\nk = \u00a0sym([&#8216;960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350&#8217;&#8230;<br \/>\n&#8216;718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995&#8217;&#8230;<br \/>\n&#8216;165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183&#8217;&#8230;<br \/>\n&#8216;454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874&#8217;&#8230;<br \/>\n&#8216;461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014&#8217;&#8230;<br \/>\n&#8216;655997933798537483143786841806593422227898388722980000748404719&#8217;]);<\/p>\n<p>[x,y]= meshgrid(0:1:106,0:1:16);<\/p>\n<p>% evaluate the tupper formula<br \/>\ntupper = rem(floor(floor((y+k)\/17).*2.^(-17*x &#8211; rem((y+k),17))),2);<\/p>\n<p>% convert from symbolic to Matlab&#8217;s native double precision<br \/>\ntupper = double(tupper);<\/p>\n<p>% display it!<br \/>\nimage(fliplr((1-tupper)*255));<br \/>\ncolormap gray<br \/>\naxis equal<\/p>\n<p>title(&#8216;Tupper&#8221;s (not-so-)self-referential formula!&#8217;);<br \/>\nset(gca, &#8216;XTick&#8217;, [], &#8216;YTick&#8217;, []);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u90a3\u4e2a\u81ea\u76f8\u4f3c\u65b9\u7a0b\u597d\u706b\u7684\u8bf4\u3001\u3001\u53d1\u4e2amatlab\u7a0b\u5e8f\u5927\u5bb6\u5b9e\u8df5\u4e00\u4e0b\u5427~\u7ef4\u57fa\u767e\u79d1\u76f8\u5173\u94fe\u63a5\uff1ahttp:\/\/en.wik [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"views":808,"_links":{"self":[{"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=\/wp\/v2\/posts\/131"}],"collection":[{"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=131"}],"version-history":[{"count":1,"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":169,"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions\/169"}],"wp:attachment":[{"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wp.tsui.ml\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}