public static int Main() { vector3d v = new vector3d(1, 2, 3); vector3d u = new vector3d(7, 5, 8); v.print("v= "); u.print("u= "); vector3d w = u + v; w.print("w= "); (v * 2).print("2*v= "); vector3d A = v.vector_product(u); A.print("v x u = "); double B = v.dot_product(u); System.Console.Write("v dot u ={0}\n", B); double C = v.magnitude(); System.Console.Write("|v| ={0}\n", C); return(0); }
static void Main() { double c = 4; vector3d u = new vector3d(1, 2, 3); vector3d v = new vector3d(2, -7, 6); u.print("u = "); v.print("v = "); double d = ivector3dfunctions.dot(u, u); WriteLine($"dot(u,u) = {d}"); double e = ivector3dfunctions.dot(u, v); WriteLine($"dot(u,v) = {e}"); double f = ivector3dfunctions.magnitude(u); WriteLine($"|u|= {f}"); vector3d k = ivector3dfunctions.cross(u, u); k.print("cross(u,u) ="); vector3d l = ivector3dfunctions.cross(v, u); l.print("cross(u,v) ="); WriteLine($"4*v = {c*v}"); WriteLine($"u+v = {u+v}"); WriteLine($"v+u = {v+u}"); WriteLine($"u-v = {u-v}"); }
public static int Main() { vector3d v = new vector3d(2, 2, 3); vector3d u = new vector3d(1, 1, 1); vector3d w = vector3d.vp(v, u); w.print(); double a = w.x; double b = w.y; double c = w.z; Write($"{a},{b},{c}\n"); return(0); }
static void Main() { vector3d u = new vector3d(9, 9, 9); vector3d v = new vector3d(1, 2, 3); u.print("vector3d u ="); v.print("vector3d v ="); double d = ivector3dfunctions.dot(u, u); vector3d c = ivector3dfunctions.Cross(u, v); WriteLine($"The dot product of u with u is {d}"); WriteLine($"The cross product og u with v is ({c.x},{c.y},{c.z})"); }
static int Main() { vector3d v = new vector3d(1, 1, 1); vector3d u = new vector3d(0, 2, 4); v.print("v="); u.print("u="); vector3d w1 = u + v; w1.print("u+v="); vector3d w2 = v + u; w2.print("v+u="); vector3d w3 = u - v; w3.print("u-v="); vector3d w4 = v - u; w4.print("v-u="); vector3d w5 = 3 * v; w5.print("3*v="); vector3d w6 = u * 3; w6.print("u*3="); double w7 = vector3d.dot_product(u, v); w7.print("u.v="); vector3d w8 = vector3d.vector_product(u, v); w8.print("uxv="); double magv = vector3d.magnitude(v); magv.print("|v|="); return(0); }
static int Main() { vector3d v = new vector3d(1, 2, 3); vector3d u = new vector3d(5, 4, 3); v.print("v= "); u.print("u= "); (v + u).print("u+v= "); (v - u).print("u-v= "); (2 * v).print("2*v= "); System.Console.Write("v.x = {0}\n", v.x); v.x = 5.0; System.Console.Write("v.x = {0}\n", v.x); System.Console.Write("v@u= {0}\n", v.dot_product(u)); v.vector_product(u).print("v cross u= "); System.Console.Write("|v|= {0}\n", v.magnitude()); return(0); }
public static int Main() { vector3d v = new vector3d(2, 427, -17); vector3d u = new vector3d(351, -379, 1); double c = System.Math.PI; v.print("v="); u.print("u="); (v + u).print("v+u="); (v - u).print("v-u="); double vu = v.dot_product(u); Write($"v.u={vu}\n"); (v.vector_product(u)).print("v x u ="); Write("|v|={0}\n", v.magnitude()); (v * c).print($"v*{c}="); return(0); }
static int Main() { System.Console.Write("Example with vector v:\n"); vector3d v = new vector3d(1.2, 1.5, 2.0); System.Console.Write("v = " + v + "\n"); System.Console.Write("v_x = " + v.x + "\n"); System.Console.Write("Changing v_x to 10 and v_y to 3.\n"); v.x = 10; v.y = 3; System.Console.Write("v_x = " + v.x + "\n"); v.print("v="); System.Console.Write("Defining new vector u:"); vector3d u = new vector3d(2, 5, 7); double a = 2; u.print("u="); System.Console.Write("Calculating 2*u, u+v and cross-product of u and v \n"); vector3d w = u * a; w.print("2*u = "); vector3d q = u + v; q.print("u+v = "); vector3d t = v.vectorProduct(u); t.print("u x v = "); System.Console.Write("Magnitude v = {0:f3}\n", v.magnitude()); return(0); }