2020-08-27 20:34:30 -0600 received badge ● Famous Question (source) 2020-08-18 00:50:59 -0600 received badge ● Famous Question (source) 2020-03-30 07:50:22 -0600 received badge ● Popular Question (source) 2020-03-08 16:48:38 -0600 received badge ● Notable Question (source) 2020-02-16 11:21:07 -0600 received badge ● Notable Question (source) 2020-02-16 11:21:07 -0600 received badge ● Popular Question (source) 2019-12-25 08:28:10 -0600 received badge ● Notable Question (source) 2019-05-24 15:01:04 -0600 received badge ● Popular Question (source) 2019-04-08 05:12:00 -0600 received badge ● Popular Question (source) 2019-02-09 02:49:13 -0600 received badge ● Notable Question (source) 2018-12-01 23:14:03 -0600 received badge ● Popular Question (source) 2018-11-10 06:50:15 -0600 received badge ● Famous Question (source) 2018-09-26 16:03:52 -0600 received badge ● Notable Question (source) 2018-09-15 16:50:41 -0600 asked a question How to load local PARI/GP script in Sage notebook? I have a PARI/GP script which I want to load and run locally on my laptop inside a Sage notebook. I tried to open a new notebook in the same directory where my script is located, and run this: %default_mode gp  But, it throws the following error: UsageError: Line magic function '%default_mode not found. Please note that I'm using Sage 8.3. How can I run a PARI/GP script locally? 2018-07-19 09:00:11 -0600 received badge ● Popular Question (source) 2018-05-31 05:21:12 -0600 received badge ● Popular Question (source) 2018-03-05 11:41:24 -0600 commented question How to plot similarity of two data sets in Sage? @j.c. Yes, expected and simulated correspond to the values in the y-axis, and there are some integer values that are input to the simulation and theoretical calculations that is used to populate the x-axis. What I mean the values double is that you can see in the examples, the values for both expected and simulated are quite close to each other, but every value keeps doubling, so it was 48, then 96, then 191, then 383, then 767, and so on. And the values on the x-axis also increase exponentially, so you can guess that all these smaller values correspond to smaller values of x, as the values of x increase exponentially, so on the right size we will have a point or to on the top right corner, and all the other points on the lower left corner. 2018-03-05 09:35:11 -0600 asked a question How to plot similarity of two data sets in Sage? I'm performing some simulations, and at the end I have a CSV file with three columns. One column holds the values for the x-axis, which was also input to the simulation and theoretical calculations, second one holds theoretically expected values, and the other column holds the values obtained by the simulation. I was planning to plot something like this: But that does not look good in my case, as the values in y-axis normally double, and the values for the x-axis exponentially increase, so most of the points end up getting collected at the lower left part, near the intersection of x-axis and y-axis of the plot. Therefore, I need a different way to plot such data, which will be more visually appealing and inform how close the simulation results are to the theoretical expected ones. For example, some of my values can be seen below: x = [2, 4, 8, 16, 32, 64] # partially removed for brevity expected = [47.9995, 95.9783, 191.9127, 383.9708, 767.8831] # partially removed for brevity simulated = [48, 96, 191.8, 383.8, 767.4] # partially removed for brevity  What is a good way to plot such a data that doubles in the y-axis and exponentially increases on the x-axis all the time, and to view how similar the two datasets actually are? 2018-03-04 10:28:19 -0600 asked a question How to specify x and y axis values in Sage plot? So, I have three lists in Sage, and I want to combine two list plots, where in one of them I have the expected values, and in the other one I have the simulation results, and the third one is the x-axis values that corresponds to these points. So my lists (all same size), look like this: # all lists removed partially for brevity expected = [47.4246, 47.9955, 95.9383] simulated = [47.2, 48, 96] primes = [23327, 3009311, 886463] # plotting p = list_plot(expected, color='blue', marker='o') + list_plot(simulated, color='red', marker='x') p.save('plot.svg')  Now, this creates a plot, and the y-axis corresponds to the values in expected and simulated lists, but I do not know how to incorporate the values in primes to the x-axis. So that I have 47.4246 for expected and 47.2 for simulated in the y-axis when I have 23327 in x-axis, and so on. Any ideas how to do this in Sage? 2018-03-04 07:44:33 -0600 commented question Getting all non-backtracking walks of certain length in isogeny graph @David Coudert Well, as you may know for every isogeny $\phi : E_0 \to E_1$ there is also a dual isogeny $\hat{\phi} : E_1 \to E_0$, so I basically do not want to walk back in the graph, therefore, inside the walk function there is a line that starts with if (j_child != prev_j), it basically makes sure that we do not walk back. 2018-03-04 07:42:10 -0600 commented answer Removing files in Sage shell using pattern matching Thanks, this seems to work nicely! 2018-03-03 16:29:45 -0600 asked a question Removing files in Sage shell using pattern matching I have a Sage project with includes some files ending in .sage and some ending in .py. So, I have also created a Makefile to preparse the Sage files, and inside my Makefile I have a clean command, which I want to delete all the files generated after the build process, but keep my own .py files. Therefore, I wrote something like this inside my Makefile: clean: shopt -s extglob; rm !(logger.py|utils.py|*.sage)  So, simply, when someone calls make clean I want it to delete all the .py and .pyc files generated after the make process, but keep the two .py files that are written by myself, and also keep all the Sage files. The problem is that it executes the first statement is executed successfully and it activates extended pattern matching. But then, the second state fails at (, it says that it got an unexpected character. To my knowledge, once the extended pattern matching is activated the above shown remove command should work. Any ideas what the problem might be and how to achieve what I want? 2018-03-03 08:20:50 -0600 asked a question Getting all non-backtracking walks of certain length in isogeny graph I want to calculate all non-backtracking walks of certain length in a supersingular isogeny graph using Sage. Currently, I have a code segment that looks like this: proof.arithmetic(False) # Paramters defining the prime p = f*lA^eA*lB^eB - 1 f = 7 #1 lA = 2 lB = 3 eA = 10 #372 eB = 6 #239 # Define the prime p p = lA**eA * lB**eB * f - 1 assert p.is_prime() # Prime field of order p Fp = GF(p) R. = PolynomialRing(Fp) # The quadratic extension via x^2 + 1 since p = 3 mod 4 Fp2. = Fp.extension(x^2 + 1) # E0 is the starting curve E0/Fp2: y^2 = x^3 + x (the A = 0 Montgomery curve) E_0 = EllipticCurve(Fp2, [1, 0]) assert E_0.is_supersingular() l = [lA, lB] e = [eA, eB] def walk(E_i, j, lvl, prev_j, max_lvl, end_nodes, m): children = {} if lvl < max_lvl: for P in E_i(0).division_points(m): # Only treat one point of each non-trivial cyclic subgroup of E_i[3]. if (m == 2 and P == E_i(0)) or (m == 3 and (P == E_i(0) or str(P + P) < str(P))): continue psi = E_i.isogeny(P) E_child = psi.codomain() j_child = str(E_child.j_invariant()) lvl_child = lvl + 1 if j_child in children: children[j_child] += 1 else: children[j_child] = 1 # We only walk to codomain of dual isogeny if there are # other isogenies than the dual isogeny that lead there. if (j_child != prev_j) or (m == 2 and children[j_child] > 1) or (m == 3 and children[j_child] > 2): walk(E_child, j_child, lvl_child, j, max_lvl, end_nodes, m) else: if j in end_nodes: end_nodes[j] += 1 else: end_nodes[j] = 1 def simulate(name): idx = None end_nodes = {} j_inv = str(E_0.j_invariant()) if name == "Alice": idx = 0 walk(E, j_inv, 0, "", e[idx], end_nodes, l[idx]) elif name == "Bob": idx = 1 walk(E, j_inv, 0, "", e[idx], end_nodes, l[idx]) return len(end_nodes) alice_nodes = simulate("Alice") print "Alice end nodes: %s" % str(alice_nodes)  We know that there are $(\ell_A + 1)\ell_A^{e_A - 1}$ non-backtracking walks, so for the above values of lA = 2 and eA = 10, we have about 1536 such walks, and the above code can handle it efficiently. The problem is if I change the values to something bigger, like the ones that I have commented out (f = 1, eA = 372, and eB = 239), suddenly it does not finish executing. How can I find more efficiently in Sage all walks in an isogeny graph of given length? 2018-03-03 05:10:30 -0600 asked a question Is it possible to speed up loop iteration in Sage? I have a sage code that looks like this:  uni = {} end = (l[idx]^(e[idx] - 1)) * (l[idx] + 1) # where end in my case is about 2013265922 but can also be much larger for count in range(0, end): i = randint(1, 303325737249669131) if i in uni: uni[i] += 1 else: uni[i] = 1 ` So basically, I want to create very large number of random integers in the given range, check whether the number was already in the dictionary, if yes increment its count, if not initialize it to 1. But, this takes such a long time that it doesn't finish in a reasonable time. Is there any way to speed up this kind of loops in Sage (or Python)?