0% found this document useful (0 votes)
7 views11 pages

COMPUTER PROJECT

The document outlines an investigatory project on matrix operations using Python, created by students of PM SHRI Kendriya Vidyalaya NO.1 Saltlake for their AISSCE 2024-25 Computer Science practical exam. It includes acknowledgments, a project certificate, project phases, minimum system requirements, and features of the project, along with Python code for matrix operations. The project aims to assist students in performing various matrix operations and plans to expand its capabilities in the future.

Uploaded by

prarthakyadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views11 pages

COMPUTER PROJECT

The document outlines an investigatory project on matrix operations using Python, created by students of PM SHRI Kendriya Vidyalaya NO.1 Saltlake for their AISSCE 2024-25 Computer Science practical exam. It includes acknowledgments, a project certificate, project phases, minimum system requirements, and features of the project, along with Python code for matrix operations. The project aims to assist students in performing various matrix operations and plans to expand its capabilities in the future.

Uploaded by

prarthakyadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

PM SHRI Kendriya Vidyalaya NO.

1 SALTLAKE

Investigatory
Project
for
AISSCE -2024-25
Computer Science (083)
Practical Exam
Group Information
Group members:
1) Suryava Basu
2) Rhythm Sarkar
3) Prarthak

Class : XII A

Submitted by
SURYAVA BASU
CBSE ROLL NO :

1
ACKNOWLEGEMENT
I would like express my special gratitude
to our Principal Sabiha Shahin, our
teacher cum guide Shri Arbind Kumar jha
and other teachers of the school who
gave me guidance to complete this
project. Also, I am thankful to the various
Internet sites and my school Library from
where I could get instant help whenever I
got stuck in the course of completing the
project.
I consider myself lucky to have such a
wonderful batch of classmates whose
motivation and help made it possible for
me to complete this project within the
given time frame.

2
CERTIFICATE

This is to certify that this investigatory project


work in the subject of Computer Science has
been done by SURYAVA BASU, RHYTHM
SARKAR, AND PRARTHAK of class 12 A in the
academic year 2024-25 for A.I.S.S.C.E. The
student has successfully completed the
project in Computer Science under guidance
of Mr. ARBIND KUMAR JHA as per the syllabus
prescribed by CBSE.

____________________ ____________________
Signature of Internal Signature of External
Examiner Examiner

Principal’s Signature

3
Content / index
SL NO TOPIC Page
1 Acknowledgement 2
2 Certificate 3
1 Introduction 4
Project Phase 6
2 Minimum System 6
Requirement
3 Properties of Matrix 6
5 Feature of the Project 6
4 Python Code 7-9
Output of the Project 9-10
6 Future Scope of the 11
Project
7 Bibliography 11

4
INTRODUCTION
Q. What is Python ?
Ans. Python is an interpreted, high-level and general-purpose programming language. ... It
supports multiple programming paradigms, including structured (particularly, procedural), object-
oriented and functional programming. Python is often described as a "batteries included" language
due to its comprehensive standard library.

Q. What is Matrix ?
Ans. A matrix is a rectangular arrangement of numbers, symbols, or expressions in rows and
columns, enclosed within brackets. It is used in various mathematical and scientific applications,
including linear algebra, transformations, and solving systems of equations. A matrix with rows
and columns is called an matrix and is represented as:

Where each element represents the entry in tith row and jth column.]

Q. What is PySimpleGUI ?
Ans. PySimpleGUI is a Python library for creating simple yet powerful graphical user interfaces
(GUIs). It provides an easy-to-use API that wraps around other GUI frameworks like Tkinter, PyQt,
WxPython, and Remi. PySimpleGUI is designed to make GUI development accessible for beginners
while still being flexible enough for more complex applications.

Q. What is NumPy ?
Ans. NumPy (Numerical Python) is a powerful Python library used for numerical computing. It
provides support for large, multi-dimensional arrays and matrices, along with a collection of
mathematical functions to operate on these data structures efficiently.

5
Project Phases:
1.Importing the required python library.
2.ShortWelcome speech
4.Main program
5.Short Ending speech
6.Printing mini-statement
7.Sending mail to the user who login to the bank
MINIMUM SYSTEM REQUIREMENTS:

Operating System Windows 7


CPU Inter Core i3 5th Gen
RAM DDR4 (4 GB RAM)
Software
Frontend Simple GUI
Backend Python
Hard Drive 1 TB

Feature of the Project:


It can perform basic operation of matrix which are of board level.
There are various opertions such as matrix
addition ,subtraction ,multiplication ,adjoint ,transpose etc which
are of various uses in school level.

6
MATRIX CODE:
import PySimpleGUI as sg
import numpy as np

# Function to create matrix input fields dynamically


def create_matrix_input(name, rows, cols):
layout = [[sg.Text(f"Enter {name} ({rows}x{cols}):")]]
for i in range(rows):
row = [sg.Input(size=(5, 1), key=f"{name}_{i}_{j}") for j in range(cols)]
layout.append(row)
return layout

# Function to extract matrix values from GUI


def get_matrix_values(values, name, rows, cols):
try:
return np.array([[int(values[f"{name}_{i}_{j}"]) for j in range(cols)] for i in
range(rows)])
except ValueError:
sg.popup_error("Invalid input! Enter only numbers.")
return None

# Function to perform matrix operations


