Table of Contents

## Vector Algebra Concepts

Vector algebra is the study of the mathematical properties of vectors. A vector is a quantity that has both magnitude and direction. Vectors can be represented in mathematical notation using an arrow over a letter. For example,

The vector represents a displacement vector from the origin of the coordinate system to the point (3, 2). The vector has a magnitude of 5 and points in the direction of the positive y-axis.

Vector addition is the process of adding two or more vectors together. Vectors can be added graphically by drawing them in the same coordinate system and connecting the tails with an arrow. The resultant vector is the vector sum of the individual vectors.

Vector subtraction is the process of subtracting one vector from another. Vectors can be subtracted graphically by drawing them in the same coordinate system and connecting the heads with an arrow. The resultant vector is the vector difference of the individual vectors.

Vector multiplication is the process of multiplying two vectors together. Vectors can be multiplied graphically by drawing them in the same coordinate system and connecting the tips of the arrows. The resultant vector is the vector product of the individual vectors.

## Position Vector

A position vector is a mathematical object that represents the position of a point in space. The position vector has a magnitude, which is the distance from the point to the origin, and a direction, which is the direction of the point relative to the origin. The position vector can be represented using a Cartesian coordinate system, in which the magnitude is the x-coordinate and the direction is the y-coordinate.

## Explain in Detail :

The following code is an example of a recursive function.

def factorial(n: Int) = if (n <= 0) ,0 else n * factorial(n-1)

The function calculates the factorial of a number. The factorial of a number is the product of all the numbers from 1 to that number. For example, the factorial of 5 is 120.

The function is recursive. This means that it calls itself. The function starts by checking to see if the number is less than or equal to 0. If it is, then the function returns 0. If the number is not less than or equal to 0, then the function returns the product of the number and the factorial of the number minus 1.