Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 183
ec1=plot(sqrt(x^3+17),(x,-17^(1/3),5),aspect_ratio=1) ec2=plot(-sqrt(x^3+17),(x,-17^(1/3),5),aspect_ratio=1) pt = point((-1,4)) (ec1+ec2+pt).show()
def plus(p,q): x1,y1 = p[0],p[1] x2,y2 = q[0],q[1] if p==q: #compute 2p m = (3*x1^2+4)/(2*y1) b = y1-m*x1 x3= m^2-2*x1 y3= m*x3+b else: #compute p+q m=(y2-y1)/(x2-x1) b= y1-m*x1 x3 = m^2-x1-x2 y3= m*x3+b return (x3, -y3) @interact def _(u= input_box(1,width=12), up=checkbox(), lines=checkbox(False), n=[1,2,3,4,5,6,7,8,9,10]): if up: v=sqrt(u^3+4*u) else: v=-sqrt(u^3+4*u) #define the list of points to be generated pt0 = (u,v) allPoints = [pt0] for _ in range(n): lastPt=allPoints[-1] allPoints.append(plus(pt0,lastPt)) ptsToPlot = point(allPoints) linesToPlot=line(allPoints,color='red') xmx=max([allPoints[i][0] for i in range(n+1)]) xmx=max(xmx,5) ymx=max([allPoints[i][1] for i in range(n+1)]) ymx=max(ymx,10) ec1=plot(sqrt(x^3+4*x),(x,0,xmx)) ec2=plot(-sqrt(x^3+4*x),(x,0,xmx)) print(float(xmx)) print(float(ymx)) print(allPoints) if lines: (ec1+ec2+ptsToPlot+linesToPlot).show(xmax=xmx) else: (ec1+ec2+ptsToPlot).show(xmax=xmx)
Interact: please open in CoCalc
p2=point((9,3))
p2
mylist=[1,2,3] max(6,8)
8
point([(1,1),(2,2)])
mylist[-1]
3
a,b=p1[0],p1[1]
a
9
b
3
@interact(layout={'top': [['f', 'color']],'left': [['axes'],['fill']],'bottom':[['zoom']]}) def _(f=input_box(x^2,width=20), color=color_selector(widget='colorpicker', label="color"), axes=True, fill=True, zoom=range_slider(-3,3, default=(-3,3))): show(plot(f,(x,zoom[0], 4), color=color, axes=axes,fill=fill,xmax=3))
Interact: please open in CoCalc
layout(??
@interact(layout={'top': [['a', 'b']], 'left': [['c']], 'right': [['d']]}) def _(a=input_box(x^2, width=12), b=(0..20), c=100, d=x+1): html('') show(a+b+c+d)
Interact: please open in CoCalc
@interact def _(m=('matrix', identity_matrix(5))): print m.eigenvalues() print m
Interact: please open in CoCalc
line([(0,0),(1,1)])
z=6.001+ -17*I n= 20000 s=0 for k in range(n): s += (-1)^k/(z-k) s
0.00985596612271962 + 0.0256688110729291*I