Splitted the creation of A into two loops, for main diagonal and secondary diagonals. This is more orderly and more general, so that changing V is simpler.
Added the potential in task (c). Now you may choose a potential.