Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 2.1 KB

README.md

File metadata and controls

66 lines (45 loc) · 2.1 KB

math_lab_library

This python library contains a lot of function that we use in matlab,C and assembly language. Those who used to code in those languages sometimes finds it difficult to find complimentary functions in python. So, this library will help them

def smul(array,scalar): #scalar multiplication with each member of the array def sdiv(array,scalar): #scalar division with each member of the array def esum(array1,array2): #elementwise sum of two arrrays def esub(array1,array2): #elementwise subtraction of two arrrays def emul(array1,array2): #elementwise multiplication of two arrrays

def ediv(array1,array2): #elementwise division of two arrrays

def fnum(letter): #returns the index of a specific letter in an array; like- a=1; d=4; z=26 def fltr(index): #assigning a to z with a number from 1 to 26.. It takes the number as an input and returns the respective letter; like 1=a; 3=c def ltrsub(letter1,letter2): #subtract a letter from the other and find the difference in sequence; like f-b=d def strsub(str1,str2): #subtracts a string from the other; and returns the element wise subtraction; string size must be same; "sub"-"aaa"="rta" def ltrcmp(ltr1,ltr2): #returns 1 if letter 1 comes first in alphabetic order;if both are the same return 0; else return -1

def strcmp(str1,str2): #returns 1 if string 1 comes first in alphabetical order.return -1 if string 2 comes first.return 0 if both are the same. def strremove(string,letter): #remove a letter from a string. if the letter is present in multiple times.. all of it is removed

def rorone(array): #rotates an array or a string one step towards right

def ror(array,n): #rotates an array or a string n steps towards right

def factorial(n):

def ncr(n,r): #n choose r

def npr(n,r):

def matmul(mat1,mat2): #matrix multiplcation

def transpose(matrix):

def matadd(matrix1,matrix2):

def matsub(matrix1,matrix2):

def findindex(array,element): #finds the index of an element inside an array; it will return list of index if the element is found multiple times

def matshow(matrix): #prints the matrix in matrix form