Translate To Preferred Language

Search Obioku's Thoughts

Please Read Today's Featured Post

Things I Would Like To Happen Soon

For all those who believe in speaking ideas into existence and prayer in the universe will return to a person.  I simply want to write a lis...


Use the button below to make one time or recurring donations to help generate income. Thank you very much for your generosity. Please continue to enjoy

Template for Matrix Arithmetic in Python (some bugs may occur)

#list for reading numbers
nums = []
index = 0
#open file
#read line by line
#then split to append to list
with open("COSC450_P2_Data.txt","r") as data:
    for x in data:
        array = x.split()
        for i in array:

import numpy as n
#create matrix
length = len(nums)//5
matrix1 = n.asarray(nums).reshape(5,length)
matrix2 = n.asarray(nums).reshape(length,5)
result =, matrix2)

#prepare output file
output = open("COSC450_P2_Output.txt","w+")
output.write('Complete set of numbers\n')
output.write("\n\nFirst Matrix\n")
output.write("\n\nSecond Matrix\n")
output.write("\n\nResults after multiplication\n")
output.write("\n\nSorted Results\n")
output.write(str(n.sort(result, axis=None).reshape(5,5)))


No comments:

Post a Comment

Thank you very much for viewing this entry and I hope you are able to return soon to continue to enjoy more of the site.
Please share your thoughts in the comment section.
Be blessed and enjoy life!

Note: Only a member of this blog may post a comment.