ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 25 Sep 2018 18:05:43 -0500Calculating the order of an Elliptic Curve fails.https://ask.sagemath.org/question/43765/calculating-the-order-of-an-elliptic-curve-fails/Hi. I would like to calculate the order of the base point on an Elliptic Curve. Some curves are successful while some fail.
Here are two examples and their parameters. The first example is successful, the second is not.
Example 1.
p = 10562920556476600174223203553624763158759224241690200395609486946570543757980521851146458516500451409335864053457189473296570712977858859585999979839497081
a = 1
b = 0
E = EllipticCurve(GF(p), [a, b])
Gx = 7001153264502603531568809091006890066238093206490706740054133060198019760090859987689015805782317128823647585142349315457499198272662472818714043462452903
Gy = 5379780378477219053711555876878459214243674711784518156355184015695786277532464885846858297098947964642836892714492422913471742703229817151186461774623684
G = E(Gx, Gy)
Q = G.order()
Q = 5532044755580494717
Example 2.
p = 8245498483844445086274997696534494324318871629323439587180432555305925857658196874670618312457436840885370130522487176480691396150486059031119600012524801
a = 1
b = 0
E = EllipticCurve(GF(p), [a, b])
Gx = 7273571546843413099993191994471155206649636421268389195048812757571665656628711965470673099293494650775090608549703675296316887753017258939382696588767431
Gy = 3529068830277582088596828423990199939817342479929127252014627303069162247307070606247527579307935679046819531543049464667736359244475241042487530444236684
G = E(Gx, Gy)
Q = G.order()
*** Warning: MPQS: number too big to be factored with MPQS,
giving up.
both these two curves are working curves. but why does sage fail to calculate the second curves order of G? Is it a limitation of sage itself? Is there any other way to calculate the order without using MPQS method?pottzmanTue, 25 Sep 2018 18:05:43 -0500https://ask.sagemath.org/question/43765/Class to which an element belong in a quotient ringhttps://ask.sagemath.org/question/39013/class-to-which-an-element-belong-in-a-quotient-ring/Fellow Sages:
I wish to determine whether certain elements of the quotient ring $Q:=\mathbb{F}_{2}[x]/\langle (x^{5}-1)^2\rangle$ are units and, in the case they are indeed units, I would also like to compute their multiplicative orders. How can one go about doing this?
In case you consider that my previous questions is a wee bit too broad, I have a related question which is more specific: if $p(x) \in \mathbb{F}_{2}[x]$ and $k \in \mathbb{N}$, how does one even determine a representative of the class (in the quotient ring $Q$) to which $(p(x))^{k}$ belongs? The naïve approach does not seem to work here: in my viewpoint, the code
> F = GF(2)
>
> R.<x> = PolynomialRing(F)
>
> S.<a> = R.quo((x^5-1)^2)
>
> b=x^5-1
>
> b^2;
SHOULD output [0] because the image of $(x^{5}-1)^2$ under the natural projection $\mathbb{F}_{2}[x] \to Q$ is exactly equal to the zero element of the quotient ring $Q$, but it does not yield that (it outputs the polynomial $x^{10}+1$, duh!). Do you know how it is that I am supposed to modify it in order to get the class in $Q$ to which the power in question belongs?
Thanks in advance for your insightful replies!FordoSat, 30 Sep 2017 19:47:36 -0500https://ask.sagemath.org/question/39013/Taylor Series With Order (Big O)https://ask.sagemath.org/question/36665/taylor-series-with-order-big-o/ I'm trying to replicate some Mathematica code, and I know very little about Mathematica and Sage.
The Mathematica code creates a Taylor series for f(x) about (x0), with degree 5. I was able to replicate that.
x, x0, dt = var('x, x0, dt')
f = function('f')
t = f(x).taylor(x, x0, 5)
Next it does a substitution.
k1 = f(x0)*dt
s = x0 + k1/2
k2 = t.subs(x=s)
The problem is it that it then removes the higher order terms using the big O notation.
k2 = Expand[g[x] \[CapitalDelta]t /. x -> s] + O[\[CapitalDelta]t]^5
It looks like this is available for series and polynomial rings (no clue what those are) in SageMath, but I haven't figured out how to apply it to the Taylor series expansion.
Is there a way to truncate certain order terms off of an expression?
Is there a way to replicate the Taylor series expression I want with `.series()` or polynomial rings?
I tried importing `sage.rings.big_oh` and using `Order()` but neither seemed applicable to the expression I had. I also made half an attempt to recreate a Taylor series with `.series()` but didn't quite get what I was hoping for.
tq = 1/factorial(n)*f(x)*x^n
tq.series(n, 5)
Thanks for the help, both my math and SageMath skills are lacking.douggardSun, 19 Feb 2017 16:56:02 -0600https://ask.sagemath.org/question/36665/Pick a point at random on an elliptic curve with specific orderhttps://ask.sagemath.org/question/35921/pick-a-point-at-random-on-an-elliptic-curve-with-specific-order/Hi!
I use the function `random_point()` to pick a point at random on an elliptic curve, but I was wondering if there is a way to pick a point at random that has a specific order (or some useful geometric property that allows me to do that).
So far, brute forcing seems the only way to me (pick a point at random, check its order and iterate until it has the wanted order) but it's obviously very naive!
Thank you for your help!
Bahamut91Mon, 05 Dec 2016 10:16:21 -0600https://ask.sagemath.org/question/35921/Random point on elliptic curve with specific orderhttps://ask.sagemath.org/question/35920/random-point-on-elliptic-curve-with-specific-order/ Hi!
I use the function `random_point()` to pick a point at random on an elliptic curve, but I was wondering if there is a way to pick a point at random that has a specific order (or some useful geometric property that allows me to do that).
So far, brute forcing seems the only way to me (pick a point at random, check its order and iterate until it has the wanted order) but it's obviously very naive!
Thank you for your help!
Bahamut91Mon, 05 Dec 2016 10:14:53 -0600https://ask.sagemath.org/question/35920/Can I show ordered sets in order?https://ask.sagemath.org/question/34369/can-i-show-ordered-sets-in-order/ I'm using SageTex to generate random algebra tests, with an answer key at the end. To have my students show they understand roster notation for sets, I'm having them write the set of all two-digit multiples of n for some number n in {2, 3, 4, ... 9}. Asking the question isn't hard. But in generating the answer key, the set shows up in random order. I know it's still the same set, of course, but it's less intuitive to interpret. It seems like Sage is going out of it's way to randomize the set. Here's some minimal working code:
n = Set(range(2, 10)).random_element()
X = Set()
for i in range(10, 100):
if i % n == 0:
X = X.union(Set([i]))
show(n)
show(X)
This shows, for example:
8
{32, 64, 48, 40, 80, 96, 16, 24, 56, 72, 88}
Is there some way to have Sage show the elements of the set in order?mathochistSun, 07 Aug 2016 19:13:27 -0500https://ask.sagemath.org/question/34369/Why the function .cardinality() doesnt work with a permutation group ?https://ask.sagemath.org/question/27127/why-the-function-cardinality-doesnt-work-with-a-permutation-group/ I have acode that use to run very good, but I dont know why no longer the basic functions works for my permutation groups, i.e Abelian, cardinality, order. Only degree seems to workhbanosWed, 17 Jun 2015 01:05:34 -0500https://ask.sagemath.org/question/27127/Sorted list of symbolic eigenvalues (and corresponding eigenvectors)https://ask.sagemath.org/question/9599/sorted-list-of-symbolic-eigenvalues-and-corresponding-eigenvectors/Is there a way to obtain a sorted list of eigenvalues when they are computed symbolically (in SR). Particularly knowing that in specific points, they can switch order.
So far, what I have is (assuming $R^3$):
def sorted_eval(m, x, y, z, order=0):
_ev = m.eigenvalues()
_ev = numpy.array(ev.subs(x=x, y=y, z=z))
_ev.sort()
return _ev[order]
But then if I want to perform a contour plot:
x, y, z = var('x y z')
p = vector([x,y,z])
f = p * p
h = f.hessian()
contour(lambda x, y: sorted_eval(h, x, y, 0, 0), (x, -1.5, 1.5), (y, -1.5, 1.5))
It takes a long time
Thanks
D
DemMon, 03 Dec 2012 07:08:01 -0600https://ask.sagemath.org/question/9599/eigenvalues of a derivative vs derivative of eigenvalueshttps://ask.sagemath.org/question/9543/eigenvalues-of-a-derivative-vs-derivative-of-eigenvalues/Hi! I have this little problem. If anyone would be so kind to share his knowledge and shed some lite on it, I'd be very grateful. Big thanks in advance (and sorry for my english)!
I have a matrix M=M(x) depending on a variable x. I want sage to compute trace of a product of a derivative of M, M' and some function of it, f(M), at a fixed value of x=x_0; that is:
(tr[M'*f(M)])|_(x=x_0).
It just so happens that tr[M'*f(M)] = sum( ev_i' *f(ev_i) ), where {ev_i(x)} are eigenvalues of M. Lucky me. Diagonalisation of M commutes with differentiating or taking the function of it, one could say.
But my M and its derivative are somewhat complicated, yet simplify greatly after substituting x=x_0. So I would very much prefer first to compute M', substitute x_0 M0:=M|_(x=x_0) and M'0:=M'|_(x=x_0), and only after that ask sage for eigenvalues:
ev1=M0.eigenvalues()
ev2=M'0.eigenvalues()
So here's the question: do i have any reason for hoping that:
(tr[M'*f(M)])|_(x=x_0) = sum( ev2[i] *f(ev1[i]) for i in range(dim of M) )?
(That is, wether the order of eigenvalues changes if I exchange diagonalisation with differentiation?)ozikSat, 17 Nov 2012 12:18:33 -0600https://ask.sagemath.org/question/9543/Order of a differential equation?https://ask.sagemath.org/question/9113/order-of-a-differential-equation/Does it exists a method or a function that returns the the order of a (O-P)DE?Lucas_MalorSun, 15 Jul 2012 06:48:41 -0500https://ask.sagemath.org/question/9113/