Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 379
License: GPL3
Image: ubuntu2204
Kernel: SageMath 10.3
var('x y s') eqs=[x^2+y^2-(30*s)^2,x^2+(y-10)^2-(40*s-10)^2,(x-10)^2+y^2-(10-35*s)^2] soln=solve(eqs,s) eq1=eqs[0].expand() eq2=eqs[1].expand()-eq1 eq3=eqs[2].expand()-eq1 show(eq1,eq2,eq3)

−900 s2+x2+y2−700 s2+800 s−20 y−325 s2+700 s−20 x\displaystyle -900 \, s^{2} + x^{2} + y^{2} -700 \, s^{2} + 800 \, s - 20 \, y -325 \, s^{2} + 700 \, s - 20 \, x

x1=solve(eq3,x)[0].rhs() y1=solve(eq2,y)[0].rhs()
eq4=(eq1.subs(x=x1,y=y1)).expand().simplify() show(eq4) eq4=(eq4/s^2).expand() show(eq4) soln=solve(eq4,s) sol1=soln[0].rhs() sol2=soln[1].rhs() show([sol1,sol2]) show([sol1.n(),sol2.n()])

2382516 s4−78752 s3+1925 s2\displaystyle \frac{23825}{16} \, s^{4} - \frac{7875}{2} \, s^{3} + 1925 \, s^{2}

2382516 s2−78752 s+1925\displaystyle \frac{23825}{16} \, s^{2} - \frac{7875}{2} \, s + 1925

[−8953 6461+1260953,8953 6461+1260953]\displaystyle \left[-\frac{8}{953} \, \sqrt{6461} + \frac{1260}{953}, \frac{8}{953} \, \sqrt{6461} + \frac{1260}{953}\right]

[0.647384295014192,1.99689692219462]\displaystyle \left[0.647384295014192, 1.99689692219462\right]