def perform_operation(operation, matrixA, matrixB=None, scalar=None):
try:
if operation == "Addition":
return matrixA + matrixB if matrixA.shape == matrixB.shape else "Dimension
mismatch!"
elif operation == "Subtraction":
return matrixA - matrixB if matrixA.shape == matrixB.shape else "Dimension
mismatch!"
elif operation == "Scalar Multiplication":
return scalar * matrixA
elif operation == "Matrix Multiplication":
return np.dot(matrixA, matrixB) if matrixA.shape[1] == matrixB.shape[0] else
"Invalid dimensions!"
elif operation == "Transpose":
return matrixA.T
elif operation == "Determinant":
return round(np.linalg.det(matrixA), 2) if matrixA.shape[0] == matrixA.shape[1]
else "Square matrix required!"
elif operation == "Inverse":
return np.linalg.inv(matrixA) if np.linalg.det(matrixA) != 0 else "Singular
matrix!"
elif operation == "Check Symmetric":
return "Symmetric" if np.array_equal(matrixA, matrixA.T) else "Not Symmetric"
elif operation == "Check Skew-Symmetric":
return "Skew-Symmetric" if np.array_equal(matrixA, -matrixA.T) else "Not Skew-
Symmetric"
else:
return "Invalid Operation"
except Exception as e:
return str(e)

# Step 1: Get matrix dimensions

7
layout1 = [
[sg.Text("Enter Matrix A Dimensions:")],
[sg.Text("Rows: "), sg.Input(size=(5, 1), key="ROWS_A"), sg.Text("Columns: "),
sg.Input(size=(5, 1), key="COLS_A")],
[sg.Text("Enter Matrix B Dimensions (if required):")],
[sg.Text("Rows: "), sg.Input(size=(5, 1), key="ROWS_B"), sg.Text("Columns: "),
sg.Input(size=(5, 1), key="COLS_B")],
[sg.Button("Next"), sg.Button("Exit")]
]

window1 = sg.Window("Matrix Dimensions", layout1)


event, values = window1.read()
window1.close()

if event == "Exit" or event == sg.WINDOW_CLOSED:


exit()

# Parse dimensions
try:
rowsA, colsA = int(values["ROWS_A"]), int(values["COLS_A"])
rowsB, colsB = int(values["ROWS_B"]), int(values["COLS_B"]) if values["ROWS_B"] and
values["COLS_B"] else (None, None)
except ValueError:
sg.popup_error("Invalid dimensions! Please enter numbers.")
exit()

# Step 2: Create matrix input layout


matrixA_layout = create_matrix_input("MatrixA", rowsA, colsA)
matrixB_layout = create_matrix_input("MatrixB", rowsB, colsB) if rowsB and colsB else []
scalar_layout = [[sg.Text("Enter Scalar (for scalar multiplication):")], [sg.Input(size=(5,
1), key="SCALAR")]]
operation_layout = [[sg.Text("Choose an Operation:")],
[sg.Combo(
["Addition", "Subtraction", "Scalar Multiplication", "Matrix
Multiplication",
"Transpose", "Determinant", "Inverse", "Check Symmetric", "Check
Skew-Symmetric"],
key="OPERATION", readonly=True)]]

layout2 = matrixA_layout + ([sg.Text("")] + matrixB_layout if matrixB_layout else []) +


scalar_layout + operation_layout + [
[sg.Button("Calculate"), sg.Button("Exit")],
[sg.Text("Result:", size=(10, 1))],
[sg.Multiline(size=(30, 5), key="RESULT", disabled=True)]
]

window2 = sg.Window("Matrix Operations", layout2)

# Step 3: Perform operations


while True:
event, values = window2.read()

if event == sg.WINDOW_CLOSED or event == "Exit":


break

if event == "Calculate":
matrixA = get_matrix_values(values, "MatrixA", rowsA, colsA)
matrixB = get_matrix_values(values, "MatrixB", rowsB, colsB) if rowsB and colsB
else None
8
scalar = int(values["SCALAR"]) if values["SCALAR"].strip().isdigit() else None
operation = values["OPERATION"]

if matrixA is None:
continue # Skip if invalid input

result = perform_operation(operation, matrixA, matrixB, scalar)

if isinstance(result, np.ndarray): # If result is a matrix


result_text = "\n".join(" ".join(map(str, row)) for row in result)
else:
result_text = str(result)

window2["RESULT"].update(result_text)

window2.close()

OUTPUT:

TAKE DIMENSIONS OF THE MATRIX AS INPUT FROM THE USER

THEN ENTER THE MATRIX FOR THE FOLLOWING OPERATIONS:

 Addition → A + B (Requires both matrices, must be same size)


 Subtraction → A - B (Requires both matrices, must be same size)
 Scalar Multiplication → k × A (Multiplies every element of A by k)
 Matrix Multiplication → A × B (Valid only if cols(A) == rows(B))
 Transpose → Aᵀ (Flips rows and columns of A)
 Determinant → |A| (Only for square matrices)
 Inverse → A⁻¹ (Only if A is square & non-singular)
 Check Symmetric → Checks if A == Aᵀ
 Check Skew-Symmetric → Checks if A == -Aᵀ

9
10
Future of the Project :
We wish to add more operations of Matrix like EIGEN VALUE, EIGEN
VECTORS, RANK OF A MATIX. This would help students at the higher
study level.

BIBLIOGRAPHY

For successfully completing my Project file, I have taken the help of the
following website links :

www.wikipedia.com

https://youtube

Python PysimpleGUI Tutorial

Class XII NCERT Maths Book

Arbind Kumar Jha Sir

Sumita Arora Computer book

www.google.com

11

You might also like