Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anurag1101/vector_calc

Vector Calculator: A Python-based tool for performing essential vector operations, including addition, dot product, and cross product. Users can input vector components and receive immediate results, making it ideal for learning and practicing vector mathematics.
https://github.com/anurag1101/vector_calc

cross-product dotproduct oops-in-python python python3 vectors

Last synced: about 8 hours ago
JSON representation

Vector Calculator: A Python-based tool for performing essential vector operations, including addition, dot product, and cross product. Users can input vector components and receive immediate results, making it ideal for learning and practicing vector mathematics.

Awesome Lists containing this project

README

        

# 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.