def EC_nf_plot(E,base_field_gen_name): K = E.base_field() n1 = K.signature()[0] if n1 == 0: return plot([]) prec = 53 maxprec = 10**6 while prec < maxprec: # Try to base change to R. May fail if resulting curve is almost singular, so increase precision. try: SR = K.embeddings(RealField(prec)) X = [E.base_extend(s) for s in SR] break except ArithmeticError: prec *= 2 if prec >= maxprec: return text("Unable to plot",(1,1),fontsize="xx-large") X = [e.plot() for e in X] xmin = min([x.xmin() for x in X]) xmax = max([x.xmax() for x in X]) ymin = min([x.ymin() for x in X]) ymax = max([x.ymax() for x in X]) cols = ["blue","red","green","orange","brown"] # Preset colours, because rainbow tends to return too pale ones if n1 > len(cols): cols = rainbow(n1) return sum([EC_R_plot([SR[i](a) for a in E.ainvs()],xmin,xmax,ymin,ymax,cols[i],"$"+base_field_gen_name+" \mapsto$ "+str(SR[i].im_gens()[0].n(20))) for i in range(n1)])
def EC_nf_plot(K, ainvs, base_field_gen_name): try: n1 = K.signature()[0] if n1 == 0: return plot([]) R=[] S=K.embeddings(RDF) for s in S: A=[s(c) for c in ainvs] R.append(EC_R_plot_zone(Rx([A[4],A[3],A[1],1]),Rx([A[2],A[0]]))) xmin = min([r[0] for r in R]) xmax = max([r[1] for r in R]) ymin = min([r[2] for r in R]) ymax = max([r[3] for r in R]) cols = rainbow(n1) # Default choice of n colours # However, these tend to be too pale, so we preset them for small values of n if n1==1: cols=["blue"] elif n1==2: cols=["red","blue"] elif n1==3: cols=["red","limegreen","blue"] elif n1==4: cols = ["red", "orange", "forestgreen", "blue"] elif n1==5: cols = ["red", "orange", "forestgreen", "blue", "darkviolet"] elif n1==6: cols = ["red", "darkorange", "gold", "forestgreen", "blue", "darkviolet"] elif n1==7: cols = ["red", "darkorange", "gold", "forestgreen", "blue", "darkviolet", "fuchsia"] return sum([EC_R_plot([S[i](c) for c in ainvs], xmin, xmax, ymin, ymax, cols[i], "$" + base_field_gen_name + " \mapsto$ " + str(S[i].im_gens()[0].n(20))+"$\dots$") for i in range(n1)]) except: return text("Unable to plot", (1, 1), fontsize=36)
def EC_nf_plot(E, base_field_gen_name): K = E.base_field() n1 = K.signature()[0] if n1 == 0: return plot([]) prec = 53 maxprec = 10 ** 6 while prec < maxprec: # Try to base change to R. May fail if resulting curve is almost singular, so increase precision. try: SR = K.embeddings(RealField(prec)) X = [E.base_extend(s) for s in SR] break except ArithmeticError: prec *= 2 if prec >= maxprec: return text("Unable to plot", (1, 1), fontsize="xx-large") X = [e.plot() for e in X] xmin = min([x.xmin() for x in X]) xmax = max([x.xmax() for x in X]) ymin = min([x.ymin() for x in X]) ymax = max([x.ymax() for x in X]) cols = ["blue", "red", "green", "orange", "brown"] # Preset colours, because rainbow tends to return too pale ones if n1 > len(cols): cols = rainbow(n1) return sum([EC_R_plot([SR[i](a) for a in E.ainvs()], xmin, xmax, ymin, ymax, cols[i], "$" + base_field_gen_name + " \mapsto$ " + str(SR[i].im_gens()[0].n(20))) for i in range(n1)])
def EC_nf_plot(E,base_field_gen_name): K = E.base_field() SR = K.embeddings(RR) n1 = len(SR) if n1 == 0: return plot([]) X = [E.base_extend(s).plot() for s in SR] xmin = min([x.xmin() for x in X]) xmax = max([x.xmax() for x in X]) ymin = min([x.ymin() for x in X]) ymax = max([x.ymax() for x in X]) cols = rainbow(n1) return sum([EC_R_plot([SR[i](a) for a in E.ainvs()],xmin,xmax,ymin,ymax,cols[i],"$"+base_field_gen_name+" \mapsto$ "+str(SR[i].im_gens()[0].n(20))) for i in range(n1)])
def EC_nf_plot(E, base_field_gen_name): K = E.base_field() SR = K.embeddings(RR) n1 = len(SR) if n1 == 0: return plot([]) X = [E.base_extend(s).plot() for s in SR] xmin = min([x.xmin() for x in X]) xmax = max([x.xmax() for x in X]) ymin = min([x.ymin() for x in X]) ymax = max([x.ymax() for x in X]) cols = rainbow(n1) return sum([ EC_R_plot([SR[i](a) for a in E.ainvs()], xmin, xmax, ymin, ymax, cols[i], "$" + base_field_gen_name + " \mapsto$ " + str(SR[i].im_gens()[0].n(20))) for i in range(n1) ])
def EC_nf_plot(E, base_field_gen_name): K = E.base_field() n1 = K.signature()[0] if n1 == 0: return plot([]) prec = 53 maxprec = 10 ** 6 while prec < maxprec: # Try to base change to RR. May fail if resulting curve is almost singular, so increase precision. try: SR = K.embeddings(RealField(prec)) X = [E.base_extend(s) for s in SR] break except ArithmeticError: prec *= 2 if prec >= maxprec: return text("Unable to plot", (1, 1), fontsize=36) try: X = [e.plot() for e in X] except: return text("Unable to plot", (1, 1), fontsize=36) xmin = min([x.xmin() for x in X]) xmax = max([x.xmax() for x in X]) ymin = min([x.ymin() for x in X]) ymax = max([x.ymax() for x in X]) cols = rainbow(n1) # Default choice of n colours # Howver, these tend to be too pale, so we preset them for small values of n if n1==1: cols=["blue"] elif n1==2: cols=["red","blue"] elif n1==3: cols=["red","limegreen","blue"] elif n1==4: cols = ["red", "orange", "forestgreen", "blue"] elif n1==5: cols = ["red", "orange", "forestgreen", "blue", "darkviolet"] elif n1==6: cols = ["red", "darkorange", "gold", "forestgreen", "blue", "darkviolet"] elif n1==7: cols = ["red", "darkorange", "gold", "forestgreen", "blue", "darkviolet", "fuchsia"] return sum([EC_R_plot([SR[i](a) for a in E.ainvs()], xmin, xmax, ymin, ymax, cols[i], "$" + base_field_gen_name + " \mapsto$ " + str(SR[i].im_gens()[0].n(20))+"$\dots$") for i in range(n1)])
def EC_nf_plot(E, base_field_gen_name): K = E.base_field() n1 = K.signature()[0] if n1 == 0: return plot([]) prec = 53 maxprec = 10 ** 6 while prec < maxprec: # Try to base change to RR. May fail if resulting curve is almost singular, so increase precision. try: SR = K.embeddings(RealField(prec)) X = [E.base_extend(s) for s in SR] break except ArithmeticError: prec *= 2 if prec >= maxprec: return text("Unable to plot", (1, 1), fontsize="xx-large") X = [e.plot() for e in X] xmin = min([x.xmin() for x in X]) xmax = max([x.xmax() for x in X]) ymin = min([x.ymin() for x in X]) ymax = max([x.ymax() for x in X]) cols = rainbow(n1) # Default choice of n colours # Howver, these tend to be too pale, so we preset them for small values of n if n1==1: cols=["blue"] elif n1==2: cols=["red","blue"] elif n1==3: cols=["red","limegreen","blue"] elif n1==4: cols = ["red", "orange", "forestgreen", "blue"] elif n1==5: cols = ["red", "orange", "forestgreen", "blue", "darkviolet"] elif n1==6: cols = ["red", "darkorange", "gold", "forestgreen", "blue", "darkviolet"] elif n1==7: cols = ["red", "darkorange", "gold", "forestgreen", "blue", "darkviolet", "fuchsia"] return sum([EC_R_plot([SR[i](a) for a in E.ainvs()], xmin, xmax, ymin, ymax, cols[i], "$" + base_field_gen_name + " \mapsto$ " + str(SR[i].im_gens()[0].n(20))+"$\dots$") for i in range(n1)])