/// <summary> /// Multiply a vector by a constant value /// </summary> /// <param name="v">The vector to multiply</param> /// <param name="n">The value to multiply by</param> /// <returns>The resultant vector</returns> public static Vector Times(double n, Vector v) { return v.Times(n); }
public void CanMultiplyVectorByConstant() { // Arrange var v = new Vector(2, 3, 4); // Act var sum_member = v.Times(2); var sum_static = Vector.Times(2,v); var sum_operator = 2 * v; // Assert var result = new Vector(4, 6, 8); Assert.IsTrue(sum_member.Equals(result)); Assert.IsTrue(sum_static.Equals(result)); Assert.IsTrue(sum_operator.Equals(result)); }