Basic vector operations
In this module we will learn how to define vectors, and do basic arithmetic operations with them, including:- vector addition
- scalar multipication
- dot products
- cross products
- triple products
How to define vectors
(0, 4) (3, -1) (2, -1, -4)
The implementation of vector addition and scalar multipication
is very natural and intuiutive in sage. See the following example.
(3, 3)
(-1, 1, -3)
(-6, 14)
(-9, 6, 3)
Here is how to see vector addition graphically:
3D rendering not yet implemented
Exercise 1:
Do these problems from Sec.9.2 of our textbook:
16, 18, 27.
For 16 and 18, also include a graph showing , and .
For 27, show a graph of the relevant vector addition, together with
the algebraic form of the answer.
NOTE: Although you can write your own code to find the absolute value
of your vectors, the abs() function
in sage does the right thing with vectors as well.
The implementation of dot products uses the function
dot_product as shown
in the following example.
a.b= -4
c.d= -12
a.b= -4
c.d= -12
You can also do vector operations when you have parameters
or variables as your vector components.
a+b = (-t + e^t, 3*t - e^t, 2*t + 2*e^t)
a.b = 0
3a-2b = (-3*t - 2*e^t, 9*t + 2*e^t, 6*t - 4*e^t)
Exercise 2:
Do these problems from Sec.9.3 of our textbook:
18, 23, 45.
For 23, also include a graph showing the triangle in 3D.
The implementation of cross products uses the function
cross_product
Note that you must define 2D vectors with 3 components for
cross_product to work right.
a x b= (0, 0, -12)
c x d= (7, 10, 1)
3D rendering not yet implemented
a.(b x c) = 12
a x (b x c) = (12, -6, 36)
a.(b x c) = 12
b.(c x a) = 12
c.(a x b) = 12
Exercise 3:
Do these problems from Sec.9.4 of our textbook:
28, 32.
For 32, also include a graph showing the vectors you used
to check for coplanarity.