Thursday, December 12, 2019

Plotting Recurrence Tables 2

function_plotting_py.ipynb
import numpy,pylab
def gen(n):
    i=1; xyi=[.1,.01]
    while i<=n:
        yield xyi; i+=1; xi,yi=xyi[0],xyi[1]
        xyi=[xi+.684*(xi-xi**2+yi),yi+.684*(yi-yi**2+xi)]
n=50000; xy=gen(n); xyn=numpy.array([el for el in xy])      
pylab.figure(figsize=(10,10)); ax=pylab.gca(); ax.set_facecolor('black')
pylab.scatter(xyn[:,0],xyn[:,1],s=.03,c=[numpy.random.random(3)])
pylab.grid(c='slategray',alpha=.4); pylab.show()

Plotting Recurrence Tables

function_plotting_py.ipynb
import numpy,pylab
def gen(a,n):
    i=1; z0=numpy.array([1+1j])[0]; xyi=[(a*z0).real,(a*z0).imag]
    while i<=n:
        yield xyi; i+=1; xi,yi=xyi[0],xyi[1]; zi=numpy.array([xi+yi*1j])[0]
        zi=a+(1-a)*zi; xyi=[zi.real,zi.imag]
n=500000; a=.01+.15*1j; xy=gen(a,n); xyn=numpy.array([el for el in xy])      
pylab.figure(figsize=(10,10)); ax=pylab.gca(); ax.set_facecolor('ghostwhite')
pylab.scatter(xyn[:,0],xyn[:,1],s=1,c=[numpy.random.random(3)])
pylab.grid(c='slategray',alpha=.4); pylab.show()

Equations & Planes

function_plotting_py.ipynb
from mpl_toolkits.mplot3d import Axes3D; from matplotlib.lines import Line2D
import numpy,pylab; X=numpy.linspace(-3,3,128); X,Z=numpy.meshgrid(X,X) 
def f1(x,z): return 2*x
def f2(x,z): return 5
Y=[f1(X,Z),-f1(X,Z),f2(X,Z),-f2(X,Z)] 
colors=['#ff36ff','#ff3636']
labels=['$\\frac{x^2}{1^2}=\\frac{y^2}{2^2}$','$y^2=5^2$']
fig=pylab.figure(figsize=(12,12)); ax=fig.add_subplot(111,projection='3d')
[ax.plot_wireframe(X,y,Z,color=colors[0],alpha=0.3for y in Y[:2]]
[ax.plot_surface(X,y,Z,cmap=pylab.cm.bwr,linewidth=1,
                 antialiased=True,rstride=3,cstride=3for y in Y[2:]]
fake2Dlines=[Line2D([0],[0],linestyle="none",c=c,marker='o'for c in colors]
ax.legend(fake2Dlines,labels,loc=9,fontsize=15); pylab.show()

Voxels & Equations


function_plotting_py.ipynb

Functions & Wireframes

function_plotting_py.ipynb
from mpl_toolkits.mplot3d import Axes3D; import numpy,pylab
pylab.rcParams['grid.color']='steelblue'; pylab.rcParams['grid.linestyle']='--'
X=numpy.linspace(-7,7,128); X,Y=numpy.meshgrid(X,X)
Z1=1/2*X**2+1/8*Y**2; Z1[Z1>6]=numpy.nan;
Z2=1/8*X**2-1/18*Y**2; Z2[Z2<-6]=numpy.nan; Z2[Z2>6]=numpy.nan;
f=pylab.figure(figsize=(12,12)); ax=f.add_subplot(111,projection='3d')
ax.plot_wireframe(X,Y,Z1,alpha=0.7,colors='#ff3636')
ax.plot_wireframe(X,Y,Z2,alpha=0.4,colors='#3636ff')
ax.text(2,7,7,'$x^2/1^2+y^2/2^2=2 \cdot z$',color='#ff3636',fontsize=20)
ax.text(-12,-7,-7,'$x^2/2^2-y^2/3^2=2 \cdot z$',color='#3636ff',fontsize=20)
ax.xaxis.pane.fill,ax.yaxis.pane.fill,ax.zaxis.pane.fill=False,False,False
ax.set_xlim(-7,7); ax.set_ylim(-7,7); ax.set_zlim(-7,7); pylab.show()

Functions & Recurrence Tables 2


Functions & Recurrence Tables


Random Polygon Plotting 2


Random Polygon Plotting


Art of Recurrence Tables 4


Art of Recurrence Tables 3


Art of Recurrence Tables 2


Art of Recurrence Tables


Surfaces' Plotting as Exercises 2


Surfaces' Plotting as Exercises


Simple & Random Parametric Plotting 2


Simple & Random Parametric Plotting

instagram09.html


RecurrenceTable Examples 3


CRTAP[b_,c1_,c2_,n_,s_,col_]:=Module[{c,init,rt,data},
c=-0.122561^c1+0.744862^c2*I;
init=Table[x+I*y,{x,-b,b,2b/249},{y,-b,b, 2b/249}];
rt=RecurrenceTable[{z[k]==z[k-1]^3+c,z[0]==init},z,{k,n}];
data=Map[If[Max[Abs[#]]<=2,1,0]&,Flatten[rt,{{2},{3},{1}}],{2}];
MatrixPlot[data,ColorFunction->col,ImageSize->s]];
{CRTAP[1.4,3,-1,5,300,"CoffeeTones"],
CRTAP[1.4,1,1,25,300,"BrightBands"]}

RecurrenceTable Examples 2


RALP2[a_,b_,n_,s_,col_]:=Module[{rt},
rt=RecurrenceTable[{
x[i+1]==(1+.01a)Abs[x[i]]-(1+.00001b)y[i]+1,
y[i+1]==x[i],x[0]==0,y[0]==0},
{x,y},{i,1,n}];
ListPlot[rt,Axes->False,Background->RGBColor["black"],
ImageSize->s,AspectRatio->1,
ColorFunction->Function[{x,y},
ColorData[col][(Cos[25x]^2+Sin[16y]^2)/2]]]];
{RALP2[15,-11,10000,300,"NeonColors"],
RALP2[7,5,25000,300,"BrightBands"]}

RecurrenceTable Examples


RALP1[a_,b_,n_,s_,col_]:=Module[{rt},
rt=RecurrenceTable[{x[i+1]==(0.7+.001a)x[i]+y[i],
y[i+1]==(-0.8+.001b)+x[i]^2,x[0]==0.1,y[0]==0.1},{x,y},{i,1,n}];
ListPlot[rt,ColorFunction->col,Axes->False,
Background->RGBColor["black"],
ImageSize->s,AspectRatio->1]];
{RALP1[0,0,15000,300,"BrightBands"],
RALP1[-11,-2,10000,300,"NeonColors"]}

ParametricPlot3D Examples 2


CPP[a_,b_]:=ParametricPlot3D[{
Cos[a*u]Sinh[v]/(1+Cosh[u]Cosh[v]),
Sin[b*u]Sinh[v]/(1+Cosh[u]Cosh[v]),
Sinh[u]Cosh[v]/(1+Cosh[u]Cosh[v])},
{u,-3,3},{v,-3,3},
PlotStyle->{RGBColor["steelblue"],
Opacity[.4]},AspectRatio->1,
Axes->False,Boxed->False,ImageSize->600,
PlotRange->All,ViewPoint->{0,1.2,.5},PlotPoints->30,
Mesh->{100,20},MeshStyle->{Orange,Cyan},
Background->RGBColor["slategray"]];
CPP[7,4]