CoCalc Public Filestmp / A0-2-vectorFunctions.ipynb
Authors: Harald Schilly, ℏal Snyder, William A. Stein

# Vector Functions Homework

This file contains four versions of copyVec() and a test function. It also contains stubs for the three vector functions you need to write.

Math 400 2/3/15

In [2]:
m400group = 17   # change this to your group number

m400names = ["student 1", "student 2", "student 3", "student 4"] # change this for your names

def printNames():
print("vecFunctions.py for group {0}".format(m400group)),
for name in m400names:
print("{0}, ".format(name)),
print

printNames()

vecFunctions.py for group 17 student 1, student 2, student 3, student 4,

## Functions for you to finish

In [ ]:
def scalarMult(s,V):
"return vector sV"
return("write scalarMult()")

In [ ]:
def addVectors(S,T):
"return S+T"

In [ ]:
def dot(S,T):
"return dot product of two vectors"
return("write dot()")


### Test Area

In [ ]:
def testVecFunctions():
"test vector function"
S = [1,2,4,5,9]
T = [3,7,-5,2,12]
print("{0} dot {1} = {2}".format(S,T, dot(S,T)))
print("{0} + {1} = {2}".format(S,T, addVectors(S,T)))
print("scalarMult({0},{1})= {2}".format(3,T, scalarMult(3,T)))



Remove the # to uncomment functions to try out your three functions when you are ready.

In [ ]:
#testVecFunctions()


In [ ]: