最近那个自相似方程好火的说、、发个matlab程序大家实践一下吧~维基百科相关链接:http://en.wikipedia.org/wiki/Tupper%27s_self-referential_formula 以下摘自维基~
===================================
Tupper’s self-referential formulaFrom Wikipedia, the free encyclopedia
Tupper’s self-referential formula is a self-referential formula defined by Jeff Tupper that, when graphed in two dimensions, can visually reproduce the formula itself. It is used in various maths andcomputer science courses as an exercise in graphing formulae.
The formula was first published in his 2001 SIGGRAPH paper that discusses methods related to the GrafEq formula-graphing program he developed.
The formula is an inequality defined by:
where denotes the floor function and mod is the modulo operation.
Let k equal the following:
4858450636189713423582095962494202044581400587983244549483093085061934704708809928450644769865524364849997247024915119110411605739177407856919754326571855442057210445735883681829823754139634338225199452191651284348332905131193199953502413758765239264874613394906870130562295813219481113685339535565290850023875092856892694555974281546386510730049106723058933586052544096664351265349363643957125565695936815184334857605266940161251266951421550539554519153785457525756590740540157929001765967965480064427829131488548259914721248506352686630476300
If one graphs the set of points (x,y-k) with and such that they satisfy the inequality given above, the resulting graph looks like this:
The formula itself is a general purpose method of decoding a bitmap stored in the constant k, so it could actually be used to draw any other image. When applied to the unbounded positive range , 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 ([1], [2], [3]).
The constant k is a simple monochrome bitmap image of the formula treated as a binary number and multiplied by 17. If k is divided by 17, the least significant bit encodes 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.
以下为matlab程序~ =================================== %use the symbolic toolbox to represent the big integer k
k = sym([‘960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350’…
‘718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995’…
‘165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183’…
‘454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874’…
‘461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014’…
‘655997933798537483143786841806593422227898388722980000748404719’]);
[x,y]= meshgrid(0:1:106,0:1:16);
% evaluate the tupper formula
tupper = rem(floor(floor((y+k)/17).*2.^(-17*x – rem((y+k),17))),2);
% convert from symbolic to Matlab’s native double precision
tupper = double(tupper);
% display it!
image(fliplr((1-tupper)*255));
colormap gray
axis equal
title(‘Tupper”s (not-so-)self-referential formula!’);
set(gca, ‘XTick’, [], ‘YTick’, []);
big integer k 这一句不要吧。。
那是注释……