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.Thu, 26 May 2022 20:16:48 +0200Coordinate chart restriction raising a floating-point-overflow errorhttps://ask.sagemath.org/question/62640/coordinate-chart-restriction-raising-a-floating-point-overflow-error/ I am using the 9.3 version and what i am trying to do is pass a multivariable function (r,th) as a restriction on my chart. I have been able to do this before in exactly the same way using a different (r,th) function but for some reason beyond my understanding i cannot seem to make it work now. I would deeply appreciate any insights. (I've also tried this in the 9.4 version with the coord_restrictions=[] line but it raises the same error).
My code is:
M = Manifold(4, 'M', latex_name=r'\mathcal{M}', structure='Lorentzian')
X.<t,r,th,ph>=M.chart(r"t r:(1.36,+inf) th:(0,pi):\theta ph:(0,2*pi):periodic\phi")
X.add_restrictions(4*(0.850000000000000*r^5 + 1.22825000000000*r^3*cos(th)^2 + 0.443705312500000*r*cos(th)^4 + 0.850000000000000*r^2)^2*sin(th)^4/(r^6 + 2.16750000000000*r^4*cos(th)^2 + 1.56601875000000*r^2*cos(th)^4 + 0.377149515625000*cos(th)^6)^2 + (r^6 + 0.377149515625000*cos(th)^6 - 2*r^5 + (1.56601875000000*r^2 - 1.04401250000000*r)*cos(th)^4 + r^3 + (2.16750000000000*r^4 - 2.89000000000000*r^3 + 0.722500000000000*r)*cos(th)^2 - 2*r^2)*((1.44500000000000*r^5 + 0.754299031250000*r*cos(th)^4 + 0.722500000000000*r^3 + (2.08802500000000*r^3 + 0.522006250000000*r)*cos(th)^2 + 1.44500000000000*r^2)*sin(th)^4 + (r^8 + (0.377149515625000*r^2 + 0.272490525039062)*cos(th)^6 + 0.722500000000000*r^6 + 3*(0.522006250000000*r^4 + 0.377149515625000*r^2)*cos(th)^4 + 3*(0.722500000000000*r^6 + 0.522006250000000*r^4)*cos(th)^2)*sin(th)^2)/(r^6 + 2.16750000000000*r^4*cos(th)^2 + 1.56601875000000*r^2*cos(th)^4 + 0.377149515625000*cos(th)^6)^2>0.1)
and it raises:
RuntimeError Traceback (most recent call last)
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name)
718 try:
--> 719 self._name = parent._create(value, name=name)
720 except (TypeError, RuntimeError, ValueError) as x:
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in _create(self, value, name)
605 else:
--> 606 self.set(name, value)
607 except RuntimeError as error:
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in set(self, var, value)
513 cmd = '%s : %s$'%(var, value.rstrip(';'))
--> 514 self.eval(cmd)
515
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in _eval_line(self, line, locals, reformat, **kwds)
459 if statement:
--> 460 maxima_eval("#$%s$" % statement)
461 if not reformat:
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8600)()
851 lispargs = EclObject(list(args))
--> 852 return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
853
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:5898)()
364 if error != NULL:
--> 365 raise RuntimeError("ECL says: {}".format(
366 ecl_string_to_python(error)))
RuntimeError: ECL says: #<a FLOATING-POINT-OVERFLOW 0x6ff7f7e7dc80>
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-3-ccc90da119ec> in <module>
----> 1 X.add_restrictions(Integer(4)*(RealNumber('0.850000000000000')*r**Integer(5) + RealNumber('1.22825000000000')*r**Integer(3)*cos(th)**Integer(2) + RealNumber('0.443705312500000')*r*cos(th)**Integer(4) + RealNumber('0.850000000000000')*r**Integer(2))**Integer(2)*sin(th)**Integer(4)/(r**Integer(6) + RealNumber('2.16750000000000')*r**Integer(4)*cos(th)**Integer(2) + RealNumber('1.56601875000000')*r**Integer(2)*cos(th)**Integer(4) + RealNumber('0.377149515625000')*cos(th)**Integer(6))**Integer(2) + (r**Integer(6) + RealNumber('0.377149515625000')*cos(th)**Integer(6) - Integer(2)*r**Integer(5) + (RealNumber('1.56601875000000')*r**Integer(2) - RealNumber('1.04401250000000')*r)*cos(th)**Integer(4) + r**Integer(3) + (RealNumber('2.16750000000000')*r**Integer(4) - RealNumber('2.89000000000000')*r**Integer(3) + RealNumber('0.722500000000000')*r)*cos(th)**Integer(2) - Integer(2)*r**Integer(2))*((RealNumber('1.44500000000000')*r**Integer(5) + RealNumber('0.754299031250000')*r*cos(th)**Integer(4) + RealNumber('0.722500000000000')*r**Integer(3) + (RealNumber('2.08802500000000')*r**Integer(3) + RealNumber('0.522006250000000')*r)*cos(th)**Integer(2) + RealNumber('1.44500000000000')*r**Integer(2))*sin(th)**Integer(4) + (r**Integer(8) + (RealNumber('0.377149515625000')*r**Integer(2) + RealNumber('0.272490525039062'))*cos(th)**Integer(6) + RealNumber('0.722500000000000')*r**Integer(6) + Integer(3)*(RealNumber('0.522006250000000')*r**Integer(4) + RealNumber('0.377149515625000')*r**Integer(2))*cos(th)**Integer(4) + Integer(3)*(RealNumber('0.722500000000000')*r**Integer(6) + RealNumber('0.522006250000000')*r**Integer(4))*cos(th)**Integer(2))*sin(th)**Integer(2))/(r**Integer(6) + RealNumber('2.16750000000000')*r**Integer(4)*cos(th)**Integer(2) + RealNumber('1.56601875000000')*r**Integer(2)*cos(th)**Integer(4) + RealNumber('0.377149515625000')*cos(th)**Integer(6))**Integer(2)>RealNumber('0.1'))
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/manifolds/chart.py in add_restrictions(self, restrictions)
1932 right = operands[1]
1933 right_var = right.variables()
-> 1934 if left in self._xx:
1935 # the l.h.s. of the restriction is a single
1936 # coordinate
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.__nonzero__ (build/cythonized/sage/symbolic/expression.cpp:20864)()
3195 from sage.symbolic.relation import test_relation_maxima
3196 if self.variables():
-> 3197 return test_relation_maxima(self)
3198 else:
3199 return False
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/symbolic/relation.py in test_relation_maxima(relation)
538 difference.simplify_rational(),
539 difference.simplify_rectform(),
--> 540 difference.simplify_trig()]
541 for f in simp_list:
542 try:
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.simplify_trig (build/cythonized/sage/symbolic/expression.cpp:55569)()
10389 # right otherwise!
10390 if expand:
> 10391 return self.parent()(self._maxima_().trigexpand().trigsimp())
10392 else:
10393 return self.parent()(self._maxima_().trigsimp())
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, *args, **kwds)
678
679 def __call__(self, *args, **kwds):
--> 680 return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
681
682 def help(self):
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in function_call(self, function, args, kwds)
599 [s.name() for s in args],
600 ['%s=%s'%(key,value.name()) for key, value in kwds.items()])
--> 601 return self.new(s)
602
603 def _function_call_string(self, function, args, kwds):
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in new(self, code)
368
369 def new(self, code):
--> 370 return self(code)
371
372 ###################################################################
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, x, name)
294
295 if isinstance(x, str):
--> 296 return cls(self, x, name=name)
297 try:
298 # Special methods do not and should not have an option to
/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name)
719 self._name = parent._create(value, name=name)
720 except (TypeError, RuntimeError, ValueError) as x:
--> 721 raise TypeError(x)
722
723 def _latex_(self):
TypeError: ECL says: #<a FLOATING-POINT-OVERFLOW 0x6ff7f7e7dc80>
BubbzThu, 26 May 2022 20:16:48 +0200https://ask.sagemath.org/question/62640/Computing the inverse of a generic element in a finite field extensionhttps://ask.sagemath.org/question/62630/computing-the-inverse-of-a-generic-element-in-a-finite-field-extension/ I am working in the following field extension:
p = 2**64-2**32+1
P.<X,A,B,C> = PolynomialRing(GF(p))
GF.<x,a,b,c> = P.quotient_ring(X^3-X-1)
My objective is to take a generic element of this field `p(x) = a + b*x + c*x^2` and compute its inverse, where its coefficients are a function of `a,b,c`.
However, if I try to directly do it:
q = x^2
qinv = 1 / q
I get a singular error. I get an error (`ArithmeticError: Division failed. The numerator is not a multiple of the denominator.`) if I change the prime to, say, 5. If I do not use the variables to express the generic coefficients of `p(x)`, then clearly it works, but I do not get the desired result.
Is there any way I can achieve what I need?WimetWed, 25 May 2022 18:28:14 +0200https://ask.sagemath.org/question/62630/Monte_carlo Integration and Gauss coil formulahttps://ask.sagemath.org/question/62619/monte_carlo-integration-and-gauss-coil-formula/Hi
When I try to compute the Gauss formula to calculate the number of turn's wraps between two solenoids.
if I don't put spaces between the turns (here a linear function, `t*(turnSpace=0)`,
then the Integer value is inside the error range of the `monte_carlo_integral()` function.
But if I introduce a space between the turns (`turnSpace=2*pi/1024`),
then appears an error in the calculation of the Monte Carlo integral value which is out of the error range !.
(comment lines 61 and 62 to introduce a space between the turns of both coils)
Where is the error ? in my computation (most likely !)? in the `monte_carlo_integral` function ?
with another software when integrating the function `turnsNumberNumDerivative(t, s)` below between `t = [0, 12*pi]` and `s = [0, 14*pi]`
do we find the integer value $42=6*7$ +- Error with the integer value in the error range?
[code on SageCell ](https://sagecell.sagemath.org/?q=zfpeuh)
turnsNumberNumDerivative(t,s)=-((sqrt(2)*pi*s + 1024*sqrt(3)*cos(s) - 512*sqrt(2)*sin(s) - 2457.6 *cos(t) - 1024)*(pi*(sqrt(3)*(sqrt(2)*pi - 512*sqrt(2)*cos(s)) + 1024*sin(s)) + 1228.8 *(sqrt(2)*pi + 512*sqrt(2)*cos(s))*cos(t)) - (pi*(sqrt(3)*(sqrt(2)*pi*s - 512*sqrt(2)*sin(s)) - 1024*cos(s) + 2457.6 *sin(t)) + 1228.8 *(sqrt(2)*pi*s - 2*pi*t + 512*sqrt(2)*sin(s))*cos(t))*(sqrt(2)*pi - 512*sqrt(2)*cos(s) - 1024*sqrt(3)*sin(s)) - 1228.8 *((sqrt(2)*pi + 512*sqrt(2)*cos(s))*(sqrt(3)*(sqrt(2)*pi*s - 512*sqrt(2)*sin(s)) - 1024*cos(s) + 2457.6 *sin(t)) - (sqrt(2)*pi*s - 2*pi*t + 512*sqrt(2)*sin(s))*(sqrt(3)*(sqrt(2)*pi - 512*sqrt(2)*cos(s)) + 1024*sin(s)))*sin(t))/(pi*(4*(sqrt(2)*pi*s - 2*pi*t + 512*sqrt(2)*sin(s))^2 + (sqrt(2)*pi*s + 1024*sqrt(3)*cos(s) - 512*sqrt(2)*sin(s) - 2457.6 *cos(t) - 1024)^2 + (sqrt(3)*(sqrt(2)*pi*s - 512*sqrt(2)*sin(s)) - 1024*cos(s) + 2457.6 *sin(t))^2)^(3/2))
new attempt to code button is now ok ;-), it seems I had to supress 00000000
print("https://www.maths.ed.ac.uk/~v1ranick/papers/ricca.pdf")
allVars=var('alpha,beta,gamma,'+
't,t0,t1,nt,shiftXt,shiftYt,shiftZt,Rt,turnSpaceT,'+
's,s0,s1,ns,shiftXs,shiftYs,shiftZs,Rs,turnSpaceS',domain='real')
assume(nt>0) ;assume(ns >0);
precis=50
#########################################
def addAxis(plt,textToPlt,xBound,yBound,zBound) :
# add axis for real part
plt += arrow3d((0, 0, 0), (xBound, 0, 0), color='blue')
plt += text3d("X", (xBound, 0, 0), color='blue')
plt += arrow3d((0, 0, 0), (0, yBound, 0), color='green')
plt += text3d("Y", (0, yBound, 0), color='green')
plt += arrow3d((0, 0, 0), (0, 0, zBound), color='red')
plt += text3d("Z", (0,0, zBound), color='red')
plt+=textToPlt
return plt
def RotateVector(V,anglesDic) :
#rotation angle alpha around X axis
RotalphaX=matrix(SR,[[1,0,0],[0,cos(alpha),-sin(alpha)],[0,sin(alpha),cos(alpha)]]).subs(anglesDic)
#rotation angle beta around Y axis
RotbetaY=matrix(SR,[[cos(beta),0,sin(beta)],[0,1,0],[-sin(beta),0,cos(beta)]]).subs(anglesDic)
#rotation angle gamma around Z axis
RotgammaZ=matrix(SR,[[cos(gamma),-sin(gamma),0],[sin(gamma),cos(gamma),0],[0,0,1]]).subs(anglesDic)
Vx= (RotalphaX*V)
Vxy= (RotbetaY*Vx)
Vxyz= (RotgammaZ*Vxy)
return vector(Vxyz)
anglesDict={alpha:0,beta:0,gamma:0}
anglesDics={alpha:pi/4,beta:0,gamma:pi/6}
#########################################
xyBound=1.2 ;
thck=8
gammat0 = vector(SR,[shiftXt+Rt*cos(t),shiftYt+Rt*sin(t),t*turnSpaceT]) # in xy plane
gammat=RotateVector(gammat0,anglesDict)
gammas0 = vector(SR,[shiftXs+Rs*cos(s),shiftYs+Rs*sin(s),s*turnSpaceS])
gammas= RotateVector(gammas0,anglesDics)
show("gammat : \t " ,gammat)
show("gammas : \t " ,gammas)
# set here below the number n of coil turns of the blue solenoid)
# the radius Rt and the turns space turnSpaceT
tDic={nt:6 , Rt:1 , turnSpaceT:2*pi/512 , shiftXt:1/2 , shiftYt:0 , shiftZt:0}
# change here below the number n of coil turns of the black solenoid)
# the radius Rs and the turns space turnSpaceS
sDic={ns:7 , Rs:1 , turnSpaceS:2*pi/512 , shiftXs:0 , shiftYs:0 ,shiftZs:0}
# no space between spires then Monte Carlo integration OK
#tDic={nt:6 , Rt:1 , turnSpaceT:0 , shiftXt:1/2 , shiftYt:0 , shiftZt:0}
#sDic={ns:7 , Rs:1 , turnSpaceS:0 , shiftXs:0 , shiftYs:0 ,shiftZs:0}
show("gammat with coil's values : \t " ,gammat.subs(tDic))
show("gammas with coil's values : \t " ,gammas.subs(sDic))
# set the circles centers
centerGammat=RotateVector(vector([shiftXt,shiftYt,shiftZt]).subs(tDic),anglesDict)
centerGammas=RotateVector(vector([shiftXs,shiftYs,shiftZs]).subs(sDic),anglesDics)
textToPlt = text3d("Gauss turns number", (xyBound, xyBound, xyBound), fontsize='300%', fontweight=800)
plt=parametric_plot3d(gammat.subs(tDic), (0,nt.subs(tDic)*2*pi),color="blue",thickness=thck)
plt+=parametric_plot3d(gammas.subs(sDic), (0,ns.subs(sDic)*2*pi),color="grey",thickness=thck)
plt+=addAxis(plt,textToPlt,1,1,1)
plt+=plot(centerGammat,color="blue")
plt+=point3d(centerGammat,size=20,color="blue")
plt+=plot(centerGammas,color="black")
plt+=point3d(centerGammas,size=20,color="black")
plt.show(viewer='threejs')
integrationFactorFunction=(1/(4*pi*((gammas-gammat).norm())^3)).subs(tDic).subs(sDic)
# here choose the integration function factor (integrationFactorFunction0 or integrationFactorFunction1)
M=matrix([ [ gammat.diff(t)[0],gammat.diff(t)[1],gammat.diff(t)[2] ],
[ gammas.diff(s)[0],gammas.diff(s)[1],gammas.diff(s)[2] ],
[(gammat[0]-gammas[0]), (gammat[1]-gammas[1]),(gammat[2]-gammas[2]) ] ])
precis=40 # precision approximation
# solenoid with space turn length
show(LatexExpr(r"tLen=\int^{b}_{a} \sqrt{ x_t′(t)^2 + y_t′(t)^2 + z_t′(t)^2 } dt \, \, \," +
r"sLen=\int^{b}_{a} \sqrt{ x_s′(t)^2 + y_s′(t)^2 + z_s′(t)^2 } dt "))
show(" ################ compute solenoid length ########################")
tLenDt=sqrt((M[0][0]^2 + M[0][1]^2 + M[0][2]^2).subs(tDic))
show(tLenDt)
solenoidTLen=integrate(tLenDt, (t, 0, nt.subs(tDic)*2*pi ) )
show("solenoid T length : \t ",solenoidTLen, " \t numerical value : \t ",solenoidTLen.n(precis))
sLenDt=sqrt((M[1][0]^2 + M[1][1]^2 + M[1][2]^2).subs(sDic))
show(sLenDt)
solenoidSLen=integrate(sLenDt, (s, 0, ns.subs(sDic)*2*pi ) )
show("solenoid S length : \t ",solenoidSLen, " \t numerical value : \t ",solenoidSLen.n(precis))
show("matrix M :")
show(M)
turnsNumber=integrationFactorFunction * M.det()
show("##################### turnsNumber #####################")
turnsNumberNumDerivative=(turnsNumber.subs(tDic)).subs(sDic)
textToPlts = text3d("surface to sum", (xyBound, xyBound, xyBound), fontsize='300%', fontweight=800,transparency=0.5)
var('x,y')
show("turns number fonction to integrate :",turnsNumberNumDerivative)
show(turnsNumberNumDerivative)
show("rough monte_carlo integral approximation : \t",
monte_carlo_integral(turnsNumberNumDerivative(x=t,y=s), [0,0], [ nt.subs(tDic)*2*pi, ns.subs(sDic)*2*pi], 10^8))
#for algo in ['plain', 'miser', 'vegas']: # abs tol 0.01
# show("rough monte_carlo integral approximation : \t",algo,
# monte_carlo_integral(turnsNumberNumDerivative(x=t,y=s), [0,0], [ nt.subs(tDic)*2*pi, ns.subs(sDic)*2*pi],
# 10^6, algorithm=algo))
show(r"""When I try to compute the Gaussian formula to calculate the number of turn's wraps between two solenoids.
if I don't put spaces between the turns (here a linear function,t*(turnSpace=0),
then the Integer value is inside the error range of the monte_carlo_integral() function.
But when I introduce a space between the turns(turnSpace=2*pi/1024), then appears an error in the computation
of the Monte Carlo integral value which is out of the error range !.
(comment lines 61 and 62 to introduce a space between the turns of both coils)
Where is the error ? in my computation ? in the monte_carlo_integral function ? in the Gauss formula ?""")ortolljTue, 24 May 2022 18:45:58 +0200https://ask.sagemath.org/question/62619/Feedback and Potential Improvementhttps://ask.sagemath.org/question/62626/feedback-and-potential-improvement/ It would be good if
limit(1/x, x = 0)
and
limit(tan(x), x = pi/2)
showed undefined as the answer, rather than infinity.
Sage simplifies
sinh(arcsinh(x))
to x and cannot do so for
arcsinh(sinh(x))
Sage can't simplify cosh(x) - (e^x + e^(-x))/2 to 0.
It is counterintuitive for mathematician users to understand log(x) as ln(x), rather than the common log of x.blaec_cocalcWed, 25 May 2022 00:28:04 +0200https://ask.sagemath.org/question/62626/Precision error when finding eigenvalues of Hecke Operatorhttps://ask.sagemath.org/question/62629/precision-error-when-finding-eigenvalues-of-hecke-operator/I am having some trouble when calculating the p-adic valuations of the eigenvalues of the Hecke operator. I am using the following code to calculate them:
p = 5
F=Qp(p, prec=10000)
v=valuations.pAdicValuation(F, 5)
R.<X> = PolynomialRing(F)
S.<T> = PolynomialRing(QQ)
SHOW_FACTORS = False
for m in [52..53]:
hs = hecke_series(p, 2, 2, m)
print(f'\nm = {m}\nhecke series = {hs}')
for root, mul in S(hs).roots(ring=F):
print(f'root {v(root)}')
if not SHOW_FACTORS:
continue
try:
print('Factors:')
for f, mul in R(hs).factor():
print(f)
except:
print('*** factorization failed ***\n')
But I have found that for different precisions m, I do not get the same results. For example, for m=52 and m=53, I get different sets of valuations.
m = 52
hecke series = 248689957516035065054893493652343750*x^13 + 1674403001743485219776630401611328125*x^12 + 1158477226609946228563785552978515625*x^11 + 1681565410974239751696586608886718750*x^10 + 740816027146591471840858459472656250*x^9 + 984876153765252102828224029541015625*x^8 + 2199502199510497526175470605761718750*x^7 + 2047190245401796728083458292414140625*x^6 + 227766241144299957275576934742803125*x^5 + 1626265950251135133773358227520486875*x^4 + 2173838516487905357643185902479851120*x^3 + 966441077617202989620226898790437136*x^2 + 2033736385834117114445851281601109243*x + 1
root 9
root 7
root 4
root 2
root 1
m = 53
hecke series = 4689582056016661226749420166015625000*x^13 + 3894849050993798300623893737792968750*x^12 + 1158477226609946228563785552978515625*x^11 + 1681565410974239751696586608886718750*x^10 + 740816027146591471840858459472656250*x^9 + 7646214301516191345370014038085937500*x^8 + 6640394298011123687869997278125000000*x^7 + 10928974442403049051472511637140703125*x^6 + 4668658339644926118970103607106084375*x^5 + 3846711999501448214620621563702127500*x^4 + 4394284565738218438490449238661491745*x^3 + 3186887126867516070467490234972077761*x^2 + 2033736385834117114445851281601109243*x + 1
root 9
root 7
root 5
root 5
root 4
root 2
root 1
root 0
root 0
I know for a fact that they should be giving the same valuations, however. Indeed, the valutation of the roots should be the same because of the properties of Newton polygon https://en.wikipedia.org/wiki/Newton_polygon as long as the polynomial for m=53 reduces modulo p^52 to the polynomial for m=52. I tested this, using the following code:
hecke_series(5, 2, 2, 52)
R.<q> = PowerSeriesRing(ZZ,default_prec=(p*100))
Poly.<x>=PolynomialRing(ZZ)
def ordred2(a,p):
b=Poly(a)
b+= x^(14) #this is just to make absolutely sure we have enough coefficients to avoid issues with list index
ordred2_b=b.coefficients(sparse=False)
ordred2_coeff=list('ordred2_coeff_%d' % d for d in range(0,14))
for i in range(0,14):
ordred2_coeff[i]=Mod(ordred2_b[i],p^52)
return R(ordred2_coeff)
ordred2(hecke_series(5, 2, 2, 53),5)
And found that it does indeed reduce. However, I did notice that if I use `R.<q> = PowerSeriesRing(ZZ,default_prec=(p*10))` instead, then it does not reduce properly. This seems to indicate to me that there is some sort of precision error that I am running into in this problem, but no matter what I change in my code, I seem to get the same result when calculating the valuations. Indeed, for `Qp(p, prec=10)` and `Qp(p, prec=10000)`, I get the same result. Am I missing something? Is there some other place I have to increase the precision, which I am not seeing?RuneWed, 25 May 2022 18:18:06 +0200https://ask.sagemath.org/question/62629/tick formatter pi cause the plot of squared sine function to have long tick labelhttps://ask.sagemath.org/question/62615/tick-formatter-pi-cause-the-plot-of-squared-sine-function-to-have-long-tick-label/sage: plot(sin(x)^2)
This is normal. but if you use the below code:
sage: plot(sin(x)^2, tick_formatter=pi)
You will get very long y axis tick labels.
The version of sagemath is 9.6-2, from arch linux package repository.
**edit**: tick_formatter=[pi, None] will give the normal result, but according to the documentation of `Graphics objects`, about tick_formatter:
> If the value of this keyword is a single item, then this will give the formatting for the horizontal axis only (except for the "latex" option).
So my code should work, but it did not work.MartineTue, 24 May 2022 17:19:11 +0200https://ask.sagemath.org/question/62615/Feedback and Potential Improvementshttps://ask.sagemath.org/question/62625/feedback-and-potential-improvements/ It would be good if
limit(1/x, x = 0)
and
limit(tan(x), x = pi/2)
showed undefined as the answer, rather than infinity.
Sage simplifies
sinh(arcsinh(x))
to x and cannot do so for
arcsinh(sinh(x))
Sage can't simplify cosh(x) - (e^x + e^(-x))/2 to 0.
It is counterintuitive for mathematician users to understand log(x) as ln(x), rather than the common log of x.blaec_cocalcWed, 25 May 2022 00:27:15 +0200https://ask.sagemath.org/question/62625/symbolic functions and expressionshttps://ask.sagemath.org/question/62622/symbolic-functions-and-expressions/ Suppose I have a huge expression involving symbolic variables and symbolic functions. Is there a way to get the symbolic functions involved in my expression? Something like `.variables()`.
For example:
f(x) = function('f')(x)
h(x) = function('h')(x)
Y(l,m,x,y) = spherical_harmonic(l,m,x,y)
A = f(x)*x^2 + x^diff(h(x),x) + h(x)*Y(l,m,x,y)
`A.desired_function()` should return `(f(x), h(x), diff(h(x),x), Y(l,m,x,y))`. Or, at least `(f(x), h(x), diff(h(x),x))`. I was not able to find such function nor figure out a way build up one.cav_rtTue, 24 May 2022 19:26:51 +0200https://ask.sagemath.org/question/62622/Unexpected result for is_equivalent in class automaton.https://ask.sagemath.org/question/62614/unexpected-result-for-is_equivalent-in-class-automaton/Using the class Automaton, we are finding unexpected results for the method is_equivalent(), which is supposed to test whether two finite automata recognize the same language.
Test:
J = Automaton ([('0','2','a'),('1','1','a'), ('2','1','b'),('3','4','a')], initial_states=['0'], final_states=['1'])
J.is_equivalent(J)
Expected Out : True
Actual Out : False
The documentation for the method can be found in the doc sagemath website at page "Finite state machines, automata, transducers" (no karma to post a link).
Is this a bug or am I misunderstanding the method? How do you suggest I test automata equivalence?DhiaTue, 24 May 2022 16:35:55 +0200https://ask.sagemath.org/question/62614/How to convert a list to components of a PseudoRiemannian metrichttps://ask.sagemath.org/question/62558/how-to-convert-a-list-to-components-of-a-pseudoriemannian-metric/Good afternoon. I work with theoretical physics, and I build Einstein's Tensor from an extensive metric. So I decided to use list comprehension in order to make the construction of curvature tensors simpler. However, after finding the Einstein tensor, I need to work with some components separately, but I am not able to return the list in components of a PseudoRiemannian metric. Is there any possibility to do this conversion?
Thank you in advance for your attention.LucchiniFri, 20 May 2022 17:34:14 +0200https://ask.sagemath.org/question/62558/sagemath 9.0 and sagemath 9.3 on my computer crashhttps://ask.sagemath.org/question/62548/sagemath-90-and-sagemath-93-on-my-computer-crash/I've been using Sagemath on my computer (windows 10) for a long time, but today I found that sagemath Notebook9.0 or 9.3 all crash. I looked at the following information returned by sagemathshell. It doesn't seem normal. I don't know how to solve it. Even if I reinstalled it, it didn't work.
sagemath 9.2 notebook:
> Could not find platform independent libraries <prefix>Could not find platform dependent libraries <exec_prefix>Consider setting $PYTHONHOME to <prefix>[ :<exec_prefix>]
>
> Could not find platform independent libraries <prefix>Could not find platform dependent libraries <exec_prefix>Consider setting $PYTHONHOME to <prefix>[ :<exec_prefix>]
Fatal Python error: initfsencoding: Unable to get the locale encodingModuleNotFoundError : No module named 'encodings '
Current thread oxe000000800018040(most recent call first):
[main] python3 1975 cygwin_exception: : open_stackdumpfile: Dumping stacktrace to python3.stackdump
>[main] python3 1975 cygwin_exception: : open_stackdumpfile: Dumping stacktrace to python3.stackdump
sagemath9.3shell:
> *Don't forget to exit when you are
> done. Beware:
>
> * Do not do anything with other
> copies of Sage on your system. * Do
> not use this for installing Sage
> packages using "sage -i" or for
> running "make" at Sage's root
> directory. These should be done
> outside the Sage shell.
>
> Bypassing shell configuration files...
>
> Note: SAGE_ROOT=/opt/sagemath-9.3
>
> (sage-sh) asus@LAPTOP-PVHBSM6R:~$*lichengFri, 20 May 2022 04:29:57 +0200https://ask.sagemath.org/question/62548/What types of simplify work nowhttps://ask.sagemath.org/question/62590/what-types-of-simplify-work-now/ I'm trying the various forms of simplify I see in the docs, but most say "not found" What exactly is going on? Have some been superseded? What ones still work in Sagemath 9.3 for Windows? i.e. "simplify_full()", "simplify_trig()", "simplify_rational()",\n "simplify_rectform()" "simplify_factorial()", "simplify_log()",\n "simplify_real()", "simplify_hypergeometric()",\n "canonicalize_radical()"
for instance:
simplify_trig?
Object `simplify_trig` not found.
simplify_full?
Object `simplify_full` not found.
Where am I confused?
I seem to recall using these but didn't use sage for a while. What works now?cybervigilanteMon, 23 May 2022 04:46:59 +0200https://ask.sagemath.org/question/62590/composite function simplify expressions and stringshttps://ask.sagemath.org/question/62315/composite-function-simplify-expressions-and-strings/I am using code like
x=simplify(f(g(g(h(f(g(f(g(f(k))))))))))
to explore some composite functions f, g and h in the example line above
I think the line f(x) = x^2-2x+3 (for example) returns f(x) as an 'expression'
I think my lack of understanding of the nature of my expressions may be causing me issues.
I would like to be able to generate a loop so that I can tabulate things like
f(x)
then `gf(x)`
then `ggf(x), gggf(x)` ... etc upto a large number of g's
without having to run the code with `x=simplify(f(k))`
and then
`x=simplify(g(f(k)))` etc etc all separately
How can I do this? Any help much appreciated (obvs).
BTW, feel free to correct my tagsnerak99Wed, 04 May 2022 17:04:13 +0200https://ask.sagemath.org/question/62315/How to define a timeout for EllipticCurve.rank?https://ask.sagemath.org/question/61797/how-to-define-a-timeout-for-ellipticcurverank/Hello,
do you have an idea how to implement a "timeout" for EllipticCurve.rank(only_use_mwrank=True)?
In my application, I have an array of more than 100 elliptic curves and I want to find a subset of 12 curves with rank 0, if possible, in reasonable time. If not possible in reasonable time, I want my function to throw an exception. But it should terminate after let's say 60 seconds.
For most of my elliptic curves the call
r = E.rank(only_use_mwrank=True)
terminates after short time (less than 2 seconds, with a result or with an exception).
But for some elliptic curves the call E.rank() takes more than 1 hour ...
So, my idea is:
I would like to call E.rank(only_use_mwrank=True) in a separate thread - and to terminate the call / the thread after - let's say - 5 seconds.
I tried to find solutions in the internet - but it seems it is very complex because (a) it is not easy to do it in python, (b) it is even more complex to do it with a library call that is in cpython (like E.rank seems to be).
Is there any way how I could do this in sage / python / cypthon?
Thanks a lot
Daniel Lauer
Example:
# In this example, myProc2 does not return for 1 hour ... and therefore "blocks" myProc3.
# You may run the example in SageMathCell (http://sagecell.sagemath.org).
def myProc1():
print("starting myProc1")
E = EllipticCurve([0, 146, 0, 1556, 0])
r = E.rank(only_use_mwrank=True)
print("rank = {}".format(r))
print("finished myProc1")
def myProc2():
print("starting myProc2")
E = EllipticCurve([0, - 249730248677555343372, 0, 158929357618867398869672381174059102500, 0])
E.rank(only_use_mwrank=True)
r = E.rank(only_use_mwrank=True)
print("rank = {}".format(r))
print("finished myProc2")
def myProc3():
print("starting myProc3")
E = EllipticCurve([0, 643, 0, -264, 0])
E.rank(only_use_mwrank=True)
r = E.rank(only_use_mwrank=True)
print("rank = {}".format(r))
print("finished myProc3")
myProc1()
myProc2()
myProc3()
Daniel LauerSat, 02 Apr 2022 17:17:01 +0200https://ask.sagemath.org/question/61797/Image of finitely generated group through an injective homomorphismhttps://ask.sagemath.org/question/62576/image-of-finitely-generated-group-through-an-injective-homomorphism/I'm doing some work with knot theory, and as a part of it, I'm taking an injection of a finitely generated group into the braid group. I want to do some computations on the image of the group, but I'm having trouble actually computing the image in Sage. This is what I have so far:
# Explicitly name generators; rho_i, sigma_i, tau_i
G.<p1, p2, p3, s1, s2, s3, t1, t2, t3, t4> = FreeGroup()
rho = [0, p1, p2, p3] # Zero padding so that rho[i] = rho_i
sigma = [0, s1, s2, s3]
tau = [0, t1, t2, t3, t4]
relations = []
# Lots of relations that aren't actually important for this
for i in range(1, 5):
for j in range(i, 5):
if i != j:
relations.append(tau[i]^-1 * tau[j]^-1 * tau[i] * tau[j])
if abs(i - j) > 1 and i < 4 and j < 4:
relations.append(rho[i]^-1 * rho[j]^-1 * rho[i] * rho[j])
relations.append(sigma[i]^-1 * sigma[j]^-1 * sigma[i] * sigma[j])
relations.append(rho[i]^-1 * sigma[j]^-1 * rho[i] * sigma[j])
# Now relations on neighboring rho_i, sigma_i, tau_i
for i in range(1, 3):
relations.append(rho[i] * rho[i+1] * rho[i] * rho[i+1]^-1 * rho[i]^-1 * rho[i]^-1)
relations.append(sigma[i] * sigma[i+1] * sigma[i] * sigma[i+1]^-1 * sigma[i]^-1 * sigma[i+1]^-1)
relations.append(rho[i] * sigma[i+1] * sigma[i] * rho[i+1]^-1 * sigma[i]^-1 * sigma[i+1]^-1)
relations.append(sigma[i] * sigma[i+1] * rho[i] * sigma[i+1]^-1 * sigma[i]^-1 * rho[i+1]^-1)
relations.append(sigma[i] * rho[i+1] * rho[i] * sigma[i+1]^-1 * rho[i]^-1 * rho[i+1]^-1)
for eta in [1, -1]:
for nu in [1, -1]:
relations.append(tau[i]^eta * sigma[i]^nu * tau[i+1]^(-eta) * sigma[i]^(-nu))
relations.append(tau[i+1]^eta * sigma[i]^nu * tau[i]^(-eta) * sigma[i]^(-nu))
relations.append(tau[i]^eta * rho[i] * tau[i+1]^(-eta) * rho[i]^-1)
relations.append(tau[i+1]^eta * rho[i] * tau[i]^(-eta) * sigma[i]^(-eta) * rho[i] * sigma[i]^eta)
relations.append(tau[i]^eta * rho[i]^-1 * tau[i+1]^(-eta) * sigma[i]^(-eta) * rho[i]^-1 * sigma[i]^eta)
relations.append(tau[i+1]^eta * rho[i]^-1 * tau[i]^(-eta) * rho[i])
# The group I want is F = G / relations
# Now inject into braid group
B = BraidGroup(8, 'b')
b = B.gens()
gen_images = []
for i in range(3):
j = 2 * i
gen_images.append(b[j]) # Image of tau_i
gen_images.append(b[j+1] * b[j+2] * b[j] * b[j+1]) # sigma_i
gen_images.append(b[j+1] * b[j+2]^-1 * b[j] * b[j+1]^-1) # rho_i
gen_images.append(b[6]) # Image of tau_4
f = G.hom(gen_images)
print(f)
for gen in G.gens():
print(f(gen))
The actual relations that I haven't aren't too important, the point is that I have the free group `G` generated by the three sets of generators, and I know what the image of each of those generators should be in the braid group. What I want to do is compute the subgroup of `B` of `f(G / relations)`, which I think is generated by the images of the original generators
b0, b1*b2*b0*b1, b1*b2^-1*b0*b1^-1, b2, b3*b4*b2*b3, b3*b4^-1*b2*b3^-1, b4, b5*b6*b4*b5, b5*b6^-1*b4*b5^-1, b6
then modded out by the image of each of the original relations, but I don't see a way to have a generator of a free group be, for example, `b1*b2*b0*b1`, e.g. something non-trivial. Is there a way of doing that, or some other way of computing the subgroup that I want?cgodfreySat, 21 May 2022 23:58:11 +0200https://ask.sagemath.org/question/62576/How do I define the elliptic curve: y^2 + y = x^3 - x^2 on Sage 9.3?https://ask.sagemath.org/question/62575/how-do-i-define-the-elliptic-curve-y2-y-x3-x2-on-sage-93/ The elliptic curve construction function takes only constants as inputs. But I want to define an elliptic curve E who's equation is given above.
Thank you.Jimmy_McGillSat, 21 May 2022 23:54:26 +0200https://ask.sagemath.org/question/62575/Solve equation of matrices over integershttps://ask.sagemath.org/question/62549/solve-equation-of-matrices-over-integers/Hi,
I have a matrix M and a vector r both over the integers and I want to solve the equation $ v*M = r $ over the integers. I know that there is the command v = M.solve_left(r) to a vector $v$ satisfying the equation. But how can I force it to be a vector over $\mathbb{Z}$?Diego99Fri, 20 May 2022 13:01:58 +0200https://ask.sagemath.org/question/62549/Discrete logarithm problem for multiplicative groupshttps://ask.sagemath.org/question/62473/discrete-logarithm-problem-for-multiplicative-groups/Hey!
I am trying to find a proper library in order to solve the discrete logarithm problem for multiplicative groups. In fact, I would like to solve it in a group like Z/NZ where N is prime number.
Do you know any library where Index calculus algorithm or Number field sieve is implemented? The functions discrete_log and discrete_log_rho sometimes do not work properly when the prime number is large. (like 100 bits)
*For example*:
N = 135792089210356248756420345214020892766061623724957744567843809356293439046059 #prime number
factor(N-1) #factor of prime number minus 1
field_N=GF(N,'b')
gen=field_N.multiplicative_generator()
a=gen**44 #212223489
discrete_log(a,gen,n)
When I try to find the exponent 212223489 it tooks much time. In my mind, I was thinking that, due to the factorization of N-1, the discrete logarithm problem will be more easily. I know I am using a "normal" laptop.
Because of this, I was asking about a specific implementation for multiplicative groups.
Thanks!alberto26Tue, 17 May 2022 14:49:36 +0200https://ask.sagemath.org/question/62473/still getting Malform expression using giac in 9.6https://ask.sagemath.org/question/62471/still-getting-malform-expression-using-giac-in-96/How to use giac 1.9 with sagemath 9.6?NasserTue, 17 May 2022 10:49:33 +0200https://ask.sagemath.org/question/62471/How do I get the help system to work in sagecell?https://ask.sagemath.org/question/62387/how-do-i-get-the-help-system-to-work-in-sagecell/ When I enter a function name followed by "?", all I get is an error message.
rgbrgbTue, 10 May 2022 22:09:49 +0200https://ask.sagemath.org/question/62387/How to recompute symbolic expressionhttps://ask.sagemath.org/question/62498/how-to-recompute-symbolic-expression/ I have a symbolic expression with symbolic evaluation.
After I whand to eval the function to it's expression but it doent work :
var("x, omega, t")
u = function('u')(x)
eq = u(x=1) == cos(omega*t)
eq.show()
u(x) = e^(2*t*x)
eq.show
𝑢(1)=cos(𝜔𝑡)
𝑢(1)=cos(𝜔𝑡)
But now if I create again eq equation, this time it works.
eq2 = u(x=1) == cos(omega*t)
eq2.show()
𝑒(2𝑡)=cos(𝜔𝑡)
Is-it a function recompute to replace easily function by it value ?
The working solution I found isn't practical :
var("x, omega, t")
uf = function('u')(x)
eq = uf(x=1) == cos(omega*t)
eq.show()
u2(x) = e^(2*t*x)
eq.substitute_function(u, u2).show()
I look on subs() and substitute_function() but their behaviour isn't convenient for this case.ThomasLcWed, 18 May 2022 15:50:54 +0200https://ask.sagemath.org/question/62498/Changing from PolynomialRing to LaurentPolynomialRing and maybe backhttps://ask.sagemath.org/question/62533/changing-from-polynomialring-to-laurentpolynomialring-and-maybe-back/Hej,
I am doing some calculations in a Polynomial Ring R<x,y,z> over a finite field GF(p).
With the results from that calculation, I would like to do calculations for which I need a Laurent polynomials over the same finite field, how do I do that in SageMath?
R=PolynomialRing(GF(field),x,num_var, order='degrevlex')
d=f(x,y,z)
Change to LaurentPolynomialRing
Do so more calculations with results d
ThanksschwabisThu, 19 May 2022 14:11:17 +0200https://ask.sagemath.org/question/62533/Can the length of any chord that is parallel to the bases of a trapezoid be found if the lengths of the two bases are known?https://ask.sagemath.org/question/62534/can-the-length-of-any-chord-that-is-parallel-to-the-bases-of-a-trapezoid-be-found-if-the-lengths-of-the-two-bases-are-known/Given the length of the bases of a trapezoid, the median can be found by the formula (b1 + b2)/2. From this the median can be found of the two resultant trapezoids formed by the median and the bases, and ad infinitum. So, at least theoretically, the length of *any* chord that is parallel to the bases can be found. I wonder if there is anyone who has reduced this iterative process into a formula. GeorgioThu, 19 May 2022 14:48:08 +0200https://ask.sagemath.org/question/62534/Can we safely close a laptop in which a SageMath computation is running?https://ask.sagemath.org/question/62532/can-we-safely-close-a-laptop-in-which-a-sagemath-computation-is-running/I am making computation on SageMath 9.3 (console) on my laptop (Huawei, Intel Core i7, Windows 10). Closing the clamshell puts the laptop to sleep (and so puts the running computation to pause). Then reopening the clamshell puts the computation to continue from where it paused. Is it safe to do so? I mean for the computation (not for the laptop). I did some tests, and it seems to be ok (I mean I got the same output with or without closing the clamshell in the middle of the computation), but I would like to know whether it should be always ok.Sébastien PalcouxThu, 19 May 2022 13:44:04 +0200https://ask.sagemath.org/question/62532/Eigenvalues of hecke operators of modular formshttps://ask.sagemath.org/question/62500/eigenvalues-of-hecke-operators-of-modular-forms/I am currently trying to calculate the eigenvalues of the Hecke operator on certain spaces of modular forms. I am able to find the characteristic polynomial, using the built in function `hecke_series(p,N,k,m)`, but then when I try to calculate the roots of this polynomial, I run into an issue where the calculation never finishes, and when I interrupt the kernel it says that it was a "not implemented" error.
I have tried both simply doing
hecke_series(p,N,k,m).roots(multiplicities=False)
and manually setting the ring, as in
hecke_series(p,N,k,m).roots(QuotientRing(ZZ,(p^m)*ZZ), multiplicities=False)
But neither way works. Can anyone explain why this error is occurring, and how to fix it?RuneWed, 18 May 2022 17:40:07 +0200https://ask.sagemath.org/question/62500/How to set folder for temporary graphics fileshttps://ask.sagemath.org/question/62518/how-to-set-folder-for-temporary-graphics-files/ With Ubuntu changing to Firefox as a snap there is a problem with SageMath's location for temporary files, i.e., `$HOME/.sage/temp/$HOSTNAME/<some random 4 digit number>`, since the snap version of Firefox can't access hidden folders. Is there a way to set another location to hold the html files generates by plot3d? (The files are there but my default browser, Firefox, can't display them.) A less satisfactory solution would be to use a different browser (e.g., Epiphany) just to display these files.richardquintThu, 19 May 2022 02:45:37 +0200https://ask.sagemath.org/question/62518/recurrence relationhttps://ask.sagemath.org/question/62494/recurrence-relation/I have the following recurrence relation (which gives the cycle index of the symmetric group), where $a_k$ are just indeterminates:
$Z_0 := 1, \quad Z_n := \frac1n \sum_{k=1}^n a_k Z_{n-k} \quad \forall n>0$
I tried the following, but it doesn't work:
def Z(n):
if n == 0:
return 1
else:
a = var(','.join('a%s'%(i+1) for i in range(n)))
return 1/n*sum(a[k-1]*Z(n-k),k,1,n)
What am I doing wrong?
**Edit**: Based on dan_fulea's answer, I found a way how to put `a` inside `Z(n)`:
def Z(n):
if n == 0:
return 1
a = var(','.join(f'a{k}' for k in [0..n]))
return 1/n * sum([ a[k] * Z(n-k) for k in [1..n] ]).expand()ThrashWed, 18 May 2022 14:32:15 +0200https://ask.sagemath.org/question/62494/limit of sequencehttps://ask.sagemath.org/question/62497/limit-of-sequence/ given this [sequence](https://imgur.com/zsEmW47.png)
i tried the following:
s,n = var('s,n')
s = sum((3*n)/sqrt(2*n^4-k^2*n^2), k, 1, n)
s.limit(n=Infinity)
but i get:
3*limit(n*sum(1/sqrt(-k^2*n^2 + 2*n^4), k, 1, n), n, +Infinity)
which is not the result i want, this sequence either diverges or converges, so its either a number or infinity/-infinity, any ideas how to make this work properly? or can sagemath not handle this type of limits?
thank youmahmoodWed, 18 May 2022 15:38:47 +0200https://ask.sagemath.org/question/62497/Galois Field tower field representationhttps://ask.sagemath.org/question/62484/galois-field-tower-field-representation/I'm trying to create some galois field (GF4, GF16 and GF256) using a tower field representation, as described here:
GF(4) := GF(2)[a] / (a^2 + a+ 1) <br>
GF(16) := GF(4)[b] / (b^2 + b + a) <br>
GF(256) := GF(16)[c] / (c^2 + c + a*b) <br>
I've tried doing that using field extensions, but i've been bumping in errors and dead ends so far. For example, i tried doing something like this:
GF2.<a> = GF(2)
GF4.<b> = GF(4, modulus=a^2+a+1)
But of course i'm getting this error, since the modulus simply evaluates to 1:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ca2ad50ca645> in <module>
----> 1 GF4 = GF(Integer(2)**Integer(2), modulus=a**Integer(2)+a+Integer(1), names=('b',)); (b,) = GF4._first_ngens(1)
~/sage/sage-9.6/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.__call__ (build/cythonized/sage/structure/factory.c:2264)()
365 False
366 """
--> 367 key, kwds = self.create_key_and_extra_args(*args, **kwds)
368 version = self.get_version(sage_version)
369 return self.get_object(version, key, kwds)
~/sage/sage-9.6/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/rings/finite_rings/finite_field_constructor.py in create_key_and_extra_args(self, order, name, modulus, names, impl, proof, check_irreducible, prefix, repr, elem_cache, **kwds)
651
652 if modulus.degree() != n:
--> 653 raise ValueError("the degree of the modulus does not equal the degree of the field")
654 if check_irreducible and not modulus.is_irreducible():
655 raise ValueError("finite field modulus must be irreducible but it is not")
ValueError: the degree of the modulus does not equal the degree of the field
Do you have any idea on how to achieve this?
torresTue, 17 May 2022 23:10:22 +0200https://ask.sagemath.org/question/62484/Differential equation for function involving hyperbolic Sinehttps://ask.sagemath.org/question/62448/differential-equation-for-function-involving-hyperbolic-sine/ Let $y(z) = 2 \frac{sinh^{-1}(z/(2a)^{1/2})}{(z^2 +2a)^{1/2}}$
where $sinh(z)$ is the sine hyperbolic function.
$$ K(z):=\frac{1}{z(y(z) - y(-z))} \rightarrow 1/2\,{\frac {a}{{z}^{2}}}+1/6-{\frac {{z}^{2}}{90\,a}}+{\frac {{z}^{4}
}{378\,{a}^{2}}}-{\frac {23\,{z}^{6}}{28350\,{a}^{3}}}+{\frac {263\,{z
}^{8}}{935550\,{a}^{4}}}-{\frac {133787\,{z}^{10}}{1277025750\,{a}^{5}
}}+{\frac {157009\,{z}^{12}}{3831077250\,{a}^{6}}}-{\frac {16215071\,{
z}^{14}}{976924698750\,{a}^{7}}}+{\frac {2689453969\,{z}^{16}}{
389792954801250\,{a}^{8}}}+O \left( {z}^{18} \right)
$$
How can I find the linear differential equation in $\frac{\partial}{\partial z }$ with coefficent in the polynomial ring $\mathbb{C}[z]$ that annihilates $K(z)$. I am unable to do it by hand I think some software in sagemath might help.
AnupamsageSun, 15 May 2022 08:26:19 +0200https://ask.sagemath.org/question/62448/