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, 13 Feb 2019 03:25:35 -0600Compute xgcd over Gaussian integershttp://ask.sagemath.org/question/45441/compute-xgcd-over-gaussian-integers/As you can see below, I can create the ring of [Gaussian integers](https://en.wikipedia.org/wiki/Gaussian_integer) and compute the greatest common divisor of two elements:
sage: ZZ[I]
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
sage: F = ZZ[I].random_element()
sage: G = ZZ[I].random_element()
sage: F
-I - 4
sage: G
-I + 1
sage: gcd(F, G)
1
However, when I try to find $u, v \in \mathbf{Z}[i]$ such that $u\cdot F + v\cdot G = 1$ in $\mathbf{Z}[i]$ (that is, to run the extended GCD), I get the following error:
> sage: xgcd(F, G)
>. . .
> TypeError: Unable to coerce -I - 4 to an integer
Do you know how I can find such $u$ and $v$?Hilder Vítor Lima PereiraWed, 13 Feb 2019 03:25:35 -0600http://ask.sagemath.org/question/45441/Algebra of functions f:Z_3 -> Rhttp://ask.sagemath.org/question/45402/algebra-of-functions-fz_3-r/ I want to create an implementation of an algebra of functions with domain {0,1,2} and range in R. The sum and the product is the usual pointwise sum and product. I have the idea of represent it as a 3 dimensional vectors with the usual sum of vectors, bot I need implement a new product.
The implementation of this algebra will be used for create a polynomial system of equations that I need to solve, so the implementation should be compatible with the procedure indicated in the entry titled *Find algebraic solutions to system of polynomial equations*
If someone have any idea please help me.
Thanks in advance.JulioNAQSat, 09 Feb 2019 15:01:49 -0600http://ask.sagemath.org/question/45402/basis of subspace of complex fieldhttp://ask.sagemath.org/question/45317/basis-of-subspace-of-complex-field/ Hi -
Given a set of elements of `CC`, or perhaps `QQbar`, I want to compute a basis for a subspace over `QQ` that contains those elements.
For example, given $3$, $1+\sqrt{5}$, $i$, and $i-1$, I'd expect my output to be $\\{1, \sqrt{5}, i\\}$, since my original four elements can be written as $(3,0,0)$, $(1,1,0)$, $(0,0,1)$, and $(-1,0,1)$ with respect to that basis.
Obviously, the basis won't be unique.
Can anybody suggest what tools in Sage might be useful for this calculation?BrentBaccalaMon, 04 Feb 2019 14:59:43 -0600http://ask.sagemath.org/question/45317/Compute radical and idempotents of a quotient algebrahttp://ask.sagemath.org/question/10350/compute-radical-and-idempotents-of-a-quotient-algebra/I tried the following:
R.<x,y>=PolynomialRing(QQ,2)
I=Ideal(x^2,y^2)
S=R.quotient(I)
I have the following question:
> I would like to compute with SAGE the Jacobson radical of the algebra S, all primitive orthogonal idempotents and the central idempotents.
Of course, you can compute this by hand, but I am interested in more complicated examples, too (also in matrix algebras), but wanted to start with this simple example.
Since I am relatively new to Sage, I unfortunately do not know how to compute this.
I would be grateful for any help.
BernFri, 12 Jul 2013 03:50:17 -0500http://ask.sagemath.org/question/10350/Extended Sage exampleshttp://ask.sagemath.org/question/45091/extended-sage-examples/I'm trying to learn how to use Sage to do algebraic number theory. I've read the thematic tutorials that seem related, but they are pretty bare-bones. The documentation seems to be pretty much a list of methods; I haven't found a higher-level view of what concepts are implemented and how they can be used. Are there any meatier extended examples that are available? Or is there documentation that I'm missing? (So, for example, how would I go about finding in the documentation the answer to "is the square root of two in the field K that I just defined"?)rogerlThu, 17 Jan 2019 20:33:43 -0600http://ask.sagemath.org/question/45091/Gaussians as Euclidean Domainhttp://ask.sagemath.org/question/44271/gaussians-as-euclidean-domain/Follow up to [a comment](https://ask.sagemath.org/question/44251/making-a-quotient-with-gaussian-elements/?comment=44265#post-id-44265) by @nbruin in a previous question:
> One reason that Euclidean division isn't available by default on ZI is because as far as sage is concerned, it's a quadratic ring, and those generally are not euclidean rings. There are some quadratic rings that are, but most of them are only euclidean with rather obscure euclidean norms. The fact that Z[i] is euclidean with the "standard" norm is really quite anomalous among quadratic rings.
> If you're interested in studying euclidean rings you probably should write some utility functions yourself to help you with it (or search if such utilities are already available). You could even consider writing a new ring subclass for Euclidean rings. To illustrate that sage doesn't know that ZI is a euclidean domain:
sage: ZI in EuclideanDomains()
False
context: `ZI = QuadraticField(-1, 'I').ring_of_integers()`
My question is: Is there a built in way in SageMath to work with Gaussian integers as an Euclidean domain?JsevillamolTue, 13 Nov 2018 10:48:43 -0600http://ask.sagemath.org/question/44271/Substituting a differential equation into an expressionhttp://ask.sagemath.org/question/44136/substituting-a-differential-equation-into-an-expression/ Say I have a (heat) partial differential equation of $f(t,x)$
$$\frac{\partial f}{\partial t}=\frac12\frac{\partial^2 f}{\partial x^2}.$$
I would like to express an algebraic function $g$ of the variable $\Big(\frac{\partial f}{\partial t}, \frac{\partial^2 f}{\partial t\partial x}\Big)$ all in the partial derivatives of $x$. That is
$$\frac{\partial^2 f}{\partial t\partial x}=\frac12\frac{\partial^3 f}{\partial x^3}.$$
The result should be
$$g\Big(\frac{\partial f}{\partial t}, \frac{\partial^2 f}{\partial t\partial x}\Big)=g\Big(\frac12\frac{\partial^2 f}{\partial x^2}, \frac12\frac{\partial^3 f}{\partial x^3}\Big).$$
How can I accomplish this with SageMath?
HansThu, 01 Nov 2018 01:57:04 -0500http://ask.sagemath.org/question/44136/How do I define a homomorphism of a graded commutative algebra?http://ask.sagemath.org/question/44109/how-do-i-define-a-homomorphism-of-a-graded-commutative-algebra/ I am working on implementing morphisms of graded commutative algebras. I have two graded commutative algebra, A with generators <w,x> and B with generators <y,z> . I define H the set of homomorphisms from A to B. Then, I want to define the homomorphisms f such that f(w)=y and f(x)=0 but I get an error:
sage: H = Hom(A,B)
sage: H([y,0])
TypeError: images do not define a valid homomorphism
BelénMon, 29 Oct 2018 04:26:05 -0500http://ask.sagemath.org/question/44109/Help with algebra questionhttp://ask.sagemath.org/question/44003/help-with-algebra-question/Hello i need help
In the following question I need to prove that there is no answer to the equation and what is the reason ?
(a+81)*x=1
I tried to solve this
a+81≠1
a≠-81MariSat, 20 Oct 2018 11:30:36 -0500http://ask.sagemath.org/question/44003/Change binary Operation in Monoid/Semigroup Ringshttp://ask.sagemath.org/question/43958/change-binary-operation-in-monoidsemigroup-rings/I have been experimenting in Semigroup rings and what I’m wondering is whether Sage allows me to define a Set, it’s binary operation, and take its Semigroup Ring via the Set.algebra constructor.
Example would be
S=Set([0,1,2]) #generators
A=S.algebra(RR,Semigroups())
A.product=lambda x,y: x+y
But this does work on the basis elements of A.
I want to modify the way basis elements multiply.ChernoxylMon, 15 Oct 2018 20:36:38 -0500http://ask.sagemath.org/question/43958/substitution of ideal generators of a free algebrahttp://ask.sagemath.org/question/43903/substitution-of-ideal-generators-of-a-free-algebra/I'm trying to map the generators of an ideal $I$ of a free $k$-algebra $A = k \\{ x, y \\}$ to a different free $k$-algebra $B = k \\{ u, v \\}$ (really I'm trying something more complicated, but the failure occurs in even this simplified example). I was attempting to do this via `subs` by creating a dictionary taking $x$ to $u$ and $y$ to $v$, but this is not working.
sage: A.<x, y> = FreeAlgebra(QQ, 2)
sage: I = A*[x*y - y*x - 1]*A
sage: B.<u, v> = FreeAlgebra(QQ, 2)
sage: genMap = {'x':'u', 'y':'v'}
sage: I.gen(0).subs(genMap)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-9d969fff6a4a> in <module>()
----> 1 I.gen(Integer(0)).subs(genMap)
sage/structure/element.pyx in sage.structure.element.Element.subs (build/cythonized/sage/structure/element.c:7572)()
/usr/lib/python2.7/dist-packages/sage/algebras/free_algebra_element.pyc in __call__(self, *x, **kwds)
176 for m, c in six.iteritems(self._monomial_coefficients):
177 if result is None:
--> 178 result = c*m(x)
179 else:
180 result += c*m(x)
sage/rings/rational.pyx in sage.rings.rational.Rational.__mul__ (build/cythonized/sage/rings/rational.c:21325)()
sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:10686)()
TypeError: unsupported operand parent(s) for *: 'Rational Field' and 'Free monoid on 2 generators (x, y)'
This error seems strange to me; is it not understanding elements of $\mathbb{Q}$ and $\\{ x, y \\}$ as elements of $\mathbb{Q} \\{ x, y \\}$? I also tried to do this via a homomorphism $A \to B$ but I could not get this to work, as it seems they are not fully implemented yet for free algebras, from what I could tell. Any help or alternatives would be very appreciated.
**EDIT**: I got a slight work-around, by converting the elements to strings, replacing the variables as characters, and the evaluating the string in the target. However, I feel like this is way more costly than a substitution would be, so I am still interested in a solution.rhoadskjWed, 10 Oct 2018 10:04:18 -0500http://ask.sagemath.org/question/43903/su2 matrix exponentiationhttp://ask.sagemath.org/question/43441/su2-matrix-exponentiation/Hi,
does anyone know if sage math is able to successfully calculate exp(G) where G belongs to su(2) ?
The sagemath commands are given below :
var('phi theta', domain='real')
u = vector([cos(phi)*sin(theta),sin(phi)*sin(theta),cos(theta)])
u.norm().simplify_trig()
sigma_x = matrix([[0,1],[1,0]])
sigma_y = matrix([[0,-i],[i,0]])
sigma_z = matrix([[1,0],[0,-1]])
sigma_x, sigma_y, sigma_z
var('t',domain='real')
G = -i*t*(sigma_x*u[0]+sigma_y*u[1]+sigma_z*u[2])
G.trace(), (G.det()/t**2).simplify_full(), G.is_hermitian()
exp(G)
exp(G) returns the following error code :
> TypeError: ECL says: Error executing
> code in Maxima: Unable to find the
> spectral representation
Thank you for helping.
EpiepimetheusWed, 22 Aug 2018 06:57:53 -0500http://ask.sagemath.org/question/43441/How to implement the free nonassociative algebra?http://ask.sagemath.org/question/42867/how-to-implement-the-free-nonassociative-algebra/ How can I work with nonassociative and noncommutative polynomials over a field (in some prefixed number of variables)? The function FreeAlgebra produces a free associative algebra.Jose BroxMon, 09 Jul 2018 01:28:38 -0500http://ask.sagemath.org/question/42867/Free algebra with involutionhttp://ask.sagemath.org/question/42253/free-algebra-with-involution/ I'd like to implement an involution over a free (associative noncommutative) algebra, i.e., an antiautomorphism of order 2 (linear map such that $f(ab)=f(b)f(a)$ and $f(f(a))=a$), but I don't know where to start. Perhaps we could define the algebra with a double number of generators, every generator x having its involution x1, and then define f from this by correspondence of generators (but I have no knowledge to do this).
More precisely, what I actually want to do is to take the product of the algebra as starting point to define a new product of the form
$$a*b:=af(b).$$Jose BroxThu, 03 May 2018 17:30:23 -0500http://ask.sagemath.org/question/42253/A way of checking that a multivariate system of equations has a solution?http://ask.sagemath.org/question/41913/a-way-of-checking-that-a-multivariate-system-of-equations-has-a-solution/Is there a way to check that a multivariate system of polynomial equations does indeed have a solution(or not)? The context i am using this in is as follows: say i have a system of multivariate polynomial equations over a finite field, i then put values in for some of the variables, and then i need to check if the resulting system in the remaining unassigned variables has a solution or not? If not, then i will reassign different values to the other variables until a system with a solution is yielded. Of course because the assigning of these values is random there is a high chance the system has a solution anyway, but in the event that it does not is where i need a way to check whether a solution exists or not.DalvirSun, 08 Apr 2018 13:40:45 -0500http://ask.sagemath.org/question/41913/Calculations in quotient of a free algebrahttp://ask.sagemath.org/question/41219/calculations-in-quotient-of-a-free-algebra/I want to define (the algebra part of) Sweedler's four-dimensional Hopf algebra, which is freely generated by $x,y$ and subject to the relations
$$
x^2 = 1, \qquad y^2 = 0, \qquad x\cdot y = - y\cdot x~ ,
$$
but I don't see how to do it.
I have tried the following:
sage: A.<x,y> = FreeAlgebra(QQbar)
sage: I = A*[x*x - 1, y*y, x*y + y*x]*A
sage: H.<x,y> = A.quo(I)
sage: H
Quotient of Free Algebra on 2 generators (x, y) over Algebraic Field by the ideal (-1 + x^2, y^2, x*y + y*x)
But then I get
sage: H.one() == H(x*x)
False
So is this currently possibly using a different method?
ThanksJo BeWed, 21 Feb 2018 07:44:18 -0600http://ask.sagemath.org/question/41219/How do you calculate the branch number of a matrix?http://ask.sagemath.org/question/41152/how-do-you-calculate-the-branch-number-of-a-matrix/ Can anyone explain what a branch number is and how to calculate it? I have checked several books on matrices but it seems uncommon. In particular, the matrix:
$$02\quad 03\quad 01\quad 01$$
$$01\quad 02\quad 03\quad 01$$
$$01\quad 01\quad 02\quad 03$$
$$03\quad 01\quad 01\quad 02$$
These entries are hexadecimals (or bytes), e.g. in bits $\{02\}$ is $00000010$, and comes from the Mix column layer in the $AES$ cipher (just in case that makes a difference).
I have read this matrix has the maximum branch number of $n+1 = 5$, but I do not understand where this came from or what it means.
I also read this is an $MDS$ matrix and I think branch numbers and $MDS$ matrices are linked somehow but, again, I don't know how. I have looked for video tutorials on $MDS$ matrices and branch numbers but there is nothing for beginners.
A couple of simple examples for branch numbers and/or $MDS$ matrices would be really helpful.
Redbook1Fri, 16 Feb 2018 07:06:40 -0600http://ask.sagemath.org/question/41152/random matrix with determinant +- 1http://ask.sagemath.org/question/40912/random-matrix-with-determinant-1/ I want to generate a random 4x4 matrix with integer entries and determinant either 1 or -1. I know that you can use
`random_matrix(ZZ,4,4, algorithm = 'unimodular')`
to generate matrices with determinant 1 (so in the special linear group). However, I'm actually more interested in the matrices with determinant -1.
Is there a 'Sage' way to do this? Or are there other functions/routines out there I should look at?
Thanks!
Daniel LWed, 31 Jan 2018 22:15:26 -0600http://ask.sagemath.org/question/40912/Is it possible to write down matrix with variable row.http://ask.sagemath.org/question/40707/is-it-possible-to-write-down-matrix-with-variable-row/ I wish to find out Moore Penrose psudo inverse of a matrix with variable row $4 \times k$ matrix with $k \in \mathbb{N}$ with entries a function of k. Is it possible to write down in SAGE?debarghaSat, 20 Jan 2018 00:52:53 -0600http://ask.sagemath.org/question/40707/Characteristic polynomial wont be used in solvehttp://ask.sagemath.org/question/39746/characteristic-polynomial-wont-be-used-in-solve/ When I try to find roots in a characteristic polynomial it gives me errors:
sage: #Diagonalmatrix
....:
....:
....: A=matrix([[1,-1,2],
....: [-1,1,2],
....: [2,2,-2]])
....: var('x')
....: poly=A.characteristic_polynomial()
....: eq1=solve(poly==0,x)
....:
x
--------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-86-fee7a7de2ea1> in <module>()
7 var('x')
8 poly=A.characteristic_polynomial()
----> 9 eq1=solve(poly==Integer(0),x)
/usr/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
816
817 if not isinstance(f, (list, tuple)):
--> 818 raise TypeError("The first argument must be a symbolic expression or a list of symbolic expressions.")
819
820 if len(f)==1:
TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.
sage:
What can I do in order to use the polynomial in an equation I wish to solve?PoetastropheThu, 23 Nov 2017 11:18:11 -0600http://ask.sagemath.org/question/39746/Exterior algebra errorhttp://ask.sagemath.org/question/39523/exterior-algebra-error/Hi,
I'm new to Sage, and I've been having a lot of trouble constructing a particular algebra. I want to construct the exterior algebra (over $\mathbb{Q}$) on generators $w_{i,j} = w_{j,i}$ where $1 \le i < j \le n$ for some $n$ (for concreteness, say $n = 6$). I want this particular generating set so that I can define an $S_n$ action, but that's the next challenge. I've been attempting the following rough outline:
1. Construct a vector space $V \cong \mathbb{Q}^n$, with basis $\{v_i\}$.
2. Take a tensor product $V \otimes V$, with basis $w_{i,j} = v_i \otimes v_j$.
3. Take a quotient to impose relations $w_{i,i} = 0$ and $w_{i,j} = w_{j,i}$.
4. Take the exterior algebra on the quotient.
Several possible data structures for $V$ (FiniteRankFreeModule, VectorSpace, FreeModule) seem to fail at step 2. Are tensor products implemented for these? The most promising structure, CombinatorialFreeModule, fails at step 4 for an unknown reason. I get an error "base must be a ring or a subcategory of Rings()", even though the base is $\mathbb{Q}$.
Here's the specific code I've tried.
indices = range(1,7)
V = CombinatorialFreeModule(QQ, indices)
V2 = tensor((V,V))
w = V2.basis()
relations = []
for i in indices:
relations.append(w[i,i])
for j in range(i+1,7)
relations.append(w[i,j] - w[j,i])
R = V2.submodule(relations)
V3 = V2.quotient_module(R)
A = ExteriorAlgebra(V3)
The last line gives an error, "base must be a ring or a subcategory of Rings()". The command `V2.base() in Rings()` returns true, but I can't get around the error.
Any help would be appreciated, either in fixing this error or approaching the construction in a different way.Nat MayerMon, 13 Nov 2017 21:57:15 -0600http://ask.sagemath.org/question/39523/tree of vectorshttp://ask.sagemath.org/question/39425/tree-of-vectors/This is a more complicated version of
[apply functions iteratively](https://ask.sagemath.org/question/36159/apply-functions-iteratively-modified-re-post/)
I have a starting "seed" vector, say
`e1 = matrix(4,1,(1,0,0,0))`
Next, I have a collection of 4x4 matrices
`thin_group = [T1,T2,T3,T4,T5]`
where
$T1 = \left(\begin{array}{rrrr}
-1 & 0 & 0 & 0 \\\\
2 & 1 & 0 & 0 \\\\
4 & 0 & 1 & 0 \\\\
4 & 0 & 0 & 1
\end{array}\right), T2 = \left(\begin{array}{rrrr}
1 & 2 & 0 & 0 \\\\
0 & -1 & 0 & 0 \\\\
0 & 4 & 1 & 0 \\\\
0 & 4 & 0 & 1
\end{array}\right), T3 = \left(\begin{array}{rrrr}
1 & 0 & 1 & 0 \\\\
0 & 1 & 1 & 0 \\\\
0 & 0 & -1 & 0 \\\\
0 & 0 & 0 & 1
\end{array}\right), T4 = \left(\begin{array}{rrrr}
1 & 6 & 0 & 6 \\\\
0 & 3 & 0 & 2 \\\\
0 & 4 & 1 & 4 \\\\
0 & -4 & 0 & -3
\end{array}\right), T5 = \left(\begin{array}{rrrr}
3 & 0 & 0 & 2 \\\\
6 & 1 & 0 & 6 \\\\
4 & 0 & 1 & 4 \\\\
-4 & 0 & 0 & -3
\end{array}\right)$
These matrices either fix `e1` or send to a different vector. I have a "height" function, which just measures how large the vector entries are getting.
`def h(X):
return max(abs(X[0,0],abs(X[1,0]), abs(X[2,0]),abs(X[3,0]))`
I want to develop the following procedure:
`hmax = 50`
Begin applying T1,...,T5 to e1. As soon as I get a different vector (T1*e1 = (-1,2,4,4)), measure the height of that vector. If the height is below hmax (h(-1,2,4,4) = 4 < hmax = 50), store that vector somewhere. Now apply another matrix from thin_group to (-1,2,4,4), (but not T1 again). If the new vector has a height below hmax, store it, and apply another matrix from thin_group, just not the previous one. Continue this process until we reach a vector with a height larger than hmax. Once this happens, go back to the previous vector and apply a different matrix from thin_group i.e. go up a different branch of the tree. Go up this branch until hmax is exceeded, then go up a different branch, etc.. Eventually, this process will generate all thin_group images of e1 with hmax < 50. (this is probably about 50,000 vectors)
This procedure should "remember" the vectors that were counted/stored, so I'm thinking that I may be able to index each vector in the tree with a sequence (a1,a2,a3,...,an) where aj=1,2,3,4,5 to denote which matrix T1,...,T5 we applied previously.
Any/all ideas or partial solutions greatly appreciated. Thanks!Daniel LTue, 07 Nov 2017 12:01:32 -0600http://ask.sagemath.org/question/39425/quotient ringhttp://ask.sagemath.org/question/39021/quotient-ring/I need to compute some things in matrices over a quotient ring. My definition of the quotient ring in question is
R.<A,B,C,D>=QQ[]
I=R.ideal(A,B,C,D)
v = 8
S.<a,b,c,d>=R.quotient_ring(I^(v+1))
In particular, I need to quotient out by large (>8 shown above) powers of the ideal **I**. However, I've noticed that in constructing **S**, Sage much generate all of the monomials in the power of **I** which, when v=10, takes quite awhile. Is there any faster/more efficient way to have Sage internally generate **S**. It actually takes longer to construct **S** than it does to perform my computations.
This might just be how it is given I'm working over a polynomial ring with four indeterminates...malikbMon, 02 Oct 2017 15:54:37 -0500http://ask.sagemath.org/question/39021/Finding all admissible ideals with SAGEhttp://ask.sagemath.org/question/38952/finding-all-admissible-ideals-with-sage/Let A=k[x,y,z] for a finite field k and let J=(x,y,z) be the ideal generated by x,y and z. Call an Ideal I of A r-admissible in case $J^r$ is contained in I and I is contained in $J^2$.
Can SAGE find all 4-admissible ideals for a given finite field (lets say with 2,3 or 5 elements for a start)? This is one of the easiest special cases of a more general problem, which is probably too hard and too slow for todays computer. But maybe SAGE can do it in principle? Note that this is a finite problem as it is equivalent to finding all ideals in $A/J^4$ that are contained in $J^2/J^4$, which are all finite rings. (More general it would be more interesting to do the same with A replaced by the non-commutative polynomial ring in x,y,z, which is the quiver algebra with 1 point and 3 loops)sagequstionsSat, 23 Sep 2017 11:29:43 -0500http://ask.sagemath.org/question/38952/Incidence algebras in QPA via SAGEhttp://ask.sagemath.org/question/38895/incidence-algebras-in-qpa-via-sage/This problem needs a little algebraic background. The input is a connected poset and the output should be the data needed to define the incidence algebra of the poset in QPA (a GAP package).
Here the algebraic background:
Given a connected poset P, the incidence algebra (over a feld $K$) is isomorphic to the quiver algebra $KQ/I$ (see https://en.wikipedia.org/wiki/Quiver_(mathematics) for background), where $Q$ is the Hasse quiver of the poset $P$ and $I$ an admissible ideal defined generated by the following relations: $w_1 - w_2$ where $w_1$ and $w_2$ are two paths in the path algebra $KQ$ starting and ending at the same points. The relation more or less mean that we have a commutativity relation at each small "rectangle" (or pentagon etc.) of the Hasse quiver of the algebra. So I is generated by those commutativity relations (of course each "bigger" rectangle then commutes automatically when each smaller rectangle commutes)
How the input should look like so that QPA can understand it and define the incidence algebra:
Q:=Quiver(5,[[1,2,"x12"],[2,4,"x24"],[2,3,"x23"],[4,5,"x45"],[3,5,"x35"]]);kQ:=PathAlgebra(Rationals,Q);AssignGeneratorVariables(kQ);rel:=[x24 * x45-x23 * x35];A:=kQ/rel; (*)
(More than one relation would look like this: rel:=[x24 * x45-x23 * x35, x24 * x45-x23 * x35]; so two relations are separeted by a comma , )
In this example the ouput is the incidence algebra of the poset 7 from the list http://math.chapman.edu/~jipsen/tikzsvg/planar-distributive-lattices15.html (with 1 the lowest element).
I failed to program this in GAP but maybe there is an easy way doing this using SAGE? The advantage could also be to use SAGE to generate all posets on n elements (a thing which GAP can not do) and then calculate the above forms (*) of those posets. Then I would use the data to put it in to GAP and obtain the incidence algebras. (GAP can do things which SAGE probably can not do, like calculate the indecomposable modules in case the algebra has finite representation type)
So to make it clear: The problem is only about getting a poset in SAGE into the form in (*) and then I want to copy this form into GAP (more precisly the GAP package QPA) and continue working there with incidence algebra. While the algebras are isomorphic and just in another form , it is essential to work with QPA and view the indicence algebra as a quiver algebra.
Since this a somewhat harder program probably, I offer a twenty Euro prize money for a quick programm that works to give incidence algebras in SAGE. First quick program wins. Payment via paypal or Ama zon gift card. My motivation is to test some theoretical obtained results.
See page 8 of https://folk.ntnu.no/oyvinso/QPA/manual.pdf for the definition of quiver algebras in QPA for more details.
edit: The code should be able to do two things (the first is more or less a special case of the second):
1. Given a specific poset, the code should give the output in the form (*).
2. Given a set of posets (for example all connected posets on 5 points or similar things), the code should put them in the form (*) but if the set contains n elements the output should enumerate them. For example the output should be in the form (in case the set contains the 2 posets as defined below)
L:=[];
Q1:=Quiver(5,[[1,2,"x12"],[2,4,"x24"],[2,3,"x23"],[4,5,"x45"],[3,5,"x35"]]);kQ1:=PathAlgebra(Rationals,Q1);AssignGeneratorVariables(kQ1);rel1:=[x24 * x45-x23 * x35];L[1]:=[Q1,kQ1/rel1];
Q2:=Quiver(4,[[1,2,"x12"],[2,4,"x24"],[1,3,"x13"],[3,4,"x34"]]);kQ2:=PathAlgebra(Rationals,Q2);AssignGeneratorVariables(kQ2);rel2:=[x12 * x24-x13 * x34];L[2]:=[Q2,kQ2/rel2];
so the empty list L gets filled with entries L[1] and L[2] so at the end we have a list L with the two incidence algebras (together with the underlying Hasse quivers Q1 and Q2)L[1] and L[2] in QPA after having copied the SAGE output into QPA.sagequstionsWed, 20 Sep 2017 16:49:28 -0500http://ask.sagemath.org/question/38895/How to reorder terms in an expression to follow a specific order?http://ask.sagemath.org/question/38472/how-to-reorder-terms-in-an-expression-to-follow-a-specific-order/ Suppose I have the following code:
ti = var('ti', latex_name = 't_i')
yi = var('yi', latex_name = 'y_i')
expr1 = yi -ti
`expr1` will display as $$-{t_i} + {y_i}$$
Is there a way I can rewrite `expr1` so that it will display as:
$$ {y_i} -{t_i}$$
?
I've tried using `hold=True` like so:
expr1 = yi.add(-ti, hold = True)
but that did not work.
ensabaThu, 03 Aug 2017 18:09:07 -0500http://ask.sagemath.org/question/38472/How can I specify a (possibly non-associative) algebra over a finite (small) set of generators by means of structure constants?http://ask.sagemath.org/question/37556/how-can-i-specify-a-possibly-non-associative-algebra-over-a-finite-small-set-of-generators-by-means-of-structure-constants/ I am looking for something similar to the Axiom/FriCAS domain AlgebraGivenByStructuralConstants which implements finite rank algebras over a commutative ring, given by the structural constants with respect to a fixed basis [a1,..,an] or equivalently in terms of generating equations of the form
a_i * a_j = gamma_ij1 * a_1 + ... + gamma_ijn * a_n
where gamma is a vector/list of length n of n by n matrices.
In particular I would like to be able to easily compute various properties of such algebras such as the conditions for idempotents etc. For example:
- http://axiom-wiki.newsynthesis.org/uploads/chapter-8.xhtml#sec-8.14
- http://axiom-wiki.newsynthesis.org/SandBoxObserverAsIdempotent2#eq10Bill Page _ againTue, 09 May 2017 14:09:47 -0500http://ask.sagemath.org/question/37556/Chain of fields in sagehttp://ask.sagemath.org/question/37458/chain-of-fields-in-sage/I would like to construct the field Fp(alpha,beta) where alpha is a root of x^p-x-1 (over Fp[x]) and beta is a root of the polynomial x^p-x-alpha^(p-1) (over Fp(alpha)[x]).
I have tried the following
F0.<x>=GF(p)['x']
f1=x^p-x-1
R1.<alpha1>=F0.quotient(f1)['alpha1']
F1.<x>=Frac(R1)
f2=x^p-x-alpha1^(p-1)
R2.<alpha2>=F1.quotient(f2)['alpha2']
F2.<x>=Frac(R2)
but I think it creates the field F1 well, but it goes wrong for R2... It also feels like there should be a much more straightforward way to do this in sage. What would be the proper way to do this ?gelatine1Fri, 28 Apr 2017 14:46:46 -0500http://ask.sagemath.org/question/37458/how to check algebraic equations?http://ask.sagemath.org/question/37415/how-to-check-algebraic-equations/So, i got a different cubic formula for the depressed equation than that was there in the standard formula from a book.
$y^3+fy+g=0 $ has the solution
$ ({-g+\sqrt {g^2/4+f^3/27} })^{1/3} + ({-g-\sqrt {g^2/4+f^3/27} })^{1/3} $
$
\\left\\{y : -\frac{f}{3 \, {\left(-\frac{1}{2} \, g + \frac{1}{6} \,
\sqrt{\frac{4}{3} \, f^{3} + 9 \, g^{2}}\right)}^{\frac{1}{3}}} +
{\left(-\frac{1}{2} \, g + \frac{1}{6} \, \sqrt{\frac{4}{3} \, f^{3} + 9
\, g^{2}}\right)}^{\frac{1}{3}}\\right\\}
$
So I want to check the algebraic equivalence of these two equations step by step, and how I can convert the first equation into the second, as they are both the same.
This is like checking algebra formulas like $(a+b)^2=a^2+b^2+2ab$
If nothing else, i want to just check True or False, just like with numbers, but equations instead.screened00Tue, 25 Apr 2017 05:36:30 -0500http://ask.sagemath.org/question/37415/How to solve an equation using SageMath?http://ask.sagemath.org/question/37276/how-to-solve-an-equation-using-sagemath/ I have just started using SageMath Cloud, based on a recommendation from a Stack Exchange user. I need to solve the following equation:
298082 = 250000(1 + r) + 25000(1 + r)^((365 - 258)/365)
...which simplifies to:
298082 = 250000(1 + r) + 25000(1 + r)^0.293150685
I go to SageMath Cloud and start a new project and start a new Sage Worksheet, and type the following:
x = var('x')
solve([298082 == (250000 * (1 + r)) + (25000 * (1 + r)^0.293150685)], r)
..and this gives the following:
[r == -1/10*(r + 1)^(11726006/39999927) + 24041/125000]
This is not an acceptable answer. How do I get it to solve the actual value, which is 0.089779615?MrSnrubThu, 13 Apr 2017 08:29:26 -0500http://ask.sagemath.org/question/37276/