Sharedsupport / 2016-10-01-093709-issue78-input.sagewsOpen in CoCalc
Examples for support purposes...
()
0e0973fe-c3a8-46f3-ae6c-a17d5f601b81
print(range(10))
     
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
binomial(34,10)
131128140
binomial(40,var('a'))
binomial(40, a)
G = graphs.PetersenGraph()
show(G)
d3-based renderer not yet implemented
G.chromatic_polynomial()
x^10 - 15*x^9 + 105*x^8 - 455*x^7 + 1353*x^6 - 2861*x^5 + 4275*x^4 - 4305*x^3 + 2606*x^2 - 704*x
version()
'SageMath version 7.3, Release Date: 2016-08-04'
%time
for t in range(10000):
    M1 = Matroid(MatrixSpace(GF(2),8,30).random_element())
    M2 = Matroid(MatrixSpace(GF(2),8,30).random_element())
    X = M1.is_isomorphic(M2)
CPU time: 3.48 s, Wall time: 5.16 s
21100*5
105500
_/3600
1055/36
N(_)
29.3055555555556
M1 = Matroid(field=GF(2), reduced_matrix=[[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1],[1,1,1,1]]).dual()
M1.representation()
[1 0 0 0 1 1 1 0 0 0 1] [0 1 0 0 1 0 0 1 1 0 1] [0 0 1 0 0 1 0 1 0 1 1] [0 0 0 1 0 0 1 0 1 1 1]
list(Subsets([1,2,3],2))
[{1, 2}, {1, 3}, {2, 3}]
M2 = Matroid(field=GF(2), reduced_matrix=[[]])

def universal_template_matroid(k, n):
    """
    Generate the universal matroid conforming to Phi_k, with a n-vertex complete graph, for a total rank of n-1+k.
    """
    num_elts = n * (n-1) / 2 + k + (k+1)*(n-1)
    A = Matrix(GF(2), n-1+k, num_elts)
    i = 0
    # identity in front
    for j in range(n-1):
        A[j+k,j] = 1
    i = n-1
    # all pairs
    for S in Subsets(range(k,n+k-1),2):
        for j in S:
            A[j,i] = 1
        i = i + 1
    # Top-identity from template
    for j in range(k):
        A[j,i] = 1
        i = i + 1
    # rest of template thing
    for p in range(k):
        for j in range(n-1):
            A[p, i] = 1
            A[k+j,i] = 1
            i = i + 1
    for j in range(n-1):
        for p in range(k):
            A[p,i] = 1
        A[k+j,i] = 1
        i = i + 1
    return Matroid(field=GF(2), matrix=A)
universal_template_matroid(2,5)
Binary matroid of rank 6 on 24 elements, type (3, 1)

# Question: is the (2,5) matroid contained in the 4-template?
M1 = universal_template_matroid(2,5)
M2 = universal_template_matroid(4,4)
for e in M2.groundset():
    if (M2 \ e).is_isomorphic(M1):
        print e
        break
    print "Nope"
Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope Nope
M2 = universal_template_matroid(4,5)
M2.size()
34
131000000/200
655000
i = 0
for S in Subsets(range(34),10):
    if i % 700000 == 0:
        print i
    i = i + 1
    if (M2 \ S).is_isomorphic(M1):
        print S
        break
0 700000 1400000 2100000 2800000 3500000 4200000 4900000 5600000 6300000 7000000 7700000 8400000 9100000 9800000 10500000 11200000 11900000 12600000 13300000 14000000 14700000 15400000 16100000 16800000 17500000 18200000 18900000 19600000 20300000 21000000 21700000 22400000 23100000 23800000 24500000 25200000 25900000 26600000 27300000 28000000 28700000 29400000 30100000 30800000 31500000 32200000 32900000 33600000 34300000 35000000 35700000 36400000 37100000 37800000 38500000 39200000 39900000 40600000 41300000 42000000 42700000 43400000 44100000 44800000 45500000 46200000 46900000 47600000 48300000 49000000 49700000 50400000 51100000 51800000 52500000 53200000 53900000 54600000 55300000 56000000 56700000 57400000 58100000 58800000 59500000 60200000 60900000 61600000 62300000 63000000 63700000 64400000 65100000 65800000 66500000 67200000 67900000 68600000 69300000 70000000 70700000 71400000 72100000 72800000 73500000 74200000 74900000 75600000 76300000 77000000 77700000 78400000 79100000 79800000 80500000 81200000 81900000 82600000

This is very important text, ok? 1π\frac{1}{\pi}

Heading 1

Subsection

etc....

G = graphs.RandomGNP(6,0.6)
G.show()
%md
** Lemma A.1 ** _Let $A$ be the following matrix:
\[
\begin{bmatrix}
1 & 1 & 0\\
1 & 0 & 1\\
0 & 1 & 1
\end{bmatrix}.
\]
Then $A$ is pretty._

** Lemma A.1 ** Let AA be the following matrix: [110101011]. \begin{bmatrix} 1 & 1 & 0\\ 1 & 0 & 1\\ 0 & 1 & 1 \end{bmatrix}. Then AA is pretty.


show(integrate(sin(x^pi)))


sin(xπ)dx\displaystyle \int \sin\left(x^{\pi}\right)\,{d x}