ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Nov 2017 14:05:37 -0600Numerical approximation of multiple integralhttp://ask.sagemath.org/question/39733/numerical-approximation-of-multiple-integral/ I want to numerical integrate:
$$\int_{-\infty}^{A_1} \int_{-\infty}^{A_2-x_1} p(x_1)p(x_2)dx_1dx_2 ,$$
where $p(x_i)$ is a random variable that has a normal distribution with mean $\mu_i$ and standard deviation $\sigma_i$.
I faced with several problems:
1. I can't integrate even this simply integral:
import scipy.stats as st
integrate(st.norm.pdf(x), x)
The result is error: `TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''`
2. How to integrate multiple integrals with different $A_i$.alifacerWed, 22 Nov 2017 14:05:37 -0600http://ask.sagemath.org/question/39733/Lagrange interpolation over a finite fieldhttp://ask.sagemath.org/question/39732/lagrange-interpolation-over-a-finite-field/ Sorry if this is obvious I am not a mathematician and am only trying to do this to learn about Samir's Secret Sharing scheme which uses a finite field for security.
I've read the Sage doc here on univariate polynomial ringsGriphookWed, 22 Nov 2017 13:13:14 -0600http://ask.sagemath.org/question/39732/Defining a subgroup of elliptic curves with specific characteristicshttp://ask.sagemath.org/question/39726/defining-a-subgroup-of-elliptic-curves-with-specific-characteristics/Hey,
is there a way, to define a subgroup of an elliptic curve with two or more characteristics? I would like to take an elliptic curve over a finite field of order p and $p^4$, define the r-torsion subgroup (where $r$ is a prime, too) and reduce those to the set of points, which also lays in the Frobenius-eigenspace.
For example:
p= 13
r=5
R=GF(p)
_.<x> = PolynomialRing(R)
R4.<x> = R.extension(x^4 - 2, 'x')
_.<y> = PolynomialRing(R)
b= x^-1
E = EllipticCurve(R, [1,0]) # y^2 = x^3+x
E4 = EllipticCurve(R4, [b,0])
Well, it is easy to find a point on $Q\in E4$, such that $r*Q = (0:1:0)$, use
Q=ZZ(E4.order()/r *Q
, but checking, if $\pi(Q) = pQ$ is hard. I only need one point of that group at all, but my $p$ is even larger, so brute-forcing would be an option, if I could start it 6-12 month ago :)ShalecWed, 22 Nov 2017 07:16:18 -0600http://ask.sagemath.org/question/39726/Python's Fraction Incompatibility ?http://ask.sagemath.org/question/39717/pythons-fraction-incompatibility/Hi
Sagemath doesn't seem to recognize Fraction from the standard module fractions :
$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.0, Release Date: 2017-07-21 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: from fractions import Fraction
sage: Fraction
<class 'fractions.Fraction'>
sage: Fraction(2,3)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-9755b3988eff> in <module>()
----> 1 Fraction(Integer(2),Integer(3))
/sage8.0/SageMath/local/lib/python2.7/fractions.pyc in __new__(cls, numerator, denominator)
152 isinstance(denominator, Rational)):
153 numerator, denominator = (
--> 154 numerator.numerator * denominator.denominator,
155 denominator.numerator * numerator.denominator
156 )
TypeError: unsupported operand type(s) for *: 'builtin_function_or_method' and 'builtin_function_or_method'
Any workaround ?candideWed, 22 Nov 2017 03:12:39 -0600http://ask.sagemath.org/question/39717/Random matrix satisfying a given polynomialhttp://ask.sagemath.org/question/39721/random-matrix-satisfying-a-given-polynomial/ If a polynomial f(x) of order n is given, can we find a random square matrix A of order m so that f(A)=0?
I tried to construct it by finding the roots of f(x) and then creating random matrix with those roots as eigenvalues. But the problem occurs when n is not equal to m. I'm unable to set the eigenvalue, dimensions suitably.Deepak SarmaWed, 22 Nov 2017 04:38:13 -0600http://ask.sagemath.org/question/39721/How do I code a Laurent Series with variable coefficients?http://ask.sagemath.org/question/39662/how-do-i-code-a-laurent-series-with-variable-coefficients/Edit: Adding more context.
I am attempting the following procedure:
1. Begin with a polynomial $Z(u)$ with variable coefficients, of the form $1 + a*u + b*u^2 + c*u^3 + p*b*u^4 + p^2*a*u^5 + p^3*u^6$.
2. Examine the coefficients of $Z'(u)/Z(u)$ as a power series in $u$.
It is this quest which leads me to attempt to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across.
I am attempting to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across.
sage: R.<t> = LaurentSeriesRing(QQ, 't')
sage: var('a')
a
sage: f = 1 + a*t
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-31-06d3f2f41e45> in <module>()
----> 1 f = Integer(1) + a*t
sage/structure/element.pyx in sage.structure.element.Element.__mul__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:12443)()
sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)()
TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Laurent Series Ring in t over Rational Field'
I also tried:
sage: R.<u> = QQ[]
sage: var('a')
a
sage: f = 1 + a*u
sage: ff = derivative(f, u)
sage: R.<u> = LaurentSeriesRing(QQ); R
sage: f/ff + O(u^5)
----------------------
TypeError Traceback (most recent call last)
<ipython-input-28-c4846de7ced8> in <module>()
----> 1 f/ff + O(u**Integer(5))
sage/structure/element.pyx in sage.structure.element.Element.__add__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:11198)()
sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)()
TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and 'Laurent Series Ring in u over Rational Field'masseygirlSun, 19 Nov 2017 13:35:21 -0600http://ask.sagemath.org/question/39662/sage script in htmlhttp://ask.sagemath.org/question/39707/sage-script-in-html/ l'm running sage on my android phone. l made simple html file according to manual. Is it possible load *.sage script in html file? for example, <script src="test.sage"><script>kkmiTue, 21 Nov 2017 11:27:48 -0600http://ask.sagemath.org/question/39707/TypeError: unable to simplify to float approximationhttp://ask.sagemath.org/question/39699/typeerror-unable-to-simplify-to-float-approximation/Hi, when I try this code on Sage 8.0:
u = var('u'); D = RealDistribution('gaussian',1); f(u) = D.distribution_function(u)
I get the following error message:
TypeError: unable to simplify to float approximation
What I want is to get the numerical approximation of integral_numerical(f(u), u, a, b), for some fixed values a and b.
Thanks.
FlacoLearnTue, 21 Nov 2017 09:13:55 -0600http://ask.sagemath.org/question/39699/Error when calling the CRT functionhttp://ask.sagemath.org/question/39698/error-when-calling-the-crt-function/I have the following Magma code that I want to rewrite in Sage:
D := 1444451111007492249157225145240924628689936300289032719520989176681391983750\
5026233531541656521516385113467258658058158757413856041226225263754438069945819\
321862869928499936414339298248291015625;
N2tfac := [ 389017, 704969, 912673, 1030301, 1295029, 1442897, 2571353, 3307949,
3869893, 29929, 32761, 37249, 38809, 52441, 54289, 58081, 66049, 72361 ];
signs := [ 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1 ];
vecTau := [Integers()!(Sqrt(-IntegerRing(fac)!D)) : fac in N2tfac];
lst := [(-1)^(Integers()!signs[ind])*vecTau[ind] : ind in [1..#N2tfac]];
tau := CRT(lst, N2tfac);
"tau=",tau;
and when I run it I get the result of `tau= 13374843322841533370163824183368767068675387448700309211897565319967356307\
909512193392966464291429`. But when I rewrite it in Sage as this:
D = 1444451111007492249157225145240924628689936300289032719520989176681391983750\
5026233531541656521516385113467258658058158757413856041226225263754438069945819\
321862869928499936414339298248291015625
N2tfac = [ 389017, 704969, 912673, 1030301, 1295029, 1442897, 2571353, 3307949,
3869893, 29929, 32761, 37249, 38809, 52441, 54289, 58081, 66049, 72361 ]
signs = [ 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1 ]
vecTau = [Zmod(fac)(-D).square_root() for fac in N2tfac]
lst = [(-1)^(signs[ind])*vecTau[ind] for ind in [0..len(N2tfac)-1]]
tau = CRT(lst, N2tfac)
It gives me an error message of:
> TypeError: unsupported operand
> parent(s) for -: 'Ring of integers
> modulo 704969' and 'Ring of integers
> modulo 389017'
Any ideas what the problem might be, and how to solve it? For one thing I know that the `sqrt` function in Magma and Sage does not always return the same square root, can this be the problem? If yes, how to circumvent it, if no, what is causing the error here?whateverTue, 21 Nov 2017 08:11:18 -0600http://ask.sagemath.org/question/39698/Rounding entries of a random vectorhttp://ask.sagemath.org/question/39697/rounding-entries-of-a-random-vector/Hello,
I am trying to generate a random diagonal matrix, defined by a random vector over a field RR. The problem is that I need to round all the values to two decimal places, make entries evenly positive and negative (not necessary of equal amount) and, ideally, avoid zeroes.
I have a code
`[round(4*random()-2,2)for i in[1 .. 8]]`
that produces a list of values that I need of size 8. However, I am struggling to combine it with a command `diagonal_matrix` and insert it there.
Also, I don't really understand why do we need to multiply it by 4 in here
`[round(4*random()-2,2)for i in[1 .. 8]]`
and why it produces negative values only, if I multiply it by 2 instead of 4. Could someone explain it please?
Is there any other simpler and more elegant way to solve this problem? Thank you.XeniaTue, 21 Nov 2017 07:53:11 -0600http://ask.sagemath.org/question/39697/Plotting a frequency chart from a set of valueshttp://ask.sagemath.org/question/39677/plotting-a-frequency-chart-from-a-set-of-values/Hello,
I have got a list of results from my function already. And now, I need to visualise this information and plot a chart of how many times each particular value is repeated in a list. I know how to do a histogram, but it shows intervals of values, but not specific values. I need to access all the values afterwards as well and be able to work with them.
----------
I have found also that I can count values using a command "count"
`list.count()` if it is necessary to do it like this in my problem.
I'd like to ask what is the code for such frequency chart (or plot of points)? And how do I need to define my variables?
Would be much appreciated if someone could help in any way. Thank you very much.
XeniaXeniaMon, 20 Nov 2017 12:12:52 -0600http://ask.sagemath.org/question/39677/Variable matriceshttp://ask.sagemath.org/question/39687/variable-matrices/ If I type M = matrix(SR, 2, var('a,b,c,d')); show(~M), it gives me the inverse of the matrix M with entries in terms of a,b,c,d. Now what I want is to set four variable matrices A,B,C,D each of size 2x2 and then I want to create the block matrix N=block_matrix([[A, B], [C, D]]). Finally I want some functions of N in terms of A,B,C,D (say det(N)).Deepak SarmaMon, 20 Nov 2017 23:01:49 -0600http://ask.sagemath.org/question/39687/Factorization sequence to enumerated sequence in Sagehttp://ask.sagemath.org/question/39678/factorization-sequence-to-enumerated-sequence-in-sage/I have the following Magma code that I want to rewrite in Sage:
Eltseq(Random(FiniteField(2^8)));
This basically produces the following result: `[ 0, 1, 0, 1, 1, 1, 0, 1 ]`. The function `Eltseq` is defined as this in the documentation (https://magma.maths.usyd.edu.au/magma/handbook/text/166):
> Given a factorization sequence f,
> create the enumerated sequence
> containing the same pairs of primes
> and exponents.
Any ideas how can I rewrite this line in Sage?whateverMon, 20 Nov 2017 12:22:19 -0600http://ask.sagemath.org/question/39678/how to avoid error " OverflowError: Python int too large to convert to C longhttp://ask.sagemath.org/question/39554/how-to-avoid-error-overflowerror-python-int-too-large-to-convert-to-c-long/Here is the code:
import time
p=101135929216614342638630785939670479796699743028362954839791101900457831250749
#p=115792089210356248762697446949407573530086143415290314195533631308867097853951
A=-3#4451685225093714772084598273548424
B=1#2061118396808653202902996166388514
K.<a>=GF(p^2);K.modulus()
#R.<z>=PolynomialRing(K);
R.<z> = PolynomialRing( K, sparse=True )
x= (33711976405538114212876928646556826598899914342787651613263700633485943750250*a + 67423952811076228425753857293113653197799828685575303226527401266971887500500)*z^101135929216614342638630785939670479796699743028362954839791101900457831250749 + (67423952811076228425753857293113653197799828685575303226527401266971887500499*a + 33711976405538114212876928646556826598899914342787651613263700633485943750250)*z
y= (67423952811076228425753857293113653197799828685575303226527401266971887500500*a + 33711976405538114212876928646556826598899914342787651613263700633485943750250)*z^101135929216614342638630785939670479796699743028362954839791101900457831250749 + (33711976405538114212876928646556826598899914342787651613263700633485943750249*a + 67423952811076228425753857293113653197799828685575303226527401266971887500499)*z
f=(11237325468512704737625642882185608866299971447595883871087900211161981250083*a + 56186627342563523688128214410928044331499857237979419355439501055809906250416)*z^303407787649843027915892357819011439390099229085088864519373305701373493752247 + (67423952811076228425753857293113653197799828685575303226527401266971887500499*a + 33711976405538114212876928646556826598899914342787651613263700633485943750249)*z^202271858433228685277261571879340959593399486056725909679582203800915662501499 + 67423952811076228425753857293113653197799828685575303226527401266971887500499*z^202271858433228685277261571879340959593399486056725909679582203800915662501498 + (33711976405538114212876928646556826598899914342787651613263700633485943750250*a + 67423952811076228425753857293113653197799828685575303226527401266971887500499)*z^101135929216614342638630785939670479796699743028362954839791101900457831250751 + 67423952811076228425753857293113653197799828685575303226527401266971887500500*z^101135929216614342638630785939670479796699743028362954839791101900457831250750 + (a + 2)*z^101135929216614342638630785939670479796699743028362954839791101900457831250749 + (89898603748101637901005143057484870930399771580767070968703201689295850000666*a + 44949301874050818950502571528742435465199885790383535484351600844647925000333)*z^3 + 67423952811076228425753857293113653197799828685575303226527401266971887500499*z^2 + (101135929216614342638630785939670479796699743028362954839791101900457831250748*a + 1)*z + 101135929216614342638630785939670479796699743028362954839791101900457831250748
print"\n Elliptic Curve fE(z) = ",f
#fE11 = fE.coefficients();fE11
start = time.time()
E = EllipticCurve(GF(p),[0,0,0,A,B]);
#print"EC=",E
#print (E.points()[:4])
#print "\n Take Two point on Elliptic curve "
P = E.random_point()#[2];E(0,2)
print"\n point1=",P # select Random point P on elliptic Curve
Q =E.random_point()#[4]; E(4,2)
print"\n point2=",Q
# P= E(59708,90244);P
# Q= E(108685,5812);Q
R1=P+Q;
print"\n Addition of two points Existing Approach (P+Q) =",R1
if((P[0]!=Q[0]) and (P[1]!=Q[1]) or (P[0]!=Q[0]) and (P[1]==Q[1])):
R.<z> = PolynomialRing( K, sparse=True )
**g=(((Q[0]-P[0])*y)-((Q[1]-P[1])*x)-(P[1]*Q[0]-Q[1]*P[0])) ;g**#**error obtained at this point**
f1=( f % g ).monic()
print "\n gcd=",f1
#R2=fL.quo_rem(f1);R2
#R3=fE.quo_rem(f1);R3
f2= (z-P[0]-P[1]*a)*(z-Q[0]-Q[1]*a);
print "\n point equation=",f2
f3=f1//f2;
print "\n f3=",f3;
new4 = f3.coefficients();new4
Result=new4[0];Result
#R15=K(-Result);R15
F.<a>=GF(p)
R.<a>=PolynomialRing(F);
R1.<z>=PolynomialRing(R);
f=Result
M=R(f).coefficients();#M
M1= M[1];#M1
M4=M[0];#M4
M2=F(-M4);#M2
M3=F(-M4)
R=(M2*a+M[1]);#R
R1=(M2,M1);#R1
#load("example.sage")
G = E.point((R1));#G
print "\n Addition of two points New Approach(P+Q)=" ,G
end = time.time()
print("the time taken for the existing approach is given by ", end - start)santoshiTue, 14 Nov 2017 22:12:10 -0600http://ask.sagemath.org/question/39554/Scatter search optimisationhttp://ask.sagemath.org/question/39655/scatter-search-optimisation/Hi all,
Does Sage offer something similar to the scatter search algorithms (Global Optimisation Toolbox) in Matlab? I looked through Sage documentation and through this forum but couldn't find a comprehensive answer.
Bit of background: I have a model with 6 parameters that together govern two probability distributions, looking to minimise error between calculated output and a target consisting of 4 variables. The probability distribution interacts with 1,000 - 100,000 data points to give a yes/no decision for each so they can be included/excluded in a sub-sample of data.
Excel (Evolutionary Solver) runs this in 1 - 24hr (admittedly on a 64Gb ram/12 core work station) so understandably I would like to speed this up. Python looks a sensible way to go, which brought me to Sage, but I got stuck trying to find out what optimisation algorithms are available.
SloopJohnBSat, 18 Nov 2017 16:46:44 -0600http://ask.sagemath.org/question/39655/Inconsistent result between Sage and Magma for sqrthttp://ask.sagemath.org/question/39670/inconsistent-result-between-sage-and-magma-for-sqrt/I have the following Magma code:
N2t := 625;
D := 84100;
tau:= Sqrt(-IntegerRing(N2t)!D);
tau
It basically creates a ring of integers modulo 625, evaluated it for the value of `D` with negation, and finally applies a square root calculation. Now, the result produced is `280`. When, I convert the code to Sage such as this:
N2t = 625
D = 84100
Z = Integers(N2t)
tau = sqrt(-Z(D))
tau
I get a result of `30`. Any ideas why this is the case?whateverMon, 20 Nov 2017 08:57:39 -0600http://ask.sagemath.org/question/39670/Version 7.5.1 for Windowshttp://ask.sagemath.org/question/36964/version-751-for-windows/ I have been looking forward to this version ever since it was announced. When will it be available? The latest version available is 7.4
Thank yourobertjb20Thu, 16 Mar 2017 08:01:40 -0500http://ask.sagemath.org/question/36964/What to do to save a plot from notebook?http://ask.sagemath.org/question/39624/what-to-do-to-save-a-plot-from-notebook/Is it possible to export a plot, preferable in a vector format from a notebook?boosterFri, 17 Nov 2017 02:24:37 -0600http://ask.sagemath.org/question/39624/Lattices in Sagehttp://ask.sagemath.org/question/39542/lattices-in-sage/I have the following Magma code, and I want to rewrite it in Sage.
L:=Lattice(Matrix(Rationals(),2,2,[N2t,0,tau,1]), Matrix(Rationals(),2,2,[1,0,0,D]));
"Lattice:\n",L;
"\nBasis matrix:\n",LLLBasisMatrix(L);
In Sage I have something like this:
M = Matrix(QQ, [(N2t,0,tau,1), (1,0,0,D)])
M.LLL()
Whose output is not exactly the same thing produced by the above Magma code. I think the main problem is that I use a matrix and just apply the LLL algorithm to it in the Sage part. Whereas, in Magma there a lattice created, and then the `LLLBasisMatrix` function (https://magma.maths.usyd.edu.au/magma/handbook/text/312#2964) called. Roughly speaking that function does this:
> Given a lattice L with basis matrix B,
> return the LLL basis matrix B' of L,
> together with the transformation
> matrix T such that B'=TB. The LLL
> basis matrix B' is simply defined to
> be a LLL-reduced form of B; it is
> stored in L when computed and
> subsequently used internally by many
> lattice functions. The LLL basis
> matrix will be created automatically
> internally as needed with δ=0.999 by
> default (note that this is different
> from the usual default of 0.75); by
> the use of parameters to this function
> one can ensure that the LLL basis
> matrix is created in a way which is
> different to the default.
How does one create a lattice in Sage? And does Sage have a function similar to `LLLBasisMatrix` above? If not, how can I achieve the same functionality in Sage?
As for numeric example, I have the following values:
N2t = 1136868377216160297393798828125
D = 53364935730486508893809772233249725927747397616650814998641
tau = 954690521650617175389887577728
and if I call the above Magma code with these values, I get the following result for the basis matrix:
[-182177855565543122003911250397 1]
[ 772512666085074053385976327331 2]
whereas if I call the above Sage code with the above values, I get the following result:
[1136868377216160297393798828125 0 954690521650617175389887577728 1]
[1 0 0 53364935730486508893809772233249725927747397616650814998641]whateverTue, 14 Nov 2017 09:44:25 -0600http://ask.sagemath.org/question/39542/Substitution of subexpressionhttp://ask.sagemath.org/question/39659/substitution-of-subexpression/Hi! My task is to derive some expression and then find subexpressions in it and substitute. In details I need to find derivative of psi and then substitute expressions back. The way I found this derivative looks ugly but I suppose it's easier to do substitution in such form of expression.
var('x, y, t, a, w, alpha, beta')
assume(w > 0)
assume(a > 0)
assume(x, y, t, 'real')
x1 = x*cos(w*t) + y*sin(w*t)
y1 = y*cos(w*t) - x*sin(w*t)
psi10 = 2/a * sin(2*pi/a*x2) * sin(pi/a*y2)
psi01 = 2/a * sin(pi/a*x2) * sin(2*pi/a*y2)
psi = alpha*psi10 + beta*psi01
psi_der = psi.diff(x2)*x1.diff(t) + psi.diff(y2)*y1.diff(t)
psi_der
$-2{\left(w x \cos\left(t w\right) + w y \sin\left(t w\right)\right)} {\left(\frac{\pi \alpha \cos\left(\frac{\pi y_{2}}{a}\right) \sin\left(\frac{2 \pi x_{2}}{a}\right)}{a^{2}} + \frac{2 \pi \beta \cos\left(\frac{2 \pi y_{2}}{a}\right) \sin\left(\frac{\pi x_{2}}{a}\right)}{a^{2}}\right)}+$
$+2{\left(w y \cos\left(t w\right) - w x \sin\left(t w\right)\right)} {\left(\frac{\pi \beta \cos\left(\frac{\pi x_{2}}{a}\right) \sin\left(\frac{2 \pi y_{2}}{a}\right)}{a^{2}} + \frac{2 \pi \alpha \cos\left(\frac{2\pi x_{2}}{a}\right) \sin\left(\frac{\pi y_{2}}{a}\right)}{a^{2}}\right)}$
Then I need to substitute x*cos(w*t) + y*sin(w*t) to x2 and y*cos(w*t) - x*sin(w*t) to y2 for further integration over x2 and y2.
Unfortunately, I didn't understand how to do this except that I need to use wild cards. So
w0 = SR.wild(0)
w1 = SR.wild(1)
pattern = x1*w0 + w1*y1
pattern
$\$0 {\left(x \cos\left(t w\right) + y \sin\left(t w\right)\right)} + \$1 {\left(y \cos\left(t w\right) - x \sin\left(t w\right)\right)}$
which is looks pretty the same but somehow don't match:
print psi_der.match(pattern)
gives None.
Could someone explain what is going on or maybe I should use something else?wobbuuuSun, 19 Nov 2017 04:46:08 -0600http://ask.sagemath.org/question/39659/elliptic curve over extension fieldhttp://ask.sagemath.org/question/39628/elliptic-curve-over-extension-field/ how to define elliptic curve over extension field GF(2^113) in sagemath
the equation is
y^2+xy=x^3+ax^2+b over F2^m
where
a=984342157317881800509153672175863
b=4720643197658441292834747278018339
santoshiFri, 17 Nov 2017 02:46:10 -0600http://ask.sagemath.org/question/39628/extraction of principal submatriceshttp://ask.sagemath.org/question/39645/extraction-of-principal-submatrices/ How to extract all principal submatrices of fixed order say k from a given square matrix of order n by n. please explain with one exampleASat, 18 Nov 2017 06:15:01 -0600http://ask.sagemath.org/question/39645/summation of matriceshttp://ask.sagemath.org/question/39638/summation-of-matrices/ Can we use sum function to add a number of matrices? If not, then how to add a number of matrices with just a single command. Suppose I want to create 10 random matrices of order 5x5 and then want their sum as a result. I tried the following command, but it didn't work.
A_{i}=random_matrix(ZZ,5,5) for i in range(1,10);
sum(A_{i}, i, 1, 10)
Note: I even could not generate 10 random matrices with the above command.
Deepak SarmaFri, 17 Nov 2017 05:15:03 -0600http://ask.sagemath.org/question/39638/Convert exponential form to hyperbolic functionshttp://ask.sagemath.org/question/39602/convert-exponential-form-to-hyperbolic-functions/Is there a method to convert expression containing exponentials like (e^a + e^-a) / 2 to hyperbolic functions?
I tried to even call maxima functions directly, but thinks like
`
cosh(a)._maxima_().exponentialize().demoivre()
`
still don't give me `cosh(a)` back but instead return the form in exponentials.TobiasDThu, 16 Nov 2017 06:49:23 -0600http://ask.sagemath.org/question/39602/How is the proper form to calculate the propagation errorhttp://ask.sagemath.org/question/39618/how-is-the-proper-form-to-calculate-the-propagation-error/ Hello, my function is;
alpha = (i1.g2/(i2.g1)-1)/(t1-t2)
I will have to measure i1, i2, g1, g2, t1 and t2 them
How is the proper way to calculate the propagation error for alphaAndresThu, 16 Nov 2017 16:57:53 -0600http://ask.sagemath.org/question/39618/Polynomial Mod Idealhttp://ask.sagemath.org/question/39593/polynomial-mod-ideal/I have a polynomial $R\in\mathbb{Z}[x]$.
I then define $R' = \frac{d}{dx}R$, and look at the splitting field of $R'$, $K$, an algebraic number field.
Now, I want to find a prime ideal $\mathfrak{p}$ of $L$ of absolute degree 1 such that $R\mod\mathfrak{p}$ is irreducible.
To do this, I've set up:
p0, n = 5, 7
L = PolynomialRing(ZZ,'x')
R = L(x^n-p0^(n-1)x+p0)
Rprime = L(n*x^(n-1)-p0^(n-1))
K = NumberField(Rprime, 'z')
for P in K.primes_of_degree_one_iter():
<stuff>
I'm now trying ti find the right thing to do for <stuff>. Namely, how can I reduce the polynomial R with respect to the ideal P?orangejakeThu, 16 Nov 2017 00:23:54 -0600http://ask.sagemath.org/question/39593/command to get eigenvalueshttp://ask.sagemath.org/question/39621/command-to-get-eigenvalues/ If a matrix is given for heigher order ..i want to know how to get eigen values by sage.RajniThu, 16 Nov 2017 22:23:02 -0600http://ask.sagemath.org/question/39621/how to find eigen values of a matrixhttp://ask.sagemath.org/question/39620/how-to-find-eigen-values-of-a-matrix/ If a matrix is given. How a can find its eigen valuesRajniThu, 16 Nov 2017 18:38:47 -0600http://ask.sagemath.org/question/39620/how to find eigen values of a matrixhttp://ask.sagemath.org/question/39619/how-to-find-eigen-values-of-a-matrix/ If a matrix is given. How a can fins its eigen valuesRajniThu, 16 Nov 2017 18:37:49 -0600http://ask.sagemath.org/question/39619/How to defining a twist on an elliptic curvehttp://ask.sagemath.org/question/39597/how-to-defining-a-twist-on-an-elliptic-curve/Hey,
I would like to do map points of the ellitptic curve $E(\mathbb F_{p^{k}})$ to its twist. I am able to define the twist on a mathematical way, but it returns always errors. I will give you a M(n)WE:
Aim: Get a generator of a r-torsion subgroup of E, lift that to E16 and twist it down to E4, to get a r-torsion subgroup-generator of E4.
#MWE
## Mathematical definition:
$E(\mathbb F_{p^{16}}): y^2=x^3+x$ and its quartic twist $E'(\mathbb F_{p^4}): y^2=x^3+2^{-1/4}x$. The point mapping is defined as $\psi: E\to E', (x,y,z)\mapsto (2^{-1/2}x, 2^{-3/4}y, z)$.
## Define the fields and curves
p= 13
r=5
R=GF(p)
_.<x> = PolynomialRing(R)
R4.<x> = R.extension(x^4 - 2, 'x')
_.<y> = PolynomialRing(R)
R16.<y> = R.extension(y^16 -2, 'y')
_.<z> = PolynomialRing(R4)
R16_over_R4.<z> = R4.extension(z^4-x, 'z')
E = EllipticCurve(R, [1,0]) # y^2 = x^3+x
E4 = EllipticCurve(R4, [x,0])
E16 = EllipticCurve(R16, [1,0])
## Defining the point and pre-computations
k= ZZ(E.order()/r) # since E.order()*P = (0:1:0), we can trick with that
b=R16(2^(-1)); b= sqrt(sqrt(2)) #the twisting parameter, that is a square in R4 and R16
P= E.gens()[0]
Q=k*P # check if Q != E((0,1,0)), if yes its a r-torsion point.
Q16 = E16(Q) #raise Q
## The not working twist
#twist
E4( (Q16[0]*b^2, Q16[1]*b^3))
Sage is able to compute the quartic twist of its own, but I do not recieve the right twist, that I had computed by hand ( $E'$ ). Using
E4.quartic_twist(v^-1)ShalecThu, 16 Nov 2017 04:43:57 -0600http://ask.sagemath.org/question/39597/