Tuesday, December 31, 2019

AnglePath 3D Layers


CT[col_,s_]:=Module[{r,t,n},
r=RandomReal[10,90];
t=AnglePath[Flatten[Table[r*Pi+.1^3,
{i,100}]]];n=Length[t];
t=Table[Flatten[{t[[i]],.1^3i}],{i,n}];
l=Table[{ColorData[col][Cos[i]^2],
Line[{t[[i]],t[[i+1]]}]},{i,n-1}];
Graphics3D[l,Boxed->False,ImageSize->s]];
CT["AuroraColors",500]

Sunday, December 29, 2019

Random Polygons as Layers


PPRT3D[col_,s_]:=Module[{a,b,c,d},
a=RandomInteger[{3,8}];b=RandomInteger[{9,16}];
c=RandomInteger[{3,25}];d=RandomInteger[{5,11}];
PF=Function[{i,t,a,b,c,d},
{Cos[2i*t/d+2i*Pi/c]+Cos[2a*i*t/d+2i*Pi/c]+
Cos[2b*i*t/d+2i*Pi/c],
Sin[2i*t/d+2i*Pi/c]-Sin[2a*i*t/d+2i*Pi/c]+
Sin[2b*i*t/d+2i*Pi/c],
5i/c}];
Show[Table[ParametricPlot3D[PF[i,t,a,b,c,d],
{t,0,a*b*c*d*Pi},PlotStyle->{ColorData[col][i/c],
Thickness[.001]}],{i,c}],PlotPoints->100,
PlotRange->All,Axes->False,Boxed->False,ImageSize->s]]
PPRT3D["Pastel",600]

Linear Programming as Exercises​


Minimize ax+(a+4)y, subject to constraints  bx+y>=3 & x+4y>=c
and implicit non-negative constraints

LPT[a_,b_,c_]:=Table[Max[Table[{LinearProgramming[{a,
a+4},{{b,1}},{3}],LinearProgramming[{a,
a+5},{{1,4}},{c}]}[[i,j]],{i,2}]],{j,2}];
LPTP[a_,b_,c_]:=Module[{x,y},
T=Flatten[{Table[a*x+(a+4)*y==1+.5i,
{i,7}],b*x+y==3,x+4y==c}];
PL=Flatten[{Table[1+.5i,{i,7}],{3,c}}];
ContourPlot[Evaluate[T],{x,-.1,5},{y,-.1,1},
PlotRange->All,Axes->True,Frame->False,
ContourStyle->{Dotted,Dotted,Dotted,Dotted,
Dotted,Thick,Dashed,Thick,Thick},
PlotLegends->PL,Background->RGBColor["silver"],
Epilog->Style[Circle[LPT[a,b,c],.1],
Darker[Magenta,.7]],ImageSize->500]];
LPTP[1,2,4]


Modules with Parametric Functions


PPF[a_,b_,n_,col_,s_]:=Module[{},
X[t_]:=Cos[t]+Cos[a*t]/2+Sin[(a+b)t]/3;
Y[t_]:=Sin[t]+Sin[a*t]/2+Cos[(a+b)t]/3;
Show[Table[ParametricPlot[{X[t],Y[t]},
{t,2(i-1)*Pi/n,2i*Pi/n},
PlotStyle->ColorData[col][i/n]],{i,n}],
ImageSize->s,PlotRange->All,Axes->False]];
{PPF[15,12,12,"BrightBands",400],
PPF[7,16,36,"BrightBands",400]}


ComplexPlot Options


ComplexPlot[2Exp[Log[z^8]+1]/(z^8-1),
{z,-1.5-1.5I,1.5+1.5I},PlotPoints->100,
ColorFunctionScaling->False,
ColorFunction->{Hue[16#8/(8+#7)]&},
Mesh->{Range[-100,100,5],Range[-100,100,5]},
MeshStyle->{RGBColor["#33FF33"],RGBColor["#FF33FF"]},
MeshFunctions->{8Re[#2]&,2Im[#2]&},ImageSize->500]