Skip to content

Latest commit

 

History

History
97 lines (49 loc) · 2.07 KB

File metadata and controls

97 lines (49 loc) · 2.07 KB

Vector_Calc

Description:

This is a simple vector calculator implemented in Python. It allows users to perform basic vector operations, including vector addition, dot-product, and cross-product. The program prompts users to input the components of vectors and outputs the results of the operations.

Features:

  • Vector Addition: Add two vectors and get the resultant vector.

  • Dot Product: Calculate the dot product of two vectors.

  • Cross Product: Compute the cross product of two vectors.

Code Overview:

The main components of the code include:

Vector Class:

  • Initializes a vector with x, y, and z components.

  • Implements vector addition, dot product, and cross product operations.

  • Provides a string representation of the vector in i,j,k form.

Input Function:

  • Prompts users to enter the components of a vector.

  • Returns a Vector object based on user input.

Main Program Logic:

Accepts input for three vectors from the user.

Displays the results of the vector operations (addition, dot product, and cross product).

How to Use:

Clone the repository to your local machine:

git clone https://github.com/yourusername/Vector_Calc.git

Navigate to the project directory:

cd Vector_Calc

Run the program:

python vector_calculator.py

Follow the prompts to input the vector components and view the results of the operations.

Example Input

Input first vector:

Enter x component:  1

Enter y component:  2

Enter z component:  3

Input second vector:

Enter x component: 4

Enter y component: 5

Enter z component:  6

Input third vector:

Enter x component:  7

Enter y component:  8

Enter z component:  9

Output:

Addition:  Vector(5i + 7j + 9k)

Dot Product:  32

Cross Product:  Vector(-3i + 6j + -3k)

Addition:  Vector(8i + 10j + 12k)

Dot Product:  50

Cross Product:  Vector(-6i + 12j + -6k)

License:

This project is licensed under the MIT License - see the LICENSE file for details.