A1=vector([x1.subs(s=sol1),y1.subs(s=sol1)])
-65/4*s^2 + 35*s
!grep -rni 'def ' ~/sagelets/Trials/*.ipynb
/home/user/sagelets/Trials/Brilliant_November_Problem.ipynb:76: "def prob(n=30,ns=1,s=.1):\n", /home/user/sagelets/Trials/Brilliant_November_Problem.ipynb:112: "def prob(n=30,ns=1,s=.1):\n", /home/user/sagelets/Trials/Brilliant_November_Problem.ipynb:116: "def maxprob(n=30,rng=[1,3],s=.1):\n", /home/user/sagelets/Trials/Brilliant_November_Problem.ipynb:129: "def _(n=input_box(default=30,width=10),c=input_box(default=3,width=10),p=input_box(default=1/10,width=10),auto_update=false):\n", /home/user/sagelets/Trials/Brilliant_November_Problem.ipynb:169: "def prob(n=30,ns=1,s=.1):\n", /home/user/sagelets/Trials/Brilliant_November_Problem.ipynb:173: "def maxprob(n=30,rng=[1,3],s=.1):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:253: "def pol(u=-8,v=13,clr='black',symbol=false):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:481: "def pol(u=-8,v=13,b=10,clr='black',symbol=false):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:697: "def pol(u=-8,v=13,clr='black',symbol=false):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:708: "def _(t1=input_box(30,width=10),auto_update=false):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:878: "def pol(u=-8,v=13,t1=30,b=10,clr='black',symbol=false):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:976: "def pol(u=-8,v=13,b=10,clr='black',symbol=false):\n", /home/user/sagelets/Trials/PopularMechanicsProblem.ipynb:988: "def _(b=input_box(10,width=10),t1=input_box(30,width=10),auto_update=false):\n", /home/user/sagelets/Trials/activate-1.ipynb:657: "def set_axes_labels(graph, xlabel, ylabel, zlabel,minpt=true, **kwds):\n", /home/user/sagelets/Trials/activate-1.ipynb:703: "def _(t=input_box(default=6/10,width=10),b1=input_box(default=3/10,width=10),c1=input_box(default=9/10,width=10),d1=input_box(default=1/4,width=10), e1=input_box(default=1/2,width=10)):\n", /home/user/sagelets/Trials/codevelop.ipynb:536: "def set_axes_labels(graph, xlabel, ylabel, zlabel,minpt=true, **kwds):\n",
A1=vector([x1.subs(s=sol1),y1.subs(s=sol1)]) A2=vector([x1.subs(s=sol2),y1.subs(s=sol2)]) B=vector([10,0]);C=vector([0,0]);D=vector([0,10]) pol1=polygon([A1,B,C,D],fill=false)+text('('+str(A1[0].n(digits=4))+','+str(A1[1].n(digits=4))+')',(A1.n()+vector([.5,.5]).n(digits=4))) pol2=polygon([A2,B,C,D],fill=false,color='red') show(pol1)
Image in a Jupyter notebook

Clearly, only one solution is realistic

load('Trials/mc_interact.sage')
g = sphere() ga = set_axes_labels(g, 'X', 'Y', 'Z',color='black',fontsize=20,axes=true) show(ga)
-1.0 -1.0 -1.0
pol=mapv([(29/90, 61/40), (-29/90, 61/40),(-1, 0),(1,0)])
print('hi')
hi
var('x t3 b c d e') S=2*(1-t3)*(b*x+c*(1-x))+3*t3*(d*(1-x)+e*x) expand(S)
-2*b*t3*x + 2*c*t3*x - 3*d*t3*x + 3*e*t3*x - 2*c*t3 + 3*d*t3 + 2*b*x - 2*c*x + 2*c
tly.
A = np.array([ [[1,2,3], [4,5,6], [7,8,9]], [[11,12,13], [14,15,16], [17,18,19]], [[21,22,23], [24,25,26], [27,28,29]], ]) B = np.array([ [[1,2,3], [4,5,6], [7,8,9]], [[11,12,13], [14,15,16], [17,18,19]], [[21,22,23], [24,25,26], [27,28,29]], ]) C = A + B print(C)
[[[ 2 4 6] [ 8 10 12] [14 16 18]] [[22 24 26] [28 30 32] [34 36 38]] [[42 44 46] [48 50 52] [54 56 58]]]
from numpy import array from numpy import tensordot A = array([1,2]) B = array([3,4]) C = tensordot(A, B, axes=0) print(C)
[[3 4] [6 8]]
import tensorly as tly import numpy as np
/ext/sage/10.3/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/scikits/__init__.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html __import__("pkg_resources").declare_namespace(__name__) /ext/sage/10.3/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/scikits/__init__.py:1: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('scikits')`. Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages __import__("pkg_resources").declare_namespace(__name__)
dea=tly.decomposition.CP(a,1)
show(a,dea)

[[[0 1]  [2 3]] [[4 5]  [6 7]]]Rank-[[[0 1]  [2 3]] [[4 5]  [6 7]]] CP decomposition.\displaystyle \begin{array}{l} \verb|[[[0|\verb| |\verb|1]|\\ \verb| |\verb|[2|\verb| |\verb|3]]|\\ \\ \verb| |\verb|[[4|\verb| |\verb|5]|\\ \verb| |\verb|[6|\verb| |\verb|7]]]| \end{array} \begin{array}{l} \verb|Rank-[[[0|\verb| |\verb|1]|\\ \verb| |\verb|[2|\verb| |\verb|3]]|\\ \\ \verb| |\verb|[[4|\verb| |\verb|5]|\\ \verb| |\verb|[6|\verb| |\verb|7]]]|\verb| |\verb|CP|\verb| |\verb|decomposition.| \end{array}

apf=tly.decomposition.CP.fit(a) show(apf[0],apf[1])
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[24], line 1 ----> 1 apf=tly.decomposition.CP.fit(a) 2 show(apf[Integer(0)],apf[Integer(1)]) TypeError: DecompositionMixin.fit() missing 1 required positional argument: 'tensor'
a = np.array([range(8)]) a.shape = (2, 2, 2) A = np.array(('a', 'b', 'c', 'd')) A.shape = (2, 2) show(a, A)

[[[0 1]  [2 3]] [[4 5]  [6 7]]][['a' 'b'] ['c' 'd']]\displaystyle \begin{array}{l} \verb|[[[0|\verb| |\verb|1]|\\ \verb| |\verb|[2|\verb| |\verb|3]]|\\ \\ \verb| |\verb|[[4|\verb| |\verb|5]|\\ \verb| |\verb|[6|\verb| |\verb|7]]]| \end{array} \begin{array}{l} \verb|[['a'|\verb| |\verb|'b']|\\ \verb| |\verb|['c'|\verb| |\verb|'d']]| \end{array}

a[0,1,1]
3
pol=[(-1, 0),(1, 0),(1,2),(-1,2)]
P=getpoly(pol)
trap 0 rt0 = 0 rt1 = 0.3333333332593333
#save(P.quad_pic,"fivequads.png")
plot(P.C.AR,(0,pi.n()/2),aspect_ratio=.020)
Image in a Jupyter notebook
P.C.QAr+plot(0,(0,pi.n()),title="% deviation from 1/4 area")
Image in a Jupyter notebook
pol,pic=poly4(0.48739496, 0.9091, 1, 0.24369748) pol=mapv([(29/90, 61/40), (-29/90, 61/40),(-1, 0),(1,0)]) A=pol[0];B=pol[1];C=pol[2];D=pol[3] X=intsct([A,C],[B,D]);X AX=norm(A-X) BX=norm(B-X) DX=norm(D-X) angBXA=getang([A-C,(0,0),B-D]) angBXA,AX,BX,DX
(81.8526016111049, 0.491876458806038, 0.491876458806038, 1.52651314801874)
load('~/Forgons/quadapps.sage')
T=angorth5_trap(A1=[1,0],C1=[-.9,0],A2=[0,.8],C2=[0,-.85],alp1=30,bet1=90,thet1=30,alp2=120,bet2=60)
pol=T.T2.T1+T.T1.T1
[(0.000000000000000, 0.800000000000000), (-0.591887121551798, 1.14172618895780), (0.000000000000000, -0.850000000000000), (0.418527397346263, -0.608363094478902)]
T.T1.T1
[(1, 0), (0.443502884254440, 0.321293759578949), (-0.900000000000000, 0.000000000000000), (-0.900000000000000, -0.454377992302390)]
def getparams(pol,checkall=false): """returns the parameters for the member of M space which is similar to pol""" def getp(pol): pol=mapv(pol) A=pol[0];B=pol[1];C=pol[2];D=pol[3] X=intsct([A,C],[B,D]) ax=norm(X-A);cx=norm(X-C);bx=norm(X-B);dx=norm(X-D) th=getang([A-C,(0,0),B-D]) t1=2*ax/(ax+cx);t2=th/90;t3=(bx+dx)/(ax+cx);t4=bx/(bx+dx) if t1<=1+meps(10^5) and t2<= 1+meps(10^5) and t3>0 and t3<=1+meps(10^5) and t4<1: if ((rclose(t1,1) or rclose(t2,1)) and t4 > .5+meps(10^5)) or (rclose(t3,1) and ax > dx): return 'nope' return [t1,t2,t3,t4] return 'nope' allst=[] for i in range(4): x=getp(Roll(pol,i)) if type(x)==list and not checkall: return x else: allst+=[x]; #pol.reverse() pol=Refll(pol,[pol[0],pol[2]],sense=true) for i in range(4): x=getp(Roll(pol,i)) x=getp(Roll(pol,i)) if type(x)==list and not checkall: return x else: allst+=[x]; return allst def classify_quad(t1,t2,t3,t4,full=5): '''takes a set of parameters or vertices for a quadrilateral and classifies it.''' eps=meps(10^5) cls=[] if max([abs(t1-1),abs(t2-1),abs(t3-1),abs(t4-1/2)])<eps: cls+=['the square, dimension 0'] if len(cls)==full: return ": ".join(cls) if max([abs(t3-1),abs(t1-1),abs(t4-1/2)])<eps : cls+=['rectangle, dimension 1'] if len(cls)==full: return ": ".join(cls) if max([abs(t1-1),abs(t2-1),abs(t4-1/2)])<eps: cls+=['rhombus, dimension 1'] if len(cls)==full: return ": ".join(cls) if max([abs(t4-1/2),abs(t2-1),abs(t3-sqrt(t1*(2-t1)))])<eps: cls+=['right kite, dimension 1'] if len(cls)==full: return ": ".join(cls) if abs(t3-1)<eps and abs(t1-1)<eps: cls+=['equidiagonal bimajor quadrilateral, dimension 2'] if len(cls)==full: return ": ".join(cls) if abs(t1-1)<eps and abs(t4-1/2)<eps: cls+=['parallelogram, dimension 2'] if len(cls)==full: return ": ".join(cls) if abs(t4-1+t1/2)<eps and abs(t3-1)<eps: cls+=['isosceles short trapezoid, dimension 2'] if len(cls)==full: return ": ".join(cls) if abs(t4-t1/2)<eps and abs(t3-1)<eps: cls+=['isosceles tall trapezoid, dimension 2'] if len(cls)==full: return ": ".join(cls) if abs(t4-1+t1/2)<eps: cls+=['short trapezoid, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(t4-t1/2)<eps: cls+=['tall trapezoid, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(t1-1+sqrt(1-4*t3^2*t4*(1-t4)))<eps: cls+=['cyclic quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(t2-1)<eps: cls+=['orthodiagonal quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(t3-1)<eps: cls+=['equidiagonal quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(t1-1)<eps: cls+=['bimajor quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(t4-1/2)<eps: cls+=['biminor quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) # Now check tangential or extangential pol=poly4(t1,t2,t3,t4)[0] ab=norm(pol[1]-pol[0]);bc=norm(pol[1]-pol[2]);cd=norm(pol[2]-pol[3]);da=norm(pol[3]-pol[0]) if abs(ab+cd-(bc+da))<eps: cls+=['tangential quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(ab+bc-(cd+da))<eps: cls+=['major extangential quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if abs(da+ab-(cd+bc))<eps: cls+=['minor extangential quadrilateral, dimension 3'] if len(cls)==full: return ": ".join(cls) if t4<1/2*t1: cls+=['tall quadrilateral, dimension 4'] return ": ".join(cls) if t4> 1-1/2*t1: cls+=['short quadrilateral, dimension 4'] return ": ".join(cls) if t4> 1/2*t1 and t4 < 1-1/2*t1: cls+=['middle quadrilateral, dimension 4'] return ": ".join(cls) return ": ".join(cls)
help(poly4)
Help on function poly4 in module __main__: poly4(t1, t2, t3, t4, A=(1, 0), C=(-1, 0), labels=False, model=True) returns the quadrilateral ABCD defined by the parameters t1 t2 t3 t4.
pol,pic=poly4(.5,.7,.9,.3,labels=true) show(pic,figsize=4)
Image in a Jupyter notebook
T.picT.T1.D1
(-0.900000000000000, -0.454377992302390)
help(window)
Help on function window in module __main__: window(L=0, U=0, ep=0.100000000000000, sz=0, cen=(0, 0), figsize=5, color='blue', alpha=0, axes=False, aspect_ratio=1)
T=angorth5_trap(A1=[1,0],C1=[-.9,0],A2=[0,.8],C2=[0,-.85],alp1=30,bet1=90,thet1=30,alp2=120,bet2=60,trs=[0,0])
(T.pic1(0)+point([T.T1.D1])+window(ep=.1))
Image in a Jupyter notebook
param=mapn(getparams(pol),digs=10);param
[0.4873949580, 0.9094733512, 1.000000000, 0.2436974790]
@interact(layout=dict(top=[['parms', 'classify','quads','position']])) def _(parms=input_box(default=[1,1,1,1/2],width=20), quads=checkbox(default=false,label='Quadrisection(s)'), classify=checkbox(default=false,label='Classsify'),auto_update=false): global pol,D t1=parms[0];t2=parms[1];t3=parms[2];t4=parms[3] pol,pic=poly4(t1,t2,t3,t4) Pic=pic if quads and t2>10^(-12): D=dpoly(pol) Pic+=getquads2(D) if classify: tis=classify_quad(t1,t2,t3,t4) Pic+=text(tis,(0,1.5)) show(Pic,figsize=8,axes=false,aspect_ratio=1)
pic.show(title='bill was here')
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[2], line 1 ----> 1 pic.show(title='bill was here') NameError: name 'pic' is not defined
def classify_quad(t1,t2,t3,t4,full=1): '''takes a set of parameters or vertices for a quadrilateral and classifies it.''' eps=meps(10^4) cls=[] if max([abs(t1-1),abs(t2-1),abs(t3-1),abs(t4-1/2)])<eps: cls+=['the square, dimension 0'] if len(cls)==full: return cls if max([abs(t3-1),abs(t1-1),abs(t4-1/2)])<eps : cls+=['rectangle, dimension 1'] if len(cls)==full: return cls if max([abs(t1-1),abs(t2-1),abs(t4-1/2)])<eps: cls+=['rhombus, dimension 1'] if len(cls)==full: return cls if max([abs(t4-1/2),abs(t2-1),abs(t3-sqrt(t1*(2-t1)))])<eps: cls+=['right kite, dimension 1'] if len(cls)==full: return cls if abs(t3-1)<eps and abs(t1-1)<eps: cls+=['equidiagonal bimajor quadrilateral, dimension 2'] if len(cls)==full: return cls if abs(t1-1)<eps and abs(t4-1/2)<eps: cls+=['parallelogram, dimension 2'] if len(cls)==full: return cls if abs(t4-1+t1/2)<eps and abs(t3-1)<eps: cls+=['isosceles short trapezoid, dimension 2'] if len(cls)==full: return cls if abs(t4-t1/2)<eps and abs(t3-1)<eps: cls+=['isosceles tall trapezoid, dimension 2'] if len(cls)==full: return cls if abs(t4-1+t1/2)<eps: cls+=['short trapezoid, dimension 3'] if len(cls)==full: return cls if abs(t4-t1/2)<eps: cls+=['tall trapezoid, dimension 3'] if len(cls)==full: return cls if abs(t1-1+sqrt(1-4*t3^2*t4*(1-t4)))<eps: cls+=['cyclic quadrilateral, dimension 3'] if len(cls)==full: return cls if abs(t2-1)<eps: cls+=['orthodiagonal quadrilateral, dimension 3'] if len(cls)==full: return cls if abs(t3-1)<eps: cls+=['equidiagonal quadrilateral, dimension 3'] if len(cls)==full: return cls if abs(t1-1)<eps: cls+=['bimajor quadrilateral, dimension 3'] if len(cls)==full: return cls if abs(t4-1/2)<eps: cls+=['biminor quadrilateral, dimension 3'] if len(cls)==full: return cls # Now check tangential or extangential pol=poly4(t1,t2,t3,t4)[0] ab=norm(pol[1]-pol[0]);bc=norm(pol[1]-pol[2]);cd=norm(pol[2]-pol[3]);da=norm(pol[3]-pol[0]) if abs(ab+cd-(bc+da))<eps: cls+=['tangential quadrilateral, dimension 3'] if len(cls)==full: return cls if abs(ab+bc-(cd+da))<eps: cls+=['major extangential quadrilateral, dimension 3'] if len(cls)==full: return cls if abs(da+ab-(cd+bc))<eps: cls+=['minor extangential quadrilateral, dimension 3'] if len(cls)==full: return cls if t4<1/2*t1: cls+=['tall quadrilateral, dimension 4'] return ": ".join(cls) if t4> 1-1/2*t1: cls+=['short quadrilateral, dimension 4'] return cls if t4> 1/2*t1 and t4 < 1-1/2*t1: cls+=['middle quadrilateral, dimension 4'] return cls return cls
cls=classify_quad(.487400000000000, 0.910000000000000, 1, 0.2437,full=10) for c in cls: show(c)

isosceles tall trapezoid, dimension 2\displaystyle \verb|isosceles|\verb| |\verb|tall|\verb| |\verb|trapezoid,|\verb| |\verb|dimension|\verb| |\verb|2|

tall trapezoid, dimension 3\displaystyle \verb|tall|\verb| |\verb|trapezoid,|\verb| |\verb|dimension|\verb| |\verb|3|

cyclic quadrilateral, dimension 3\displaystyle \verb|cyclic|\verb| |\verb|quadrilateral,|\verb| |\verb|dimension|\verb| |\verb|3|

equidiagonal quadrilateral, dimension 3\displaystyle \verb|equidiagonal|\verb| |\verb|quadrilateral,|\verb| |\verb|dimension|\verb| |\verb|3|

Eqn1=eqn.subs(k=sol[1][0].rhs(),a=sol[1][1].rhs(),b=sol[1][2].rhs()) Eqn2=eqn.subs(k=sol[2][0].rhs(),a=sol[2][1].rhs(),b=sol[2][2].rhs()) Eqn3=eqn.subs(k=sol[3][0].rhs(),a=sol[3][1].rhs(),b=sol[3][2].rhs()) Eqn4=eqn.subs(k=sol[4][0].rhs(),a=sol[4][1].rhs(),b=sol[4][2].rhs())
var('x1,y1,z1,w1') eqn=(k - y)^2/b^2 + x^2/a^2 - 1
Eqn1=eqn.subs( k= (-440751549542831198201161/5533220865273519395330948), a = 1/92686284036895753342881653781412080*sqrt(22419555699070124546480457610617294529)*sqrt(386192850153732305595340224089217), b = 1054057/5533220865273519395330948*sqrt(22419555699070124546480457610617294529))
Eqn1=22244708168854980802291596907538899200/22419555699070124546480457610617294529.*x^2 + 1/24908937055963900416841725604336190477515580448721.*(5533220865273519395330948.*y + 440751549542831198201161.)^2 - 1.00000000000000 Eqn1
0.9922011152869369424814976667934448505*x^2 + (4.014623336809837343425993029288696660772513783868e-50)*(5.53322086527351939533095e24*y + 4.4075154954283119820116e23)^2 - 1.00000000000000
ell=implicit_plot(Eqn1,(-1.1,1.1),(-1,1))
t1,t2,t3,t4=.5,.5,.5,.45 pol,pic=poly4(t1,t2,t3,t4) quads=true;classify=true if classify: cls=classify_quad(t1,t2,t3,t4,full=5) print(cls) clrs=['black','magenta','blue','green','red'] D=dpoly(pol) Pic=D.pic C=cpoly5(D) for i in range(len(C.quads)): q=C.quads[i] Pic+=line(q[0],color=clrs[i])+line(q[1],color=clrs[i]) Pic+=Pic+line(C.oval,color='red') for i in range(len(C.trap)): tr=C.trap[i] Pic+=line([tr.T1.X(0),tr.T1.Y(0)],linestyle='dotted',color=clrs[i])+line([tr.T2.X(0),tr.T2.Y(0)],linestyle='dotted',color=clrs[i]) Gth=Graphics() Ov=Graphics() Ar=C.AR; for i in range(len(C.trap)): tr=C.trap[i];TH=tr.THET;Th=tr.Thet f=lambda t:Ar((t-TH)/Th+i) Gth+=plot(f,(TH,TH+Th),color=clrs[i])+point([(TH,f(TH))],color=clrs[i]) Ov+=line([tr.Cn(j/10) for j in range(11)],color=clrs[i]) show(Pic+Ov,figsize=5,axes=false,aspect_ratio=1) show(Gth,figsize=3) show(Ov,figsize=3)
middle quadrilateral, dimension 4 trap 0 rt1 = 0.17968012009352616 trap 1 done trap 2 done trap 3 done
Image in a Jupyter notebookImage in a Jupyter notebookImage in a Jupyter notebook
var('x,y,z,w,t1,t2,t3,t4') A=vector([1,0]);B=vector([x,y]) C=vector([-1,0]);D=vector([z,w]) P=intsct([A,B],[C,D],'nodec') Q=intsct([A,D],[C,B],'nodec') show(P);show(Q)

(−(w(z+1)−w(z−1))(x−1)w(x−1)−y(z+1)+1, −(w(z+1)−w(z−1))yw(x−1)−y(z+1))\displaystyle \left(-\frac{{\left(w {\left(z + 1\right)} - w {\left(z - 1\right)}\right)} {\left(x - 1\right)}}{w {\left(x - 1\right)} - y {\left(z + 1\right)}} + 1,\,-\frac{{\left(w {\left(z + 1\right)} - w {\left(z - 1\right)}\right)} y}{w {\left(x - 1\right)} - y {\left(z + 1\right)}}\right)

(((x+1)y−(x−1)y)(z−1)w(x+1)−y(z−1)+1, ((x+1)y−(x−1)y)ww(x+1)−y(z−1))\displaystyle \left(\frac{{\left({\left(x + 1\right)} y - {\left(x - 1\right)} y\right)} {\left(z - 1\right)}}{w {\left(x + 1\right)} - y {\left(z - 1\right)}} + 1,\,\frac{{\left({\left(x + 1\right)} y - {\left(x - 1\right)} y\right)} w}{w {\left(x + 1\right)} - y {\left(z - 1\right)}}\right)

var('t1 t2 t3 t4') B=vector([t1,0])+2*t3*t4*vector([t2,sqrt(1-t2^2)]) D=vector([t1,0])-2*t3*(1-t4)*vector([t2,sqrt(1-t2^2)]) P1=intsct([A,B],[C,D],'nodec') p=P1[0];q=P1[1] P2=vector([p.numerator()/p.denominator(),q.numerator().factor()/q.denominator()]) Q1=intsct([A,D],[C,B],'nodec') r=Q1[0];s=Q1[1] Q2=vector([r.numerator()/r.denominator(),s.numerator().factor()/s.denominator()]) show(P2) show(Q2)

(4 t2t3t42−4 t2t3t4+2 t1t4−t1+1t1+2 t4−1, 4 −t22+1t3(t4−1)t4t1+2 t4−1)\displaystyle \left(\frac{4 \, t_{2} t_{3} t_{4}^{2} - 4 \, t_{2} t_{3} t_{4} + 2 \, t_{1} t_{4} - t_{1} + 1}{t_{1} + 2 \, t_{4} - 1},\,\frac{4 \, \sqrt{-t_{2}^{2} + 1} t_{3} {\left(t_{4} - 1\right)} t_{4}}{t_{1} + 2 \, t_{4} - 1}\right)

(−4 t2t3t42−4 t2t3t4+2 t1t4−t1−1t1−2 t4+1, −4 −t22+1t3(t4−1)t4t1−2 t4+1)\displaystyle \left(-\frac{4 \, t_{2} t_{3} t_{4}^{2} - 4 \, t_{2} t_{3} t_{4} + 2 \, t_{1} t_{4} - t_{1} - 1}{t_{1} - 2 \, t_{4} + 1},\,-\frac{4 \, \sqrt{-t_{2}^{2} + 1} t_{3} {\left(t_{4} - 1\right)} t_{4}}{t_{1} - 2 \, t_{4} + 1}\right)

P2=vector([p.numerator()/p.denominator(),q.numerator().factor()/q.denominator()]);show(P2)

(4 t2t3t42−4 t2t3t4+2 t1t4−t1+1t1+2 t4−1, 4 −t22+1t3(t4−1)t4t1+2 t4−1)\displaystyle \left(\frac{4 \, t_{2} t_{3} t_{4}^{2} - 4 \, t_{2} t_{3} t_{4} + 2 \, t_{1} t_{4} - t_{1} + 1}{t_{1} + 2 \, t_{4} - 1},\,\frac{4 \, \sqrt{-t_{2}^{2} + 1} t_{3} {\left(t_{4} - 1\right)} t_{4}}{t_{1} + 2 \, t_{4} - 1}\right)

tr=C.trap[0];x1=.15;x2=.75 plot(tr.Ar1,(x1,x2),color='green')
Image in a Jupyter notebook
show(Ov,aspect_ratio=1)
Image in a Jupyter notebook
def backf(f,a,b): c=b-a def bf(t): n=floor(t/c) r=(t-n*c) if mod(n,2)==0: return f(a+r) else: return f(b-r) return bf
f=lambda x:x*(1-x)*(x-2) a=0;b=2 g=backf(f,a,b) plot(g,(0,6),figsize=4)
Image in a Jupyter notebook
1
#TceGraph=Graphics() #for i in range(6): # TceGraph+=implicit_plot3d(tce.subs(t2=i/5.),(t4,.01,1),(t3,.001,1),(t1,.001,1),color='magenta',frame=false,alpha=.3,mesh=true) #TceGraph
#CycGraph=Graphics() #for i in range(6): # CycGraph+=plot3d(cyc+i/5.,(t4,.0,1),(t3,0,1),color='turquoise',frame=false,alpha=1,mesh=true)+plot3d(cyc+1,(t4,.0,1),(t3,0,1),color='turquoise',frame=false,alpha=1,mesh=true) #CycGraph
ln(220.),ln(406.),ln(3660.),ln(3685.)
def gparms(pol): X=intsct([pol[0],pol[2]],[pol[1],pol[3]]);scl=2/norm(pol[0]-pol[2]) return scl*(norm(pol[0]-X)),getang([pol[1],X,pol[0]])/90,scl/2*(norm(pol[1]-pol[3])),norm(pol[1]-X)/norm(pol[1]-pol[3]) def tancirc(alp=90,bet=30,gam=40,r=1): cnvt=pi.n()/180 A=vector([1,0]);C=vector([-1,0]) if alp+bet+gam>180: tq=true else: tq=false if tq: br=-alp/2*cnvt;tr=alp/2*cnvt;tl=(alp/2+bet)*cnvt;bl=(-alp/2-gam)*cnvt else: br=(180+alp/2+gam)*cnvt;tr=(180-bet-alp/2)*cnvt;tl=(180-alp/2)*cnvt;bl=(180+alp/2)*cnvt degs=[br,tr,tl,bl] tpts=[sqrt(2.)/2*vector([cos(d),sin(d)]) for d in degs]; tlns=[[vector([t[1],-t[0]])+t,t] for t in tpts]; if tq: pol=[intsct(tlns[0],tlns[1]),intsct(tlns[1],tlns[2]),intsct(tlns[2],tlns[3]),intsct(tlns[3],tlns[0])] else: pol=[intsct(tlns[2],tlns[3]),intsct(tlns[3],tlns[1]),intsct(tlns[1],tlns[0]),intsct(tlns[0],tlns[2])] scl=2/norm(pol[0]-pol[2]) rad=scl*sqrt(2.)/2 pol1=[scl*(p-pol[0])+A for p in pol] tpts1=[scl*(t-pol[0])+A for t in tpts] cen1=-scl*pol[0]+A ang=180-getang(pol1[2]-pol1[0]);ang=abs(ang) pol2=Rot(pol1,pol1[0],sign(pol1[2][1])*ang) tpts2=Rot(tpts1,pol1[0],sign(pol1[2][1])*ang); cen2=Rot([cen1],pol1[0],sign(pol1[2][1])*ang)[0] t1,t2,t3,t4=gparms(pol2) #parms=[t1,t2,t3,t4];print(parms) if t3>1: print('t 3> 1') scl=1/t3;rad=scl*rad parms=[t1,t2,t3,t4] Vct=vector([cos(t2/2*pi.n()/2),sin(t2/2*pi.n()/2)]) X=intsct([pol[0],pol[2]],[pol[1],pol[3]]) pol2=Scale(Roll(Reverse(Refll(pol2,[X,X+Vct])),-2),scl) trns=A-pol2[0] pol2=Trans(pol2,trns) tpts2=Trans(Scale(Roll(Reverse(Refll(tpts2,[X,X+Vct])),-1),scl),trns) tpts2[1],tpts2[2]=tpts2[2],tpts2[1] cen2=Trans(Scale(Refll([cen2],[X,X+Vct]),scl),trns)[0] t1,t2,t3,t4=gparms(pol2) if t2>1: print('t2 > 1') pol2=Refll(pol2,[(0,0),(1,0)]) return pol2,poly4(t1,t2,t3,t4)[1],[t1,t2,t3,t4,cen2,rad,tpts2] B=pol2[1];D=pol2[3];X=intsct([A,C],[B,D]) D=A+r*(D-A) pol2[3]=D a=norm(A-B);b=norm(B-C);c=norm(C-D);d=norm(D-A) t1=norm(A-X);t2=getang([A-C,(0,0),B-D])/90;t3=norm(B-D)/2;t4=norm(B-X)/norm(B-D) clr='black' parms=[t1,t2,t3,t4] if not test_parms(t1,t2,t3,t4): clr='red' pic=circle(cen2,rad,color=clr,linestyle='dotted')+point(tpts2+[cen2],color=clr)+line([tpts2[0],cen2],color=clr,linestyle='dotted') pic+=line([tpts2[1],cen2],color=clr,linestyle='dotted') pic+=line([A,C],color=clr,linestyle='dotted')+line([pol2[1],pol2[3]],color=clr,linestyle='dotted')+line([tpts2[2],cen2],color=clr,linestyle='dotted') pic+=line([tpts2[3],cen2],color=clr,linestyle='dotted')+point(pol2+[intsct([pol2[0],pol2[2]],[pol2[1],pol2[3]])],color=clr) if not tq: var('k x1 x2') pic+=line([pol2[0],tpts2[2]],color=clr,linestyle='dotted')+line([pol2[1],tpts2[1]],color=clr,linestyle='dotted') pic+=line([pol2[2],tpts2[0]],color=clr,linestyle='dotted')+line([pol2[0],tpts2[3]],color=clr,linestyle='dotted') pic+=polygon(pol2,fill=false,color=clr) return pol2,pic,parms
pol2,pic,parms=tancirc(150,30,70,1) show(pic) t1,t2,t3,t4=gparms(pol2) pol3,pic1=poly4(2-t1,t2,t3,1-t4) show(pic1) print(parms);print(2-t1,t2,t3,1-t4) show(classify_quad(2-t1,t2,t3,1-t4))
pol,pic=poly4(1/3,1/2,1,1-1/6) pol1,pic1=poly4(1/3,1/2,1,1/6) show(gtsidesangs(pol)) show(gtsidesangs(pol1)) show(pic);show(pic1)
def good_parms(t1,t2,t3,t4): pol,pic=poly4(t1,t2,t3,t4) if t3>1: #reflect about bisector of angle BXA print('t3>1') t1,t2,t3,t4=2*t4,t2,1/t3,t1/2 pol1 ,pic1 =poly4(t1,t2,t3,t4) pic+=pic1 show([t1,t2,t3,t4]) show(gtsidesangs(pol1)) pol=pol1 if t2>1 and t1<=1: #reflect about x-axis print('t2>1 and t1<=1') t1,t2,t3,t4=t1,2-t2,t3,1-t4#;show(poly4(t1,t2,t3,t4)[1]);return pol2 ,pic2 =poly4(t1,t2,t3,t4) pic+=pic2 show([t1,t2,t3,t4]) show(gtsidesangs(pol2)) pol=pol2 if t1>1+meps(10^5): #reflect about y-axis print('t1>1') t1,t2,t3,t4=2-t1,2-t2,t3,t4 pol3,pic3=poly4(t1,t2,t3,t4) pic+=pic3 show([t1,t2,t3,t4]) show(gtsidesangs(pol3)) pol=pol3 show(pic,axes=false,aspect_ratio=1) return pol,[t1,t2,t3,t4] def transform(t1,t2,t3,t4,trans=''): pol,pic=poly4(t1,t2,t3,t4) #show(pic) show([t1,t2,t3,t4]) show(gtsidesangs(pol)) if trans=='RBXA': #reflect about bisector of angle BXA t1,t2,t3,t4=2*t4,t2,1/t3,t1/2 show('Reflect about bisector of angle BXA: t1,t4=2*t4,t1/2') pol1 ,pic1 =poly4(t1,t2,t3,t4) #pic+=(polygon(pol1,fill=false,color='purple')+line([pol1[0],pol1[2]])+line([pol1[1],pol1[3]])) pic+=pic1 #show(pic) show([t1,t2,t3,t4]) show(gtsidesangs(pol1)) return t1,t2,t3,t4 if trans=='Ry': #reflect about y-axis t1,t2,t3,t4=2-t1,2-t2,t3,t4 show('Reflect about y-axes: t1,t2=2-t1,2-t2') pol1 ,pic1 =poly4(t1,t2,t3,t4) #pic+=(polygon(pol1,fill=false,color='brown')+line([pol1[0],pol1[2]])+line([pol1[1],pol1[3]])) pic+=pic1 #show(pic) show([t1,t2,t3,t4]) show(gtsidesangs(pol1)) return t1,t2,t3,t4 if trans=='Rx': #reflect about x-axis t1,t2,t3,t4=t1,2-t2,t3,1-t4 show('Reflect about x-axes: t2,t4=2-t2,1-t4') pol2 ,pic2 =poly4(t1,t2,t3,t4) #pic+=(polygon(pol2,fill=false,color='green')+line([pol2[0],pol2[2]])+line([pol2[1],pol2[3]])) pic+=pic2 #show(pic) show([t1,t2,t3,t4]) show(gtsidesangs(pol2)) return t1,t2,t3,t4 if trans=='RtO': #rotate 180 about origin print('Rotate 180 about origin: t1=2-t1') t1,t2,t3,t4=2-t1,t2,t3,1-t4 pol1,pic1=poly4(t1,t2,t3,t4) #pic+=(polygon(pol1,fill=false,color='turquoise')+line([pol1[0],pol1[2]])+line([pol1[1],pol1[3]])) pic+=pic1 show(pic) show([t1,t2,t3,t4]) show(gtsidesangs(pol1)) pol=pol3 return t1,t2,t3,t4 def showpols(pol,digs=3): if type(pol)==list: pol=gparms(pol) t1=pol[0];t2=pol[1];t3=pol[2];t4=pol[3] G=Graphics();parms=[];sidangs=[] pic1=poly4(t1,t2,t3,t4)[1]+text(mapnd([t1,t2,t3,t4],digs=digs),(0,1)) #original pic2=poly4(2-t1,2-t2,t3,t4)[1]+text(mapnd([2-t1,2-t2,t3,t4],digs=digs),(0,1)) #reflect about y-axis pic3=poly4(t1,2-t2,t3,1-t4 )[1]+text(mapnd([t1,2-t2,t3,1-t4],digs=digs),(0,1)) #reflect about x-axis pic4=poly4(2-t1,t2,t3,1-t4 )[1]+text(mapnd([2-t1,t2,t3,1-t4],digs=digs),(0,1)) #rotate 180 about (0,0) disp=graphics_array([[pic1,pic2],[pic3,pic4]]) show(disp,figsize=6) if t3>1-meps(10^5): t1,t2,t3,t4=2*t4,t2,1/t3,t1/2 pic1=poly4(t1,t2,t3,t4)[1]+text(mapnd([t1,t2,t3,t4],digs=digs),(0,1)) #original pic2=poly4(2-t1,2-t2,t3,t4)[1]+text(mapnd([2-t1,2-t2,t3,t4],digs=digs),(0,1)) #reflect about y-axis pic3=poly4(t1,2-t2,t3,1-t4 )[1]+text(mapnd([t1,2-t2,t3,1-t4 ],digs=digs),(0,1)) #reflect about x-axis pic4=poly4(2-t1,t2,t3,1-t4 )[1]+text(mapnd([2-t1,t2,t3,1-t4 ],digs=digs),(0,1)) #rotate 180 about (0,0) disp=graphics_array([[pic1,pic2],[pic3,pic4]]) show(disp,figsize=6)
def mapnd(parms,digs=3): return [Rational(p).n(digits=digs) for p in parms] mapnd([sqrt(2.)])
pol,pic=poly4(2/3,2/3,1,5/6) pol1,pic1=poly4(1/3,2/3,1,2/3) show(graphics_array([pic,pic1]),aspect_ratio=1,figsize=7)
def mapnd(parms,digs=3): if digs==0: return parms par=[] for p in parms: if type(p)==sage.rings.real_mpfr.RealNumber: par+=[Rational(p).n(digits=digs)] else: par+=[p.n(digits=digs)] return par
#showpols(mapv([(0,1),(1,2),(2,4),(-3,3)])) showpols((1/4,1/2,1,1/8))
def goodparms(t1,t2,t3,t4): if test_parms(t1,t2,t3,t4): return t1,t2,t3,t4 if test_parms(2-t1,2-t2,t3,t4): return 2-t1,2-t2,t3,t4 if test_parms(t1,2-t2,t3,1-t4): return t1,2-t2,t3,1-t4 if test_parms(2-t1,t2,t3,1-t4): return 2-t1,t2,t3,1-t4 if t3>1-meps(10^5): t1,t2,t3,t4=2*t4,t2,1/t3,t1/2 if test_parms(t1,t2,t3,t4): return t1,t2,t3,t4 if test_parms(2-t1,2-t2,t3,t4): return 2-t1,2-t2,t3,t4 if test_parms(t1,2-t2,t3,1-t4): return t1,2-t2,t3,1-t4 if test_parms(2-t1,t2,t3,1-t4): return 2-t1,t2,t3,1-t4
def test_parms(t1=.8,t2=1,t3=.91,t4=.5): if t4<=meps(10^5) or t4>=1-meps(10^5): return false if min(t1,t2,t3)<meps(10^5) or max(t1,t2,t3)>1+meps(10^5): return false if min(abs(t1-1),abs(t2-1))<meps(10^5) and t4>1/2-meps(10^5): return false if abs(t3-1)<meps(10^5) and (t4 > t1/2+meps(10^5) and t4<1-t1/2 ): return false return true test_parms()
load('~/Forgons/')
@interact(layout=dict(top=[['t1','t2','t3','t4'],['classify','quads']])) def _(t1=slider(default=1,vmin=0,vmax=1,step_size=1/100),t2=slider(default=1,vmin=0,vmax=1,step_size=1/100), t3=slider(default=1,vmin=0,vmax=1,step_size=1/100),t4=slider(default=1/2,vmin=0,vmax=1,step_size=1/100), quads=checkbox(default=false,label='Quadrisection(s)'),classify=checkbox(default=false,label='Classsify'),auto_update=false): global pol,D pol,pic=poly4(t1,t2,t3,t4) T1,T2,T3,T4=goodparms(t1,t2,t3,t4) pol1,pic1=poly4(T1,T2,T3,T4) Pic=Base+pic+pic1 sidsangs(pol1) show('parms: '[T1,T2,T3,T4]) show('sid') if quads and t2>10^(-12): D=dpoly(pol) Pic+=getquads2(D) if classify: tis=classify_quad([t1,t2,t3,t4]) print(tis) Pic.show(figsize=6,axes=false,aspect_ratio=1)
[(cos(i*2*pi.n()/5),sin(i*2*pi.n()/5)) for i in range(5)]
[(1.00000000000000, 0.000000000000000), (0.309016994374947, 0.951056516295154), (-0.809016994374947, 0.587785252292473), (-0.809016994374948, -0.587785252292473), (0.309016994374947, -0.951056516295154)]
poly4(1,1/2,1/2,1/2)[1]
show(poly4(3/4,1,1 ,1/4)[1],figsize=10,aspect_ratio=1)
load('~/Forgons/quadapps.sage')
A=matrix([(1439384,12200),(0,.00001)]) Ai=A.inverse().n(digits=6) b=vector([5,.02]) c=Ai*b A*c
(8.00000, 0.0200000)
np.linalg.cond(A)
143948740534.56198
A
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[30], line 1 ----> 1 cond(A) NameError: name 'cond' is not defined
def mypoly(pol,clr='grey',lbls=false): pol1=pol pic=polygon(pol1,color=clr,alpha=.1)+line(pol1+[pol1[0]],color='black')+line([pol1[0],pol1[2]],color='black',linestyle='dotted',axes=false) pic+=line([pol1[1],pol1[3]],color='black',linestyle='dotted')+point(pol1,color='black') X=intsct([pol1[1],pol1[3]],[pol1[0],pol1[2]]) M1=.5*(pol1[0]+pol1[2]);M2=.5*(pol1[1]+pol1[3]) pic+=point([X,M1,M2],color='black') if lbls: eps=.06;dl=.06 pic+=text("A",pol1[0]+offset(eps,0),color='black') pic+=text("C",pol1[2]+offset(-eps,0),color='black') pic+=text("B",pol1[1]+offset(0,dl),color='black') pic+=text("D",pol1[3]+offset(0,-dl),color='black') pic+=text("X",X+offset(-eps,dl),color='black') return pic
def gtsidesangs(pol): sids=[norm(pol[0]-pol[1]),norm(pol[2]-pol[1]),norm(pol[2]-pol[3]),norm(pol[0]-pol[3])] angs=[getang([pol[3],pol[0],pol[1]]),getang([ pol[0],pol[1],pol[2]]),getang([pol[1],pol[2],pol[3]]),getang([pol[2],pol[3],pol[0]])] return sids,angs
var('x1 y1 x2 y2 t s) A=vector([1,0]) B=vector([x1,y1]) D=vecttor([x2,y2]) P1=A+t*(A-B);P2=A+s*(A-D)
load('~/Forgons/quadapps.sage')
integrate(cos(ln(x))/x,x,1,2)
integrate(cos(x),x,0,log(2))
27*75
2025
def showpols3(parms,digs=3): t1=parms[0];t2=parms[1];t3=parms[2];t4=parms[3] G=Graphics();parms=[];sidangs=[] pic1=poly4(t1,t2,t3,t4)[1]+text([t1,t2,t3,t4],(0,1)) #original pic2=poly4(2-t1,2-t2,t3,t4)[1]+text([2-t1,2-t2,t3,t4],(0,1)) #reflect about y-axis pic3=poly4(t1,2-t2,t3,1-t4 )[1]+text([t1,2-t2,t3,1-t4],(0,1)) #reflect about x-axis pic4=poly4(2-t1,t2,t3,1-t4 )[1]+text([2-t1,t2,t3,1-t4],(0,1)) #rotate 180 about (0,0) disp=graphics_array([[pic1,pic2],[pic3,pic4]]) show(disp,figsize=6) if t3>1-meps(10^5): t1,t2,t3,t4=2*t4,t2,1/t3,t1/2 pic1=poly4(t1,t2,t3,t4)[1]+text([t1,t2,t3,t4],(0,1)) #original pic2=poly4(2-t1,2-t2,t3,t4)[1]+text([2-t1,2-t2,t3,t4],(0,1)) #reflect about y-axis pic3=poly4(t1,2-t2,t3,1-t4 )[1]+text([t1,2-t2,t3,1-t4],(0,1)) #reflect about x-axis pic4=poly4(2-t1,t2,t3,1-t4 )[1]+text([2-t1,t2,t3,1-t4],(0,1)) #rotate 180 about (0,0) disp=graphics_array([[pic1,pic2],[pic3,pic4]]) show(disp,figsize=6) def showpols2(parms): t1=parms[0];t2=parms[1];t3=parms[2];t4=parms[3] G=Graphics();parms=[];sidangs=[];pics=[] eps=.1 t1t4sqr=line([(0,0),(1,0),(1,1),(0,1),(1,1/2),(0,0)],color='black')+line([(0,0),(0,1),(0,1/2),(1,1/2)],color='grey') t1t4sqr+=text('t1',(1/2,-eps),color='black')+text('t4',(1+eps,1/23),color='black') pics+=[poly4(t1,t2,t3,t4)[1]+text([t1,t2,t3,t4],(0,1))] #original t1t4sqr+=point((t1,t4)) if 2-t1<=1 and 1-t4>0: pics+=[poly4(2-t1,t2,t3,1-t4 )[1]+text([2-t1,t2,t3,1-t4],(0,1))] #rotate 180 about (0,0) t1t4sqr+=point([(2-t1,1-t4)],color='red') if t3>1-meps(10^5): t1,t2,t3,t4=2*t4,t2,1/t3,t1/2 if t1<=1: pics+=[poly4(t1,t2,t3,t4)[1]+text([t1,t2,t3,t4],(0,1))] #original t1t4sqr+=point([( t1, t4)]) if 2-t1<=1 and 1-t4>0: pics+=[poly4(2-t1,t2,t3,1-t4 )[1]+text([2-t1,t2,t3,1-t4],(0,1))] #rotate 180 about (0,0) t1t4sqr+=point([(2-t1,1-t4)]) show(graphics_array(pics)) show(t1t4sqr,aspect_ratio=1) @interact(layout=dict(top=[['parameters']])) def _(parms=input_box((1/2,1,1,1/2),width=20),auto_update=false): showpols2(parms)
showpols3(( 6/28, 9/10, 1, 25/28))
gtsidesangs(poly4( 3/14,9/10,1,3/28)[0] )
gtsidesangs(poly4( 3/14,9/10,1,25/28)[0] )
var('x y z') eq = x^2 + y^2 + z^2 - 1 implicit_plot3d(eq, (x,-1,1), (y,-1,1), (z,-1,1), plot_points=10,mesh=true, boundary_offset=0.0,opacity=.4,color='yellow')
!hellno.sh ~/Forgons/stuff.ipynb !hellno.sh ~/sagelets/stuff.ipynb
show(pic,ymax=2.2,ymin=-2.5,xmin=-2,xmax=4)
def threed_setup(): var('t1 t2 t3 t4') C=Cube(names=['t4','t3','t1'],clrs=['grey','grey','grey']) pic=C.pic+point((1,1,1),viewpoint=[[-0.8,-0.3,-0.5],200]) g1=polygon3d([(0,0,0),(1,0,1/2),(1,1,1/2),(0,1,0)],color='yellow',transparency=.1) p=pi.n() cyc=1-sqrt(1-4*t3^2*t4*(1-t4)) #cyc=t3-1/2*sqrt((t1*(2-t1))/(1-t4)) a=sqrt(4*t3^2*t4^2*sin(1.57079632679490*t2)^2 + (2*t3*t4*cos(1.57079632679490*t2) - t1)^2) b=sqrt(4*t3^2*t4^2*sin(1.57079632679490*t2)^2 + (2*t3*t4*cos(1.57079632679490*t2) - t1 + 2)^2) c=sqrt(4*t3^2*(t4 - 1)^2*sin(1.57079632679490*t2)^2 + (2*t3*(t4 - 1)*cos(1.57079632679490*t2) - t1 + 2)^2) d=sqrt(4*t3^2*(t4 - 1)^2*sin(1.57079632679490*t2)^2 + (2*t3*(t4 - 1)*cos(1.57079632679490*t2) - t1)^2) tce=a+c-b-d extceB=a+d-c-b extceA=a+b-c-d pic3=pic+text3d('(1,1,1)',(1,1,1.04),color='black')+text3d('(0,0,0)',(0,0,-.04),color='black') pic3+=text3d('(1,0,0)',(1.04, .04,-.04),color='black')+text3d('(0,0,1)',(0,0,1.04),color='black')+text3d('(0,1,0)',(0, 1.04,-.04),color='black') return pic3,cyc,tce,extceA,extceB
pic3,cyc,tce,extceA,extceB=threed_setup() pic3,cyc,tce,extceA,extceB
prompt="""What do you look like?"""
print(prompt)
def levcurv(fun=x^2+y^2,x0=-1.,y0=0.,dt=.01, dist=.5, clr='black',grad=false,grid=100,t3d=false): """levcurv is used by patch, which used by full_patch: levcurv(fun=x^2+y^2,x0=-1,y0=0,dt=.01, dist=.5, clr='black',grad=false,grid=100) returns an approximate piece of the level curve of fun starting at (x0,y0) and moving in the direction of the gradient (rotated 90 degs counterclockwise) for an approximate distance dist by steps approximately dt units long. If dt is negative, it moves the opposite direction. If grad=true, it moves in the direction of the gradient (the direction of greatest ascent), and if also dt < 0, it moves in the direction of greatest descent. levcurv returns two lists of points: the first is the points along the curve; the second is a list of points on the curve approximately grid*dt units apart on the curve.""" steps=floor(dist/abs(dt)) if not type(fun)==list: f(x,y)=fun gradf=vector([derivative(f,x),derivative(f,y)]) else: f1(x,y)=fun[0];f2(x,y)=fun[1] gradf=vector([f1,f2]) if not grad: tanf=vector([-gradf[1],gradf[0]]) else: tanf=gradf p=[vector([x0,y0])] gpts=[p[0]] for i in range(steps): dst=0 while dst<abs(dt): lev=tanf(p[-1][0],p[-1][1]).n() d=min(1,1/norm(lev)) p+=[p[-1]+d*lev/norm(lev)*dt] dst+=abs(d*dt) if mod(i,grid)==0: gpts+=[p[-1]] if t3d: p=[[q[0],q[1],f(q[0],q[1])] for q in p] gpts=[[g[0],g[1],f(g[0],g[1])] for g in gpts] return p,gpts
var('x y') t1a=.5;t2a=.5; f=(extceA-cyc+t1a).subs(t1=t1a,t2=t2a) p,lev=levcurv(f.subs(t4=x,t3=y),0,0) #pic3+line([1],color='black') lev
var('x tth');sin(pi/2-tth).simplify_full()
t10=.4 strt=vector([0,0]) lev=[strt];msh=.01 f.subs(t4=lev[0][0],t3=lev[0][1])
r=.5 pol=mapv([(1,0),(r^2,2*r),(-r^2,2*r),(-1,0)]) cen,rad=circumcirc([pol[0],pol[1],pol[2]],pic=false);print(cen,rad) pic=polygon(pol,fill=false) parms=gparms(pol);print(parms) pol1,pic1=poly4(parms[0],parms[1],parms[2],parms[3]) pic+=circle((0,r),r)+circle(cen,rad) D=dpoly(pol) C=cpoly5(D) show(pic) show(pic1) showpols(pol)
pol1,pic1=poly4(1,.7,.5,1/2) D=getpoly(pol1) D.C.QAr
D.quad_pic+pic1 D.C.QAr
var('A B C s t x y') A=vector([1,0]);B=vector([x,y]);C=vector([-1,0]); s=(t*B*(A-B)-B*A)/((C-B)*(A+t*(B-A))) X=A+t*(t*(B-A));Y=B+s*(C-B) eqn=det(matrix([B,Y-X]))-1/2*det(matrix([B-A,C-A])) eqn solt=solve(eqn,t) solt1=solt[0].rhs() solt2=solt[1].rhs() solt1
help(poly4)
t3=.6; h0=t3;x0=.6;y0=h0*(1-x0);s0=1/(y0+x0/h0) x1=-s0*y0;y1=s0*x0 pol,pic=poly4(1,1,t3,.5) ep=.1 pic1=pic+text('(1,0)',(1+ep,0),color='black')+text('(0,h)',(0,h0+ep/2),color='black')+text('(-1,0)',(-1-ep,0),color='black',aspect_ratio=1) pic2=pic1+point((x0,y0),color='black')+text('(x,y)',(x0+ep,y0+ep/2),color='black')+line([(0,0),(x0,y0)],color='black',linestyle='dashed') pic3=pic2+point((x1,y1),color='black')+text('(-sy,sx)',(x1-ep,y1+ep/2),color='black')+line([(0,0),(x1,y1)],color='black',linestyle='dashed') pic4=pic3+point((-x0,-y0),color='black')+text('(-x,-y)',(-x0-ep,-y0-ep/2),color='black')+line([(0,0),(-x0,-y0)],color='black',linestyle='dashed') pic5=pic4+point((-x1,-y1),color='black')+text('( sy,-sx)',(-x1+ep,-y1-ep/2),color='black')+line([(0,0),(-x1,-y1)],color='black',linestyle='dashed') pic5+polygon([(0,0),(x0,y0),(0,h0),(x1,y1)],color='lightgrey')
t1=solt1.subs(x=pol[1][0],y=pol[1][1]).real().n() X1=X.subs(t=t1,x=pol[1][0],y=pol[1][1]) Y1=Y.subs(s=)
pic
pol=Roll(mapv([(-1, 0), (1, 0), (1/3, 61/40), (-1/3, 61/40)]),2) H=getpoly(pol)
parms=gparms(mapv(pol)) parms=[p.n() for p in parms] parms
H.quad_pic
#pol1,pic1=poly4(0.487394957983193, 0.909473351234499, 1.00000000000000, 0.243697478991597); pol1,pic1=poly4(0.48739, 0.90947, 1.00000000000000, 0.24369); G=getpoly(pol1) G.quad_pic.show()
G.quad_pic+point(G.D.alverts)+line([pol1[0]])
#kite var('x h') y=(1-x)*h;s=1/(x/h+y) A=(x+s*y)*h/2 pretty_print((h/2-A).numerator().collect(x)) pretty_print((h/2-A).denominator().collect(x)) #dA=derivative(A,x) #pretty_print(dA.numerator().collect(x)) #pretty_print(dA.denominator().collect(x))
#parallelogram var('x h a') y=(x-1)/(a-1)*h s=h/(h*y-x*(a+1)) A=det(matrix([[a,h],[-s*y-x,s*x-y]]))/2 pretty_print((A/h-1).numerator().collect(x)) solnx=solve(A-h/2,x) sol0=solnx[0].rhs();sol1=solnx[1].rhs() def f(a,h): if a^2+h^2<1: return rtsave.subs(a=a,h=h) return 0 rtsave=((sol0+sol1)/2).simplify_full() pretty_print(rtsave) dA=derivative(A,x)/h pretty_print(dA.numerator().collect(x))
plot3d(f,(a,0,1),(h,0,1))
pretty_print((solx[0]-a).numerator().collect(a)) pretty_print((solx[0]-a).denominator().collect(a))
eq=()
a0=.6;h0=.5 plot(A.subs(a==a0,h=h0)-h0,(x,.1,.9))
solnx[0].rhs().subs(a=.6,h=.5)
load('~/Forgons/quadapps.sage')
#pol1,pic1=poly4(0.48739, 0.90947, 1.00000000000000, 0.24369); #5 quadrisections #pol1,pic1=poly4(0.48739, 0.90947, 1.00000000000000, 0.24369); #3 quadrisections #pol,pic=poly4(.49,.89,1,.21) #3 quadrisections #pol,pic=poly4(.47,.89,1,.21) #3 quads 1 in each of 3 orthogonal traps #pol,pic=poly4(.434,.89,1,.217) #5 quadrisections #pol,pic=poly4(.43,.89,1,.215) #5 quadrisections #pol,pic=poly4(.42,.89,1,.21) #5 quadrisections #pol,pic=poly4(.4,.88,1,.2) #5 quadrisections (2/5,22/25,1,1/5) pol,pic=poly4(.4,.88,1,.2) T=getpoly(pol) T.C.QAr.show(figsize=4),(T.quad_pic+line([pol[1],pol[3]],linestyle='dotted',color='lightgrey')+T.C.trap[0].pic(0)).show(axes=true)
Tr=T.C.trap[0] (Tr.pic(.5)+T.D.pic).show(axes=false) plot(Tr.Ar1(t)+Tr.Ar2(t),(t,0,1),color='red')
da1=norm(Tr.T1.X(t)-Tr.Cn(t))*norm(Tr.T1.Y(t)-Tr.Cn(t)); da2=norm(Tr.T2.X(t)-Tr.Cn(t))*norm(Tr.T2.Y(t)-Tr.Cn(t)); plot(-da1(t=t)+da2(t=t),(0,1))
plot(Tr.DAr,(0,1))
((pic)+window(ep=.3,cen=Tr.Cn(.5))).show(axes=false)
T.C.QAr
var('t1 t2 t3 t4 T1 T4') A=vector([1,0]);C=vector([-1,0]);X=vector([T1,0]);V=vector([t2,sqrt(1-t2^2)]);B=X+2*t3*t4*V;D=X-2*t3*T4*V a =(B-A)*(B-A);a.simplify_full() a=4*(T1 - 1)*t2*t3*t4 + 4*t3^2*t4^2 + t1^2
var('x y r s');l=-1;u=1;ar=.6;r0=-1/2;s0=-1/2;ll=-.1;uu=.1 pic1=plot3d(x^3+y^3 +3*x*y, (x,l,u),(y,l,u),aspect_ratio=[1,1,ar],mesh=true)+polygon3d([(-2,-2,0),(2,-2,0),(2,2,0),(-2,2,0)],alpha=.2) tpl=r^3+s^3+3*r*s+3*(r^2+s)*(x-r)+3*(s^2+r)*(y-s) tq=tpl+3*(x-r)^2+(y-s)^2+(x-r)*(y-s) tpic=plot3d(tpl.subs(r=r0,s=s0),(x,r0+ll,r0+uu),(y,s0+ll,s0+uu),aspect_ratio=[1,1,ar],color='green') tqpic=plot3d(tq.subs(r=r0,s=s0),(x,r0+ll,r0+uu),(y,s0+ll,s0+uu),aspect_ratio=[1,1,ar],color='red') pic1+tpic+tqpic+point3d([(r0,s0,tpl.subs(x==0,y==0,r==r0,s==s0))],color='black',pointsize=100)
2^12
4096
x=((1+sqrt(5))/2)^12;x.expand()
72*sqrt(5) + 161
#ExtceAGraph=Graphics() #for i in range(6): # ExtceAGraph+=implicit_plot3d(extceA.subs(t2=i/5.+.002),(t4,.01,1),(t3,.001,1),(t1,.001,1),color='green',frame=false,alpha=2,mesh=true) #ExtceAGraph
ln(300.)/ln(3.)
5.19180654857877
1.+3.*log(5.)/log(3.) 1.+3*log(5.,3.)
5.39492056215378
var('y,h,k,a,b,x,x1,y1,z1,w1') eqn=(x-h)^2/a^2+(y-k)^2/b^2-1 eqn
(h - x)^2/a^2 + (k - y)^2/b^2 - 1
var('h,k,a2,b2,x,x1,y1,z1,w1') #h=0 #assume(y1>0,w1>0,a>0,b>=a) #assume(a2>0,b2>0) eqn=x^2/a2+(y-k)^2/b2-1 eq1=eqn.subs(x=1,y=0) eq2=eqn.subs(x=-1,y=0) eq3=eqn.subs(x=x1,y=y1) eq4=eqn.subs(x=z1,y=w1) sol=solve([eq2,eq3,eq4],[k,a2,b2]) sol
[[k == r97, a2 == 0, b2 == 0], [k == 1/2*(w1^2*x1^2 - y1^2*z1^2 - w1^2 + y1^2)/(w1*x1^2 - y1*z1^2 - w1 + y1), a2 == -1/4*(w1^4*x1^4 + y1^4*z1^4 - 2*w1^4*x1^2 + w1^4 - 4*w1*y1^3 + y1^4 - 2*(w1^2*x1^2 - 3*w1^2)*y1^2 + 2*(2*w1*y1^3 - y1^4 - (w1^2*x1^2 + w1^2)*y1^2)*z1^2 + 4*(w1^3*x1^2 - w1^3)*y1)/(w1*y1^3 + (w1^2*x1^2 - 2*w1^2)*y1^2 + (w1^2*y1^2 - w1*y1^3)*z1^2 - (w1^3*x1^2 - w1^3)*y1), b2 == 1/4*(w1^4*x1^4 + y1^4*z1^4 - 2*w1^4*x1^2 + w1^4 - 4*w1*y1^3 + y1^4 - 2*(w1^2*x1^2 - 3*w1^2)*y1^2 + 2*(2*w1*y1^3 - y1^4 - (w1^2*x1^2 + w1^2)*y1^2)*z1^2 + 4*(w1^3*x1^2 - w1^3)*y1)/(w1^2*x1^4 + y1^2*z1^4 - 2*w1^2*x1^2 - 2*((w1*x1^2 - w1)*y1 + y1^2)*z1^2 + w1^2 + 2*(w1*x1^2 - w1)*y1 + y1^2)]]
Eqn=eqn.subs(k=sol[1][0].rhs(),a2=sol[1][1].rhs(),b2=sol[1][2].rhs()) Eqn=Eqn.numerator().collect(x).collect(y)/4 Eqn
-w1^3*x1^2*y1 + w1^2*x1^2*y1^2 + w1^2*y1^2*z1^2 - w1*y1^3*z1^2 + w1^3*y1 - 2*w1^2*y1^2 + w1*y1^3 + (w1^3*x1^2*y1 - w1^2*x1^2*y1^2 - w1^2*y1^2*z1^2 + w1*y1^3*z1^2 - w1^3*y1 + 2*w1^2*y1^2 - w1*y1^3)*x^2 + (w1^2*x1^4 - 2*w1*x1^2*y1*z1^2 + y1^2*z1^4 - 2*w1^2*x1^2 + 2*w1*x1^2*y1 + 2*w1*y1*z1^2 - 2*y1^2*z1^2 + w1^2 - 2*w1*y1 + y1^2)*y^2 - (w1^3*x1^4 - w1^2*x1^2*y1*z1^2 - w1*x1^2*y1^2*z1^2 + y1^3*z1^4 - 2*w1^3*x1^2 + w1^2*x1^2*y1 + w1*x1^2*y1^2 + w1^2*y1*z1^2 + w1*y1^2*z1^2 - 2*y1^3*z1^2 + w1^3 - w1^2*y1 - w1*y1^2 + y1^3)*y
Eqn.show() Eqn.coefficient(y).factor()

−w13x12y1+w12x12y12+w12y12z12−w1y13z12+w13y1−2 w12y12+w1y13+(w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13)x2+(w12x14−2 w1x12y1z12+y12z14−2 w12x12+2 w1x12y1+2 w1y1z12−2 y12z12+w12−2 w1y1+y12)y2−(w13x14−w12x12y1z12−w1x12y12z12+y13z14−2 w13x12+w12x12y1+w1x12y12+w12y1z12+w1y12z12−2 y13z12+w13−w12y1−w1y12+y13)y\displaystyle -w_{1}^{3} x_{1}^{2} y_{1} + w_{1}^{2} x_{1}^{2} y_{1}^{2} + w_{1}^{2} y_{1}^{2} z_{1}^{2} - w_{1} y_{1}^{3} z_{1}^{2} + w_{1}^{3} y_{1} - 2 \, w_{1}^{2} y_{1}^{2} + w_{1} y_{1}^{3} + {\left(w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}\right)} x^{2} + {\left(w_{1}^{2} x_{1}^{4} - 2 \, w_{1} x_{1}^{2} y_{1} z_{1}^{2} + y_{1}^{2} z_{1}^{4} - 2 \, w_{1}^{2} x_{1}^{2} + 2 \, w_{1} x_{1}^{2} y_{1} + 2 \, w_{1} y_{1} z_{1}^{2} - 2 \, y_{1}^{2} z_{1}^{2} + w_{1}^{2} - 2 \, w_{1} y_{1} + y_{1}^{2}\right)} y^{2} - {\left(w_{1}^{3} x_{1}^{4} - w_{1}^{2} x_{1}^{2} y_{1} z_{1}^{2} - w_{1} x_{1}^{2} y_{1}^{2} z_{1}^{2} + y_{1}^{3} z_{1}^{4} - 2 \, w_{1}^{3} x_{1}^{2} + w_{1}^{2} x_{1}^{2} y_{1} + w_{1} x_{1}^{2} y_{1}^{2} + w_{1}^{2} y_{1} z_{1}^{2} + w_{1} y_{1}^{2} z_{1}^{2} - 2 \, y_{1}^{3} z_{1}^{2} + w_{1}^{3} - w_{1}^{2} y_{1} - w_{1} y_{1}^{2} + y_{1}^{3}\right)} y

-(w1^2*x1^2 - y1^2*z1^2 - w1^2 + y1^2)*(w1*x1^2 - y1*z1^2 - w1 + y1)
k=sol[1][0].rhs() a2=sol[1][1].rhs() b2=sol[1][2].rhs() #as2=a2.denominator().factor()/a2.numerator().factor() #bs2=b2.denominator().factor()/b2.numerator().factor() #ks=k.denominator().factor()/k.numerator().factor() ks=2*(w1*x1^2 - y1*z1^2 - w1 + y1)/(w1^2*x1^2 - y1^2*z1^2 - w1^2 + y1^2) as2=4*(w1*x1^2 - y1*z1^2 - w1 + y1)*(w1 - y1)*w1*y1/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1)) bs2=4*(w1*x1^2 - y1*z1^2 - w1 + y1)^2/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1)) show(ks,as2,bs2)

2 (w1x12−y1z12−w1+y1)w12x12−y12z12−w12+y124 (w1x12−y1z12−w1+y1)(w1−y1)w1y1(w1x1+y1z1+w1−y1)(w1x1+y1z1−w1+y1)(w1x1−y1z1+w1−y1)(w1x1−y1z1−w1+y1)4 (w1x12−y1z12−w1+y1)2(w1x1+y1z1+w1−y1)(w1x1+y1z1−w1+y1)(w1x1−y1z1+w1−y1)(w1x1−y1z1−w1+y1)\displaystyle \frac{2 \, {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)}}{w_{1}^{2} x_{1}^{2} - y_{1}^{2} z_{1}^{2} - w_{1}^{2} + y_{1}^{2}} \frac{4 \, {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)} {\left(w_{1} - y_{1}\right)} w_{1} y_{1}}{{\left(w_{1} x_{1} + y_{1} z_{1} + w_{1} - y_{1}\right)} {\left(w_{1} x_{1} + y_{1} z_{1} - w_{1} + y_{1}\right)} {\left(w_{1} x_{1} - y_{1} z_{1} + w_{1} - y_{1}\right)} {\left(w_{1} x_{1} - y_{1} z_{1} - w_{1} + y_{1}\right)}} \frac{4 \, {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)}^{2}}{{\left(w_{1} x_{1} + y_{1} z_{1} + w_{1} - y_{1}\right)} {\left(w_{1} x_{1} + y_{1} z_{1} - w_{1} + y_{1}\right)} {\left(w_{1} x_{1} - y_{1} z_{1} + w_{1} - y_{1}\right)} {\left(w_{1} x_{1} - y_{1} z_{1} - w_{1} + y_{1}\right)}}

$$k=\frac{2(w1 x1^2 - y1z1^2 - w1 + y1}{w1^2 x1^2 - y1^2*z1^2 - w1^2 + y1^2}$$ $$a=\frac{ 4*(w1*x1^2 - y1*z1^2 - w1 + y1)*(w1 - y1)*w1*y1}{(w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1)}$$ $$b={ 4*(w1*x1^2 - y1*z1^2 - w1 + y1)^2/((w1*x1 + y1*z1 + w1 - y1}{w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1))}$$
#b2.denominator().factor()/(a2.numerator().factor()) as2=4*(w1*x1^2 - y1*z1^2 - w1 + y1)*(w1 - y1)*w1*y1/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1))
(4*(w1*x1^2 - y1*z1^2 - w1 + y1)*(w1 - y1)*w1*y1)/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1))
4*(w1*x1^2 - y1*z1^2 - w1 + y1)*(w1 - y1)*w1*y1/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1))
help(Rot)
Help on function Rot in module __main__: Rot(Pol=[[0, 0], [1, 0], [1, 3]], cen=[0, 0], th=30, deg=True, dec=True) Rot(Pol=[[0,0],[1,0],[1,3]],cen=[0,0],th=30,deg=true) returns the rotation of Pol by th degrees about cen.
as2=(a2.denominator().factor())/(a2.numerator().factor()) bs=(b2.denominator().factor())/(b2.numerator().factor()) print(as2) bs
4*(w1*x1^2 - y1*z1^2 - w1 + y1)*(w1 - y1)*w1*y1/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1))
4*(w1*x1^2 - y1*z1^2 - w1 + y1)^2/((w1*x1 + y1*z1 + w1 - y1)*(w1*x1 + y1*z1 - w1 + y1)*(w1*x1 - y1*z1 + w1 - y1)*(w1*x1 - y1*z1 - w1 + y1))
var('x1 y1 x y z1 w1') EQ1=w1^2*x1^2*y - w1*x1^2*y^2 - w1^2*x^2*y1 + w1*x^2*y1^2 + y^2*y1*z1^2 - y*y1^2*z1^2 - w1^2*y + w1*y^2 + w1^2*y1 - y^2*y1 - w1*y1^2 + y*y1^2 EQ1=(EQ1.collect(y).collect(x)/(-w1^2*y1+w1*y1^2)).numerator().collect(y).collect(x) EQ1.show() A1=EQ1.coefficient(y^2);A1.show() B1=-EQ1.coefficient(y);B1.show() C1=EQ1.subs(x=0,y=0);C1.show() D1=B1^2-4*A1*C1;D1.show() Y1=(-B1+sqrt(D1))/(2*A1);show(Y1)

(w12y1−w1y12)x2+(w1x12−y1z12−w1+y1)y2−w12y1+w1y12−(w12x12−y12z12−w12+y12)y\displaystyle {\left(w_{1}^{2} y_{1} - w_{1} y_{1}^{2}\right)} x^{2} + {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)} y^{2} - w_{1}^{2} y_{1} + w_{1} y_{1}^{2} - {\left(w_{1}^{2} x_{1}^{2} - y_{1}^{2} z_{1}^{2} - w_{1}^{2} + y_{1}^{2}\right)} y

w1x12−y1z12−w1+y1\displaystyle w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}

w12x12−y12z12−w12+y12\displaystyle w_{1}^{2} x_{1}^{2} - y_{1}^{2} z_{1}^{2} - w_{1}^{2} + y_{1}^{2}

−w12y1+w1y12\displaystyle -w_{1}^{2} y_{1} + w_{1} y_{1}^{2}

(w12x12−y12z12−w12+y12)2+4 (w1x12−y1z12−w1+y1)(w12y1−w1y12)\displaystyle {\left(w_{1}^{2} x_{1}^{2} - y_{1}^{2} z_{1}^{2} - w_{1}^{2} + y_{1}^{2}\right)}^{2} + 4 \, {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)} {\left(w_{1}^{2} y_{1} - w_{1} y_{1}^{2}\right)}

−w12x12−y12z12−w12+y12−(w12x12−y12z12−w12+y12)2+4 (w1x12−y1z12−w1+y1)(w12y1−w1y12)2 (w1x12−y1z12−w1+y1)\displaystyle -\frac{w_{1}^{2} x_{1}^{2} - y_{1}^{2} z_{1}^{2} - w_{1}^{2} + y_{1}^{2} - \sqrt{{\left(w_{1}^{2} x_{1}^{2} - y_{1}^{2} z_{1}^{2} - w_{1}^{2} + y_{1}^{2}\right)}^{2} + 4 \, {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)} {\left(w_{1}^{2} y_{1} - w_{1} y_{1}^{2}\right)}}}{2 \, {\left(w_{1} x_{1}^{2} - y_{1} z_{1}^{2} - w_{1} + y_{1}\right)}}

var('a, b, c, d, e, k,f, g, x, y,x1,y1,z1,w1') eqn=a*x^2+b*y^2+c*x+d*y+e*x*y+f eqn=a*x^2+b*(y-k)^2-1 #eqn= x^2+b*(y-d)^2-1 #pol=poly4(.5,.9,1,.1)[0] pol=[(1,0),(x1,y1),(-1,0),(z1,w1)] eq1=eqn.subs(x=pol[0][0],y=pol[0][1]) eq2=eqn.subs(x=pol[1][0],y=pol[1][1]) eq3=eqn.subs(x=pol[2][0],y=pol[2][1]) eq4=eqn.subs(x=pol[3][0],y=pol[3][1]) sol=solve([eq1,eq2,eq3,eq4],[k,a,b]);print(len(sol));print(sol) k=sol[0][0].rhs();a=sol[0][1].rhs();b=sol[0][2].rhs() EQ1=eqn.subs(k=sol[0][0].rhs(),a=sol[0][1].rhs(),b=sol[0][2].rhs()) EQ1=w1^2*x1^2*y - w1*x1^2*y^2 - w1^2*x^2*y1 + w1*x^2*y1^2 + y^2*y1*z1^2 - y*y1^2*z1^2 - w1^2*y + w1*y^2 + w1^2*y1 - y^2*y1 - w1*y1^2 + y*y1^2 pol,pic=poly4(.8,.5,1,.3) x1=pol[1][0];y1=pol[1][1];z1=pol[3][0];w1=pol[3][1] EQ2=EQ1.subs(x1=x1,y1=y1,z1=z1,w1=w1) sol=solve(EQ2.subs(x=0),y) A1=vector([0,sol[0].rhs()]) A2=vector([0,sol[1].rhs()]) Cen=.5*(A1+A2) sol=solve(EQ2.subs(y=Cen[1]),x) B1=vector([sol[0].rhs(),Cen[1]]) B2=vector([sol[1].rhs(),Cen[1]]) wd=1.25;Pic2=pic+implicit_plot(EQ2,(-wd,wd),(-1.5,.8))+line([A1,A2],linestyle='dotted')+line([B1,B2],linestyle='dotted')+point([A1,B1,Cen,A2,B2]) show(Pic2,aspect_ratio=1,axes=false)
1 [ [k == 1/2*(w1^2*x1^2 - y1^2*z1^2 - w1^2 + y1^2)/(w1*x1^2 - y1*z1^2 - w1 + y1), a == -4*(w1*y1^3 + (w1^2*x1^2 - 2*w1^2)*y1^2 + (w1^2*y1^2 - w1*y1^3)*z1^2 - (w1^3*x1^2 - w1^3)*y1)/(w1^4*x1^4 + y1^4*z1^4 - 2*w1^4*x1^2 + w1^4 - 4*w1*y1^3 + y1^4 - 2*(w1^2*x1^2 - 3*w1^2)*y1^2 + 2*(2*w1*y1^3 - y1^4 - (w1^2*x1^2 + w1^2)*y1^2)*z1^2 + 4*(w1^3*x1^2 - w1^3)*y1), b == 4*(w1^2*x1^4 + y1^2*z1^4 - 2*w1^2*x1^2 - 2*((w1*x1^2 - w1)*y1 + y1^2)*z1^2 + w1^2 + 2*(w1*x1^2 - w1)*y1 + y1^2)/(w1^4*x1^4 + y1^4*z1^4 - 2*w1^4*x1^2 + w1^4 - 4*w1*y1^3 + y1^4 - 2*(w1^2*x1^2 - 3*w1^2)*y1^2 + 2*(2*w1*y1^3 - y1^4 - (w1^2*x1^2 + w1^2)*y1^2)*z1^2 + 4*(w1^3*x1^2 - w1^3)*y1)] ]
Image in a Jupyter notebookImage in a Jupyter notebook
def offset(Off=(.05,.05)): return vector(Off)
Pic3=Pic2+text("A",(1.05,0))+text("B",(pol[1]+offset((.05,.05))))+text("C",(-1.08,0))+text("D",pol[3]+offset((-.05,-.05)));#Pic3.show(axes=false) save(Pic3, 'Pic3.png')
EQ1.collect(y ).collect(x) soly=solve(EQ1.subs(x=0),y) A1=vector([0,soly[0].rhs()]) A2=vector([0,soly[1].rhs()]) Cen=(A1+A2)/2 solx=solve(EQ1.subs(y=Cen[1]),x) B1=vector([0,solx[0].rhs()]) B2=vector([0,solx[1].rhs()]) show(B2.simplify())

(0, 12 w14x14w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−2 w12x12y12z12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13+y14z14w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−2 w14x12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13+4 w13x12y1w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−2 w12x12y12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−2 w12y12z12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13+4 w1y13z12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−2 y14z12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13+w14w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−4 w13y1w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13+6 w12y12w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13−4 w1y13w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13+y14w13x12y1−w12x12y12−w12y12z12+w1y13z12−w13y1+2 w12y12−w1y13)\displaystyle \left(0,\,\frac{1}{2} \, \sqrt{\frac{w_{1}^{4} x_{1}^{4}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{2 \, w_{1}^{2} x_{1}^{2} y_{1}^{2} z_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} + \frac{y_{1}^{4} z_{1}^{4}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{2 \, w_{1}^{4} x_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} + \frac{4 \, w_{1}^{3} x_{1}^{2} y_{1}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{2 \, w_{1}^{2} x_{1}^{2} y_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{2 \, w_{1}^{2} y_{1}^{2} z_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} + \frac{4 \, w_{1} y_{1}^{3} z_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{2 \, y_{1}^{4} z_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} + \frac{w_{1}^{4}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{4 \, w_{1}^{3} y_{1}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} + \frac{6 \, w_{1}^{2} y_{1}^{2}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} - \frac{4 \, w_{1} y_{1}^{3}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}} + \frac{y_{1}^{4}}{w_{1}^{3} x_{1}^{2} y_{1} - w_{1}^{2} x_{1}^{2} y_{1}^{2} - w_{1}^{2} y_{1}^{2} z_{1}^{2} + w_{1} y_{1}^{3} z_{1}^{2} - w_{1}^{3} y_{1} + 2 \, w_{1}^{2} y_{1}^{2} - w_{1} y_{1}^{3}}}\right)

print(EQ1.collect(y).collect(x))
-(w1^2*y1 - w1*y1^2)*x^2 - (w1*x1^2 - y1*z1^2 - w1 + y1)*y^2 + w1^2*y1 - w1*y1^2 + (w1^2*x1^2 - y1^2*z1^2 - w1^2 + y1^2)*y
var('a, b, c, d, e, k,f, g, x, y,x1,y1,z1,w1') eqn=a*x^2+b*y^2+c*x+d*y+e*x*y+f eqn=x^2+b*y^2+1*y+g*x*y-1 #eqn= x^2+b*(y-d)^2-1 #pol=poly4(.5,.9,1,.1)[0] pol=[(1,0),(x1,y1),(-1,0),(z1,w1)] eq1=eqn.subs(x=pol[0][0],y=pol[0][1]) eq2=eqn.subs(x=pol[1][0],y=pol[1][1]) eq3=eqn.subs(x=pol[2][0],y=pol[2][1]) eq4=eqn.subs(x=pol[3][0],y=pol[3][1]) sol=solve([eq1,eq2,eq3,eq4],[b,g ]);print(len(sol));print(sol) EQ1=eqn.subs(b=sol[0][0].rhs(),g=sol[0][1].rhs()) show(EQ1) b1 = (w1*x1^2 + (g*w1*x1 - g*w1*z1 - z1^2 + 1)*y1 - w1)/(w1^2*y1 - w1*y1^2); d1 = -(g*w1^2*x1*y1 + w1^2*x1^2 - (g*w1*z1 + z1^2 - 1)*y1^2 - w1^2)/(w1^2*y1 - w1*y1^2) pol,pic=poly4(.6,.7,.8,.9) wd=2.5;Pic2=pic+implicit_plot(EQ1.subs(x1=pol[1][0],y1=pol[1][1],z1=pol[3][0],w1=pol[3][1]),(-wd,wd),(-wd,wd))
1 [ [b == (w1*x1^2*z1 - ((z1^2 + w1 - 1)*x1 - w1*z1)*y1 - w1*z1)/(w1^2*x1*y1 - w1*y1^2*z1), g == -(w1^2*x1^2 + w1^2*y1 - (z1^2 + w1 - 1)*y1^2 - w1^2)/(w1^2*x1*y1 - w1*y1^2*z1)] ]

x2−(w12x12+w12y1−(z12+w1−1)y12−w12)xyw12x1y1−w1y12z1+(w1x12z1−((z12+w1−1)x1−w1z1)y1−w1z1)y2w12x1y1−w1y12z1+y−1\displaystyle x^{2} - \frac{{\left(w_{1}^{2} x_{1}^{2} + w_{1}^{2} y_{1} - {\left(z_{1}^{2} + w_{1} - 1\right)} y_{1}^{2} - w_{1}^{2}\right)} x y}{w_{1}^{2} x_{1} y_{1} - w_{1} y_{1}^{2} z_{1}} + \frac{{\left(w_{1} x_{1}^{2} z_{1} - {\left({\left(z_{1}^{2} + w_{1} - 1\right)} x_{1} - w_{1} z_{1}\right)} y_{1} - w_{1} z_{1}\right)} y^{2}}{w_{1}^{2} x_{1} y_{1} - w_{1} y_{1}^{2} z_{1}} + y - 1

b1
Pic2.show(axes=true)
Image in a Jupyter notebook
var('h,k,a2,b2,x,x1,y1,z1,w1') Pol=poly4(.5,.1,1,.1)[0] #Pol=Rot(pol,(0,0),20);print(Pol) #x1,y1,z1,w1=pol[1][0],pol[1][1],pol[3][0],pol[3][1] #pol=[(1,0),(x1,y1),(-1,0),(z1,w1)] eqn=x^2/a2+(y-k)^2/b2-1 eq1=eqn.subs(x=Pol[0][0],y=Pol[0][1]) eq2=eqn.subs(x=Pol[1][0],y=Pol[1][1]) eq3=eqn.subs(x=Pol[2][0],y=Pol[2][1]) eq4=eqn.subs(x=Pol[3][0],y=Pol[3][1]) sol=solve([eq1,eq3,eq4],[k,a2,b2]);print(len(sol));show(sol) j=1 ksol =sol[j][0].rhs().n() ; a2sol = sol[j][1].rhs().n(); b2sol = sol[j][2].rhs().n() c=sqrt(abs(a2sol-b2sol)) if a2sol -b2sol >= 0: F1=vector([c,ksol]);F2=vector([-c,ksol]) else: F1=vector([0,c+ksol]);F2=vector([0,ksol-c]) cen=vector([0,ksol]) Eqn2=eqn.subs(k =sol[j][0].rhs().n(), a2 = sol[j][1].rhs().n(), b2 = sol[j][2].rhs().n()) show(Eqn2) pic=polygon(pol,fill=false)+point(pol)+implicit_plot(Eqn2,(-2.1,2.1),(-1.1,2.6),figsize=5,color='red',aspect_ratio=1)+point([cen,F1,F2]) pic
[(0.939692620785908, 0.342020143325669), (0.644770251820833, 0.267971995712102), (-0.939692620785908, -0.342020143325669), (-1.10446916245796, -0.701647244780572)] 2

[[k=r66,a2=0,b2=0],[k=0,a2=(8956753102201973110642904136180582791281373231151188606729446985558295821676365277620123890),b2=(−80610777919817757995786137225625245121532359079297905218000288917006669051121867039586720000)]]\displaystyle \left[\left[k = r_{66}, a_{2} = 0, b_{2} = 0\right], \left[k = 0, a_{2} = \left(\frac{895675310220197311064290413618058279128137323}{1151188606729446985558295821676365277620123890}\right), b_{2} = \left(-\frac{8061077791981775799578613722562524512153235907}{9297905218000288917006669051121867039586720000}\right)\right]\right]

1.28527446675563 x2−1.15343201714897 y2−1\displaystyle 1.28527446675563 \, x^{2} - 1.15343201714897 \, y^{2} - 1

Image in a Jupyter notebook
var('h,k,a2,b2,x,x1,y1,z1,w1') pol,pic=poly4(.5,.9,1,.6) x1,y1,z1,w1=pol[1][0],pol[1][1],pol[3][0],pol[3][1] #x1,y1,z1,w1=3/4,sqrt(1-4/16),-3/4,-sqrt(1-4/16) #pol=[(1,0),(x1,y1),(-1,0),(z1,w1)] eqn=x^2/a2+(y-k)^2/b2-1 eq1=eqn.subs(x=1,y=0) eq2=eqn.subs(x=-1,y=0) eq3=eqn.subs(x=x1,y=y1) eq4=eqn.subs(x=z1,y=w1) sol=solve([eq2,eq3,eq4],[k,a2,b2]);print(len(sol));show(sol) j=1 ksol =sol[j][0].rhs().n() ; a2sol = sol[j][1].rhs().n(); b2sol = sol[j][2].rhs().n() c=sqrt(abs(a2sol-b2sol)) if a2sol -b2sol >= 0: F1=vector([c,ksol]);F2=vector([-c,ksol]) else: F1=vector([0,c+ksol]);F2=vector([0,ksol-c]) cen=vector([0,ksol]) Eqn2=eqn.subs(k =sol[j][0].rhs().n(), a2 = sol[j][1].rhs().n(), b2 = sol[j][2].rhs().n()) show(Eqn2) pic=polygon(pol,fill=false)+point(pol)+implicit_plot(Eqn2,(-2.1,2.1),(-1.1,2.6),figsize=5,color='red',aspect_ratio=1)+point([cen,F1,F2]) pic+Pic+Pic2
2

[[k=r87,a2=0,b2=0],[k=(111142505458509796066655363200756838291748171074),a2=(10938370010759345199505662634979611019758370227233636876860548687520),b2=(2026644242432883046481881344983714818119691522514657198863100881119036049257289261002663368164)]]\displaystyle \left[\left[k = r_{87}, a_{2} = 0, b_{2} = 0\right], \left[k = \left(\frac{111142505458509796066655}{363200756838291748171074}\right), a_{2} = \left(\frac{1093837001075934519950566263497961}{1019758370227233636876860548687520}\right), b_{2} = \left(\frac{20266442424328830464818813449837148181196915225}{14657198863100881119036049257289261002663368164}\right)\right]\right]

0.932276353080181 x2+0.723225051354137 (y−0.306008463269789)2−1\displaystyle 0.932276353080181 \, x^{2} + 0.723225051354137 \, {\left(y - 0.306008463269789\right)}^{2} - 1

Image in a Jupyter notebook
simple_nonconvex=poly4(-.5,1,1,.5,labels=true,model=false)[1] save(simple_nonconvex,'images/simple_nonconvex.png')
poly4(-.5,1,1,.5,labels=true,model=false)[1]
Image in a Jupyter notebook

The code below was generated by GPT-3.5 using this prompt:

save a diagram in the png format to my directory