Ask Your Question

LAV's profile - activity

2023-10-29 16:42:20 +0200 received badge  Notable Question (source)
2023-10-29 16:42:20 +0200 received badge  Popular Question (source)
2018-05-21 22:53:10 +0200 received badge  Student (source)
2018-03-15 13:36:05 +0200 commented question Factoring out permutations of SN

Thank you, (2) is what I was looking for, but I expected it would not return a list and return an iterator instead. (1) and (4) seems the most appropriate.

2018-03-14 13:52:42 +0200 asked a question Factoring out permutations of SN

I'm trying to remove certain permutations from S_N.

I want to remove all permutations that leave the first [0...k[ indices invariant (except for Identity element). So what I'm looking for is S_{1,.., N} / S_{k, .., N}.

I understand that I could do ( N= 10, k=5 )

SN = SymmetricGroup(range(10))
SkN = SymmetricGroup(range(5,10)
permutations = [sigma for sigma in SN if sigma not in SkN]

but this is extremely slow. My goal here is to speed up my code and I end up generating twice as much permutations and doing extreme list checking.

I'm pretty sure people were smart enough to implement a feature that gives me back a generator Squotient = SN/SkN, but I could not find this in the documentation. Any ideas?

2018-02-08 14:29:11 +0200 commented answer Use Vi keys in sage console

If you don't have the ipython_config.py file, you can create it with > ipython profile create [profilename] in the terminal. It will also populate the file with all possible options including vi mode. (And thank you @Eigentime, it solved it for me)

2018-02-06 14:02:07 +0200 commented answer How to properly declare indeterminates so that they exist in the coefficient ring.

In the end this worked. For future reference, in more general cases I ended up with systems of equations in QQ['alpha, 'a0', 'a1', ...].fraction_field() which produced big expressions that somehow sage was confused about (it tried to expand the fractions as power series instead of factoring and simplifying). Factoring and simplifying did not work since the gcd was not well defined. I ended up sending the system of equation to singular for simplification, then back to sage, converted to symbolic ring, solved, converted the solution back to my ring. It still looks like a crazy workaround to me though, but it does work.

2018-02-01 16:24:05 +0200 received badge  Scholar (source)
2018-02-01 15:50:58 +0200 received badge  Editor (source)
2018-02-01 15:48:50 +0200 asked a question How to properly declare indeterminates so that they exist in the coefficient ring.

I'm working on a project regarding generalization of symmetric polynomials.

For the sake of simplicity, I will ask my question in the context of a minimalistic (not) working example.

Let say I am working with Symmetric Functions, I'll write an erroneous code so that you get the idea of what I'm looking for

QQt = QQ['t'].fraction_field()
Sym = SymmetricFunctions(QQt); Sym.inject_shorthands()

a0 = var('a0')
expr1 = m[1,1]
expr2 = m[2] + a0*m[1,1]

eqsys = expr1.scalar_jack(expr2)
solve(eqsys, a0)

The I get the error unsupported operand parent(s) for *: 'Symbolic Ring' and 'Symmetric Functions over Fraction Field of Univariate Polynomial Ring in alpha over Rational Field in the monomial basis' OK, so I tried this instead

QQt = QQ['t,a0'].fraction_field()
t, a0 = QQt.gens()
Sym = SymmetricFunctions(QQt); Sym.inject_shorthands()
expr1 = m[1,1]
expr2 = m[2] + a0*m[1,1]
eqsys = expr1.scalar_jack(expr2)
solve(eqsys, a0)

a0 is not a valid variable So then I did the following

 sln = solve(SR(eqsys), SR(a0))

and it works. But the probleme is that I can't convert the solution back

QQt(sln)

('cannot convert {!r}/{!r} to an element of {}', {a0: 2/(t + 1)}, 1, Fraction Field of Multivariate Polynomial Ring in t, a0 over Rational Field)

And anyway this last solution does not seem very canonical. How should I proceed? I guess that somehow what I am asking is how to declare a0, a1, ... as symbols element of QQt.

2018-01-11 22:20:19 +0200 asked a question unpacking list in a list

Hi, I'm trying to convert a sympy code to sage.

I have found that the following does not work:

sector1 = [1,2,3]
sector2 = [4,5,6]
newlist = [*sector1, sector2]

even though the unpacking works for functions (ex F(*sector1)).

How do I do that?