Stats

Popular Posts

Followers

Mathematica 教學:Pi Day

戴忠淵 於 2016年3月14日星期一 下午6:08 發表
str=Reverse@Rasterize[Style[\[Pi],FontFamily->"Kokonor",Bold,Red,FontSize->20], 
RasterSize->20,ImageSize->{Automatic,25}][[1,1]][[6;;-12]];

mytext=Map[If[Total@#==255*3,"",0]&,str,{2}];

mypos=Position[Map[If[Total@#==255*3,1,0]&,str,{2}],0];

mypi=Drop[Characters[ToString@N[Pi,Length@mypos]],{2}];

Set[mytext[[mypos[[#,1]],mypos[[#,2]]]],Style[mypi[[#]],
Lighter@RandomColor[]]]&/@Range[Length@mypi];

Grid[mytext,Spacings->{0.2,0.2},Background->Black,
ItemStyle->{Directive[{RandomReal[255],RandomReal[255],
RandomReal[255]},18,Italic],None}]
Tags: , ,

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~