sage: Partitions(100000).cardinality() 2749...
sage: M = BinaryTrees(100) sage: t = M.random_element() sage: view(t, tightpage=True) # not tested
sage: from sage.combinat.species.library import * sage: BT = CombinatorialSpecies(min=1) sage: Leaf = SingletonSpecies() sage: BT.define(Leaf+(BT*BT)) sage: o = var("o") sage: BT.isotypes([o]*5).list() [o*(o*(o*(o*o))), o*(o*((o*o)*o)), o*((o*o)*(o*o)), o*((o*(o*o))*o), o*(((o*o)*o)*o), (o*o)*(o*(o*o)), (o*o)*((o*o)*o), (o*(o*o))*(o*o), ((o*o)*o)*(o*o), (o*(o*(o*o)))*o, (o*((o*o)*o))*o, ((o*o)*(o*o))*o, ((o*(o*o))*o)*o, (((o*o)*o)*o)*o] sage: S = BT.isotype_generating_series() sage: S z + z^2 + 2*z^3 + 5*z^4 + 14*z^5 + 42*z^6 + 132*z^7 + O(z^8) sage: S[100] 227508830794229349661819540395688853956041682601541047340 sage: S z + z^2 + 2*z^3 + 5*z^4 + 14*z^5 + 42*z^6 + 132*z^7 + O(z^8)
sage: m = WordMorphism('a->acabb,b->bcacacbb,c->baba') sage: m.fixed_point('a') word: acabbbabaacabbbcacacbbbcacacbbbcacacbbac...
sage: A = random_matrix(ZZ,nrows=6,ncols=3,x=7) sage: L = LatticePolytope(A) sage: L.plot3d() Graphics3d Object sage: L.npoints() # should be cardinality! # random 28
This example used PALP and J-mol
sage: show(next(graphs(5, lambda G: G.size() <= 4))) # not tested
sage: data = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] sage: oeis(data) 0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. ... sage: from ore_algebra import guess, OreAlgebra # optional - ore_algebra sage: guess(data, OreAlgebra(ZZ['x'], 'Dx')) # optional - ore_algebra (x^2 + x - 1)*Dx + 2*x + 1 sage: L = _ # optional - ore_algebra sage: x = var('x') # optional - ore_algebra sage: F = function('F')(x) # optional - ore_algebra sage: equation = sum( L[i] * diff(F, x, i) for i in range(L.order()+1) ) # optional - ore_algebra sage: equation # optional - ore_algebra (2*x + 1)*F(x) + (x^2 + x - 1)*D[0](F)(x) sage: solution = desolve(equation, F, ics=[0,1]) # optional - ore_algebra sage: solution # optional - ore_algebra -1/(x^2 + x - 1) sage: solution.series(x) # optional - ore_algebra 1 + 1*x + 2*x^2 + 3*x^3 + 5*x^4 + 8*x^5 + 13*x^6 + 21*x^7 + 34*x^8 + 55*x^9 + 89*x^10 + 144*x^11 + 233*x^12 + 377*x^13 + 610*x^14 + 987*x^15 + 1597*x^16 + 2584*x^17 + 4181*x^18 + 6765*x^19 + Order(x^20) sage: L.rational_solutions() # optional - ore_algebra [(1/(x^2 + x - 1),)] sage: L.generalized_series_solutions(15) # optional - ore_algebra [1 + x + 2*x^2 + 3*x^3 + 5*x^4 + 8*x^5 + 13*x^6 + 21*x^7 + 34*x^8 + 55*x^9 + 89*x^10 + 144*x^11 + 233*x^12 + 377*x^13 + 610*x^14 + O(x^15)] sage: L.generalized_series_solutions(1000) # optional - ore_algebra [1 + x + 2*x^2 + 3*x^3 + 5*x^4 + 8*x^5 + ... + O(x^1000)] sage: L = guess(data, OreAlgebra(ZZ['n'], 'Sn')) # optional - ore_algebra sage: L # optional - ore_algebra -Sn^2 + Sn + 1 sage: L.generalized_series_solutions() # optional - ore_algebra [(1.618033988749895?)^n*(1 + O(n^(-5))), (-0.618033988749895?)^n*(1 + O(n^(-5)))] sage: s = L.generalized_series_solutions()[0] # optional - ore_algebra sage: s.exponential_part() # optional - ore_algebra 1.618033988749895? sage: s.exponential_part().minpoly() # optional - ore_algebra x^2 - x - 1 sage: data = [1, 1, 2, 5, 14] sage: oeis(data) 0: A000108: Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). ... sage: data = _[0].first_terms() sage: data (1, 1, 2, 5, 14, 42, 132, ...) sage: L = guess(data, OreAlgebra(ZZ['x'], 'Dx')) # optional - ore_algebra sage: L # optional - ore_algebra (4*x^2 - x)*Dx^2 + (10*x - 2)*Dx + 2 sage: L.power_series_solutions(10) # optional - ore_algebra [1 + x + 2*x^2 + 5*x^3 + 14*x^4 + 42*x^5 + 132*x^6 + 429*x^7 + 1430*x^8 + O(x^9)] sage: L.power_series_solutions(1000) # optional - ore_algebra [1 + x + 2*x^2 + 5*x^3 + 14*x^4 + 42*x^5 + 132*x^6 + 429*x^7 + ... + O(x^1000)] sage: equation = sum( L[i] * diff(F, x, i) for i in range(L.order()+1) ); equation # optional - ore_algebra 2*(5*x - 1)*D[0](F)(x) + (4*x^2 - x)*D[0, 0](F)(x) + 2*F(x) sage: res = desolve(equation, F) # optional - ore_algebra sage: res # optional - ore_algebra sage: res = res.subs(_K2=I/2, _K1=-1) # optional - ore_algebra sage: res.series(x) # optional - ore_algebra 1 + 1*x + 2*x^2 + 5*x^3 + 14*x^4 + 42*x^5 + 132*x^6 + ... + 1767263190*x^19 + Order(x^20) sage: res.canonicalize_radical() # optional - ore_algebra 1/2*(I*sqrt(4*x - 1) + 1)/x sage: M = guess(data, OreAlgebra(ZZ['n'], 'Sn')) # optional - ore_algebra sage: M # optional - ore_algebra (-n - 2)*Sn + 4*n + 2
Asymptotic expansion:
sage: M.generalized_series_solutions() # optional - ore_algebra [4^n*n^(-3/2)*(1 - 9/8*n^(-1) + 145/128*n^(-2) - 1155/1024*n^(-3) + 36939/32768*n^(-4) + O(n^(-5)))] sage: M.generalized_series_solutions(10) # optional - ore_algebra [4^n*n^(-3/2)*(1 - 9/8*n^(-1) + 145/128*n^(-2) - 1155/1024*n^(-3) + 36939/32768*n^(-4) - 295911/262144*n^(-5) + 4735445/4194304*n^(-6) - 37844235/33554432*n^(-7) + 2421696563/2147483648*n^(-8) - 19402289907/17179869184*n^(-9) + O(n^(-10)))]
sage: S = SymmetricFunctions(QQ) sage: S.inject_shorthands() ...
Arithmetic:
sage: s[2,1] * s[2,1] s[2, 2, 1, 1] + s[2, 2, 2] + s[3, 1, 1, 1] + 2*s[3, 2, 1] + s[3, 3] + s[4, 1, 1] + s[4, 2] sage: p( m[1] * ( e[3]*s[2] + 1 )) p[1] + 1/12*p[1, 1, 1, 1, 1, 1] - 1/6*p[2, 1, 1, 1, 1] - 1/4*p[2, 2, 1, 1] + 1/6*p[3, 1, 1, 1] + 1/6*p[3, 2, 1]
Hopf structure:
sage: s[3,2,1].coproduct() s[] # s[3, 2, 1] + s[1] # s[2, 2, 1] + s[1] # s[3, 1, 1] + s[1] # s[3, 2] + s[1, 1] # s[2, 1, 1] + s[1, 1] # s[2, 2] + s[1, 1] # s[3, 1] + s[1, 1, 1] # s[2, 1] + s[2] # s[2, 1, 1] + s[2] # s[2, 2] + s[2] # s[3, 1] + s[2, 1] # s[1, 1, 1] + 2*s[2, 1] # s[2, 1] + s[2, 1] # s[3] + s[2, 1, 1] # s[1, 1] + s[2, 1, 1] # s[2] + s[2, 2] # s[1, 1] + s[2, 2] # s[2] + s[2, 2, 1] # s[1] + s[3] # s[2, 1] + s[3, 1] # s[1, 1] + s[3, 1] # s[2] + s[3, 1, 1] # s[1] + s[3, 2] # s[1] + s[3, 2, 1] # s[]
Plethysms:
sage: p[3](p[6]) p[18] sage: s[3,2](s[2,1]+p[3]) s[2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1] + ...