Dot and vector products of two vectors u and v can be caluclated using Octave built-in functions dot(u,v) and cross(u,v) respectively.
<sxh c++> disp(“—————————————————————”) disp(“When giving vector coorinates enclose them in [], e.g. [1,23,3]”) disp(“—————————————————————”) u = input(“Give coorinates of vector U in R3 : ”); v = input(“Give coorinates of vector V in R3 : ”); d = dot(u,v); w = cross(u,v); disp(“Euclidean norms of vectors U and V, respectively:”) disp(norm(u)) disp(norm(v)) disp(“Scalar (dot) product of U and V:”) disp(d) disp(“Vector product of U and V:”) disp(w) </sxh> Download the script: dotcross.m