Manipulate[PolarPlot[Sin[6t]^2,{t,0,i*Pi/6},
ColorFunction->Function[t,Hue[12*Sin[t]/i]],
PlotStyle->Thick,ImageSize->Large],
{i,Range[1,12,1]}]
xxxxxxxxxx
var('u,i'); f1(u,i)=i*(9+.9*cos(12*u))
f2(u,i)=(1+.05*cos(36*u))
f3(u,i)=(1+.05*cos(216*u))*(1+sin(u))
sum([polar_plot(
f1(u,i)*f2(u,i)*f3(u,i),(u,-pi,pi),
color=(0,1-.3*i,0),thickness=.7,plot_points=200)
for i in [.1,.2,..,3]]).show(axes=False)
xxxxxxxxxx
u,v=var('u,v'); T1=Spherical('radius',['azimuth','inclination'])
T2=SphericalElevation('radius',['azimuth','elevation'])
p1=plot3d(v/6+cos(5*u),(u,0,2*pi),(v,0,2*pi),color='crimson',
opacity=.4,transformation=T1,frame=False,
plot_points=(50,50),mesh=True);
p2=plot3d(v/6+cos(5*u),(u,0,2*pi),(v,0,2*pi),color='green',
opacity=.3,transformation=T2,frame=False,
plot_points=(30,30),mesh=True);
(p1+p2).show()
xxxxxxxxxx
u,v=var('u,v'); f=cos(3*u)-cos(16*u)*sin(5*v)
def color_f(u,v): return abs(sin(u+v))
spherical_plot3d(f,(u,0,2*pi),(v,0,2*pi),
frame=False,plot_points=50,
color=(color_f,colormaps.hot))
xxxxxxxxxx
%%html
<style>@import 'https://fonts.googleapis.com/css?family=Sancreek';
.axis text,.bar text {fill:#3636ff; font-family:Sancreek;
font-size:90%; text-shadow:3px 3px 3px #aaa;}
.bar rect {fill:#3636ff; opacity:.5;}
</style><svg id='svg1' width='650' height='350'
style='background-color:lavender;'/><script>
var data=d3.range(3000).map(d3.randomBates(5)),
formatCount=d3.format(',.0f');
var svg=d3.select('#svg1'),
m=30,margin={top:m,right:m,bottom:m,left:m},
width=+svg.attr('width')-margin.left-margin.right,
height=+svg.attr('height')-margin.top-margin.bottom,
tr='translate('+margin.left+','+margin.top+')',
g=svg.append('g').attr('transform',tr);
var x=d3.scaleLinear().rangeRound([0,width]);
var bins=d3.histogram().domain(x.domain())
.thresholds(x.ticks(30))(data);
var y=d3.scaleLinear().range([height,0])
.domain([0,1.1*d3.max(bins,function(d){return d.length;})]);
var bar=g.selectAll('.bar').data(bins).enter()
.append('g').attr('class','bar')
.attr('transform',function(d){
return 'translate('+x(d.x0)+','+y(d.length)+')';});
bar.append('rect').attr('x',0)
.attr('width',x(bins[0].x1)-x(bins[0].x0)-2)
.attr('height',function(d){return height-y(d.length);});
bar.append('text').attr('text-anchor','middle')
.text(function(d){return formatCount(d.length);})
.attr('dy','.55em').attr('y',-10)
.attr('x',(x(bins[0].x1)-x(bins[0].x0))/2);
g.append('g').attr('class','axis axis--x')
.call(d3.axisBottom(x))
.attr('transform','translate(0,'+height+')');
g.append('text').attr('y',5)
.attr('font-family','Sancreek')
.text('The Example of D3 Histograms');
xxxxxxxxxx
display(r.eval("""
z<-complex(real=-sqrt(2-sqrt(3)),
imaginary=sqrt(2+sqrt(3)))
# polar form
zp<-Mod(z)*(cos(Arg(z))+sin(Arg(z))*sqrt(as.complex(-1)))
# exponential form
ze<-Mod(z)*exp(Arg(z)*sqrt(as.complex(-1)))
cat(zp==ze); c(z,zp,ze)"""))
xxxxxxxxxx
import numpy
def sigmoid(x): return 1./(1+numpy.exp(-x))
def sigmoid_derivation(x): return x*(1.-x)
X=numpy.array([[.10,.05,.95],[.09,.03,.08],[.01,.09,.91],
[.04,.92,.07],[.05,.02,.04],[.07,.97,.05],
[.06,.02,.98],[.02,.06,.03],[.01,.09,.03],
[.02,.94,.01]])
Y=numpy.array([[1,0,1,2,0,2,1,0,1,2]]).T
synapse0=numpy.random.randn(3,1)
for iter in range(100):
layer0=X; layer1=sigmoid(numpy.dot(layer0,synapse0))
layer1_error=layer1-Y
layer1_delta=layer1_error*sigmoid_derivation(layer1)
synapse0_derivative=numpy.dot(layer0.T,layer1_delta)/Y.shape[0]
synapse0-=synapse0_derivative
print(numpy.hstack((numpy.hstack((X,Y)),(layer1.round(3)))))
print('the 9th row wasn`t labeled rightly')
print('the neuron has corrected this mistake')
xxxxxxxxxx
p=Graphics()
for i in range(2,9):
p+=plot(log(x^i),1,2,
fill=lambda x:nth_prime(x^i)/floor(x^i),
fillcolor=hue((i-2)/7))
p.show(figsize=5,gridlines=True)