Demo entry 6644061

julia-prueba

   

Submitted by anonymous on Oct 01, 2017 at 00:17
Language: Julia. Code size: 3.3 kB.

cuenta = 1
B = zeros((462,6))##Matriz que contendrá la base del hamiltoniano

for i = 1:6 #configuración 6
    c = zeros(6)
    c[i] = 6
    B[cuenta,1:6] = c
    cuenta += 1
end

for i = 1:6 #Configuración 5,1
    for j = 1:6
        c = zeros(6)
        if i != j
            c[i] = 5
            c[j] = 1
            B[cuenta,1:6] = c
            cuenta += 1
        end
    end
end

for i = 1:6 #configuración 4,2
    for j = 1:6
        if i != j
            c = zeros(6)
            c[i] = 4
            c[j] = 2
            B[cuenta,1:6] = c
            cuenta += 1
        end
    end
end

for i = 1:6 #configuración 4,1,1
    for j = 1:6
        for l = 1:j-1
            if (i != j) && (i != l)
                c = zeros(6)
                c[i] = 4
                c[j] = 1
                c[l] = 1
                B[cuenta,1:6] = c
                cuenta += 1
            end
        end
    end
end

for i = 1:6 #configuración 3,3
    for j = 1:6
        if i < j
            c = zeros(6)
            c[i] = 3
            c[j] = 3
            B[cuenta,1:6] = c
            cuenta += 1
        end
    end
end

for i = 1:6 #configuración 3,2,1
    for j = 1:6
        for l = 1:6
             if (j != i) & (l != j) & (l != i)
                c = zeros(6)
                c[i] = 3
                c[j] = 2
                c[l] = 1
                B[cuenta, 1:6] = c
                cuenta += 1
            end
        end
    end
end

for i = 1:6 #configuración 3,1,1,1
    for j = 1:6
        for k = 1:j-1
            for l = 1:k-1
                if (i != j) & (i != k) & (i != l)
                    c = zeros(6)
                    c[i] = 3
                    c[j] = 1
                    c[k] = 1
                    c[l] = 1
                    B[cuenta,1:6] = c
                    cuenta += 1
                end
            end
        end
    end
end

for i = 1:6 #configuración 2,2,2
    for l = 1:i-1
        for j = 1:l-1
            if (i != j) & (i != l) & (j != l)
                c = zeros(6)
                c[i] = 2
                c[j] = 2
                c[l] = 2
                B[cuenta,1:6] = c
                cuenta += 1
            end
        end
    end
end

for i = 1:6 #configuración 2,2,1,1
    for j = 1:i-1
        for k = 1:6
            for l = 1:k-1
                if (i != j) & (i != k) & (i != l) & (j != k) & (j != l) & (k != l)
                    c = zeros(6)
                    c[i] = 2
                    c[j] = 2
                    c[k] = 1
                    c[l] = 1
                    B[cuenta, 1:6] = c
                    cuenta += 1
                end
            end
        end
    end
end

for i = 1:6 #configuración 2,1,1,1,1
    for j = 1:6
        for k = 1:j-1
            for l = 1:k-1
                for m = 1:l-1
                    if (i != j) & (i != k) & (i != l) & (i != m)
                        c = zeros(6)
                        c[i] = 2
                        c[j] = 1
                        c[k] = 1
                        c[l] = 1
                        c[m] = 1
                        B[cuenta,1:6] = c
                        cuenta += 1
                    end
                end
            end
        end
    end
end

c = ones(6)# configuración 1,1,1,1,1,1
B[cuenta, 1:6] = c
cuenta

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).