ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 16 Aug 2021 13:43:50 +0200number of distinct prime factors of a numberhttps://ask.sagemath.org/question/58482/number-of-distinct-prime-factors-of-a-number/ I know how to write a function that counts the number of distinct prime factors of a number.
Does there exist an inbuilt function for this purpose?aakkbbMon, 16 Aug 2021 13:43:50 +0200https://ask.sagemath.org/question/58482/Thue-Mahler equationhttps://ask.sagemath.org/question/57577/thue-mahler-equation/Let $F \in \mathbb{Z}[X,Y]$ be an homogenous polynomial. An equation of the form
$$ F(X,Y) = d p_1^{a_1}\cdots p_n^{a_n},$$
with $p_1, \cdots, p_n$ are prime numbers and $d \in \mathbb{Z}$ is called a Thue-Mahler equation. Is there an explicit function in sage that can solve this kind of equations even if is a simpler case such as F(x,y) = p^a ?. I have been looking for this with no result.
Joao FedeTue, 15 Jun 2021 20:42:36 +0200https://ask.sagemath.org/question/57577/Computing Ray class numbers?https://ask.sagemath.org/question/57338/computing-ray-class-numbers/I got this code [from this forum](https://ask.sagemath.org/question/9127),
it gives a name error, any help is greatly appreciated.
class RayClassGroup(AbelianGroup_class ):
def __init__(self, number_field, mod_ideal = 1, mod_archimedean = None):
if mod_archimedean == None:
mod_archimedean = [0] * len(number_field.real_places())
bnf = gp(number_field.pari_bnf())
# Use PARI to compute ray class group
bnr = bnf.bnrinit([mod_ideal, mod_archimedean],1)
invariants = bnr[5][2] # bnr.clgp.cyc
invariants = [ ZZ(x) for x in invariants ]
AbelianGroup_class.__init__(self, len(invariants), invariants)
self.__number_field = number_field
self.__bnr = bnr
def __call__(self, *args, **kwargs):
return group.Group.__call__(self, *args, **kwargs)
def _element_constructor_(self, *args, **kwargs):
if isinstance(args[0], AbelianGroupElement):
return AbelianGroupElement(self, args[0])
else:
I = self.__number_field.ideal(*args, **kwargs)
# Use PARI to compute class of given ideal
g = self.__bnr.bnrisprincipal(I)[1]
g = [ ZZ(x) for x in g ]
return AbelianGroupElement(self, g)`prathamlalwaniSat, 29 May 2021 04:25:27 +0200https://ask.sagemath.org/question/57338/Are results found of an Elliptic Curve by SageMathCell proven?https://ask.sagemath.org/question/49605/are-results-found-of-an-elliptic-curve-by-sagemathcell-proven/ Well, I have for example the following SageMathCell-code:
sage: E = EllipticCurve(QQ, [0,63,-2205,-12348,0])
sage: E
sage: for P in E.integral_points():
....: Q = -P
....: print( "P = %8s and -P = %8s" % (P.xy(), Q.xy()) )
This code computes the integral points of the Elliptic Curve that is defined by:
$$[0,63,-2205,-12348,0]\space\space\space\to\space\space\space y^2 - 2205y = x^3 + 63x^2 - 12348x\tag1$$
>Are these results I get, proven to be the only ones out there? Or can there be more solutions that SageMathCell did not find?
___
Bytheway, the code gives the following output:
P = (-174, 1161) and -P = (-174, 1044)
P = (-147, 2205) and -P = (-147, 0)
P = (-98, 2548) and -P = (-98, -343)
P = (-68, 2528) and -P = (-68, -323)
P = (-54, 2484) and -P = (-54, -279)
P = (0, 2205) and -P = (0, 0)
P = (57, 2052) and -P = (57, 153)
P = (84, 2205) and -P = (84, 0)
P = (147, 3087) and -P = (147, -882)
P = (231, 4851) and -P = (231, -2646)
P = (309, 6840) and -P = (309, -4635)
P = (375, 8730) and -P = (375, -6525)
P = (378, 8820) and -P = (378, -6615)
P = (711, 20691) and -P = (711, -18486)
P = (1176, 42336) and -P = (1176, -40131)
P = (2107, 99127) and -P = (2107, -96922)
P = (2886, 157716) and -P = (2886, -155511)
P = (5412, 401472) and -P = (5412, -399267)
P = (5572, 419293) and -P = (5572, -417088)
P = (37275, 7203735) and -P = (37275, -7201530)
P = (26162409, 133818797385) and -P = (26162409, -133818795180)
Jan1997Sun, 19 Jan 2020 15:33:57 +0100https://ask.sagemath.org/question/49605/What is the .sigma() function for an elliptic curve's formal group?https://ask.sagemath.org/question/55571/what-is-the-sigma-function-for-an-elliptic-curves-formal-group/The SageMath documentation page for "formal groups of elliptic curves" (I can't link it because I don't have enough karma) lists among the methods for formal groups of elliptic curves a `.sigma()`, with essentially no explanation of what it is. This makes me suspect that it's the $p$-adic $\sigma$-function of the elliptic curve, as defined by Mazur and Tate in their paper of that name, but I'd like some security in whether the implementation is accurate, as well as what the "c" variable is - I guess probably it somehow corresponds to a choice of invariant differential on the elliptic curve/formal group since that's the only other thing the $p$-adic $\sigma$-function depends on, but how this works isn't transparent to me.peter.xuWed, 03 Feb 2021 22:13:27 +0100https://ask.sagemath.org/question/55571/How to find a CM point with the image in the elliptic curve under modular parametrization givenhttps://ask.sagemath.org/question/47463/how-to-find-a-cm-point-with-the-image-in-the-elliptic-curve-under-modular-parametrization-given/ everyone! Let $E:y^2+y=x^3-61$ be the minimal model of the elliptic curve 243b. How can I find the CM point $\tau$ in $X_0(243)$ such that $\tau$ maps to the point $(3\sqrt[3]{3},4)$ under the modular parametrization? Can anyone tell me the answer or how to use sagemath to find it?
I use the sagemath code
EllipticCurve([0,0,1,0,-61])
phi = EllipticCurve([0,0,1,0,-61]).modular_parametrization()
f=phi.power_series(prec = 10000)[1]
f.truncate(20000)
to get the parametrization of y coordinate, then I use
q=var('q')
f(q)=
df=diff(f,q)
NewtonIt(q)=q-(f/df)(q)
xn=e^(2*pi*I*a/20.031)
for i in range(1000):
xn=N(NewtonIt(xn),digits=2000)
print xn
to get the numerical $e^{2\pi i \tau}$. After taking log and dividing by $2 \pi i$, I get the numerical $\tau$. But if I use
z=
p=z.algebraic_dependency(100)
I get the wrong polynomial. Why?
LeeSun, 11 Aug 2019 23:05:54 +0200https://ask.sagemath.org/question/47463/Mistake in SageMathCell code, finding integral points on elliptic curveshttps://ask.sagemath.org/question/48933/mistake-in-sagemathcell-code-finding-integral-points-on-elliptic-curves/ I've the following number:
$$12\left(n-2\right)^2x^3+36\left(n-2\right)x^2-12\left(n-5\right)\left(n-2\right)x+9\left(n-4\right)^2\tag1$$
Now I know that $n\in\mathbb{N}^+$ and $n\ge3$ (and $n$ has a given value) besides that $x\in\mathbb{N}^+$ and $x\ge2$.
I want to check if the number is a perfect square, so I can rewrite $(1)$ as follows:
$$y^2=12\left(n-2\right)^2x^3+36\left(n-2\right)x^2-12\left(n-5\right)\left(n-2\right)x+9\left(n-4\right)^2\tag2$$
Where $y\in\mathbb{Z}$.
In this problem I've: $n=71$, the number is equal to;
$$y^2=57132x^3+2484x^2-54648x+40401\tag3$$
So, I used SageMathCell to look for the integral points on the elliptic curve and the code that was used is the following:
E = EllipticCurve([0, β, 0, γ, δ])
P = E.integral_points()
for p in P:
if p[0] % α == 0:
print(p[0] // α, p[1] // α)
I found the coeficients I need to use using equation $(2)$ and $(3)$ (but I do not know if they are corect):
- $$\alpha=12(71-2)^2=57132\tag4$$
- $$\beta=36(71-2)=2484\tag5$$
- $$\gamma=-144(71-5)(71-2)^3=-3122149536\tag6$$
- $$\delta=1296(71-4)^2(71-2)^4=131871507195024\tag7$$
So the final code looks like:
E = EllipticCurve([0, 2484, 0, -3122149536, 131871507195024])
P = E.integral_points()
for p in P:
if p[0] % 57132 == 0:
print(p[0] // 57132, p[1] // 57132)
But I found no solutions and it should give at least one solution at $x=1585$.
>What mistake have I made?Jan123Tue, 03 Dec 2019 17:13:08 +0100https://ask.sagemath.org/question/48933/Pari error when factoring polynomialhttps://ask.sagemath.org/question/42742/pari-error-when-factoring-polynomial/ I ran the following code to factor a polynomial over a number field:
U.<z> = CyclotomicField(32)
P.<x> = PolynomialRing(U)
f = x^16-256
print f.factor()
This code works for all substitutions of 256 by another value I have tried, but this one gives an error:
Traceback (most recent call last):
File "p_is_2_test.sage.py", line 10, in <module>
print f.factor()
File "sage/rings/polynomial/polynomial_element.pyx", line 4199, in sage.rings.polynomial.polynomial_element.Polynomial.factor (build/cythonized/sage/rings/polynomial/polynomial_element.c:39418)
File "cypari2/auto_gen.pxi", line 17246, in cypari2.gen.Gen_auto.nffactor
File "cypari2/handle_error.pyx", line 196, in cypari2.handle_error._pari_err_handle
cypari2.handle_error.PariError: inconsistent concatenation t_COL (8 elts) , t_VEC (8 elts)
This seems like some bug in sage, but I am not quite sure what to make of the error. Does anyone know how to deal with this error and to properly let sage factor this polynomial?MadPidgeonTue, 26 Jun 2018 21:58:15 +0200https://ask.sagemath.org/question/42742/subgroup of unit group of number field (without calculating unit group)?https://ask.sagemath.org/question/42622/subgroup-of-unit-group-of-number-field-without-calculating-unit-group/https://ask.sagemath.org/question/27274/subgroup-of-number-field-unit-group/
There is a similar question in this link. But I want to know whether I can do this (without knowing the unit group).
So, I have collected a list of elements (from another code), which will be generators of the subgroup I want to generate. What should I do?
mathjainSun, 17 Jun 2018 11:51:27 +0200https://ask.sagemath.org/question/42622/Behavior of quadratic_L_function__exact()https://ask.sagemath.org/question/36496/behavior-of-quadratic_l_function__exact/I need to evaluate $L$-functions of the form $$\sum_{n=0}^{\infty} \Big( \frac{D}{n} \Big) n^{-s}$$ at integers, where $\Big( \frac{\cdot}{\cdot} \Big)$ is the Kronecker symbol. This is apparently what quadratic_L_function__exact(k,D) does. However I find this unreliable when D is not squarefree.
For example, the value quadratic_L_function__exact(2,4) = pi^2 / 6 is not what I need; the series above is actually pi^2 / 8. However, the value quadratic_L_function__exact(2,12) = 1/18 * sqrt(3) * pi^2 seems correct. I can't tell what's going on.user101214Thu, 09 Feb 2017 07:00:24 +0100https://ask.sagemath.org/question/36496/