# Please do not post homework
# Omar Aceval Garcia, 1/26/2025, Assignment 1
# Exercise 1.1 from Quantum Mechanics
# a)
# We with to show that { = +
# From our second axiom = * we rewrite the LHS as + |B>}*
# Which distributes by the first axiom to * + * and the result follows by applying the second axiom.
# b)
# This follows by noting that = * i.e. this is a complex number equal to its conjugate, hence it must be real.
# Exercise 1.2 from Quantum Mechanics (why)
# Let = (a1 .. aN)^T and |B> = (b1 .. bN)^T
# First axiom
# Here, * denotes conjugation and c1*a1 will refer to c1* times a1 and \cdot will refer to inner product of row/column vectors
# Then + |B>} = (c1* .. cN*)\cdot (a1+b1 .. aN + bN)^T which equals c1(a1+b1) + .. + cN(aN + bN)
# By math this is (c1a1 + .. + cNaN) + (c1b1 + .. cNbN)
# Second axiom
# by defition is c1*b1 + .. cN*bN. The conjugate of this is c1b1* + .. cNbN*, which is the same as
# Adjacency matrix problem
AM := proc(G) local i,j,n,e,E, A:
n := G[1]: E := G[2]:
A := [seq([seq(0, j=1..n)] , i=1..n)]:
for e in E do
A[e[1]][e[2]] := 1:
A[e[2]][e[1]] := 1:
od:
return A:
end:
# Image problem, or permutation problem.
# I'm a maple novice. I am assuming that pi(i) would denote the image of the number i under the permutation pi.
# and that pi is a bijection from {1 .. n} to itself
Image := proc(pi, G) local e, Img:
Img := [G[1], {}]:
for e in G[2] do
Img[2]:= Img[2] union {{pi(e[1]), pi(e[2])}}:
od:
return Img:
end:
# Unlisted Graphs problem:
# I'm late in submitting this so I'm just going to assume I have some fast code for checking if graphs G, H are isomorphic
# I'll call it IfIso(G, H), which returns True or False.
# Update: my sources are telling me this is a big assumption, in the sense that if I had some code for that I would probably want to change it to "OK to post my homework" to show off
ULgraphs:= proc(n) local s,S,L,i,j,t, UL:
# We can make computation easier for large n by including the empty set and the complete graph at the start.
UL:= {[n, {}], [n, {seq(seq({i,j}, j=i+1..n), i=1..n)}]}:
S:= Graphs(n) minus UL:
# My approach is to take the first element of S, add it to UL and remove all of its copies from S, and repeat.
while S <> {} do
for s in S do
# S:= S minus {s}:
UL:= UL union {s}:
for t in S do
if IsIso(s, t) then
S:= S minus {t}:
fi:
od:
od:
od:
return UL:
end: