Question

Given the elements of a 3 × 3 matrix as the nine variables a11, a12, ......

Given the elements of a 3 × 3 matrix as the nine variables a11, a12, ... a33,
produce a string representation of the matrix using formatting methods, (a) assuming
the matrix elements are (possibly negative) real numbers to be given to one decimal
place; (b) assuming the matrix is a permutation matrix with integer entries taking the
values 0 or 1 only. In the Python language.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

# (a)

# negative real number with one decimal digit

from numpy import * 

mat = array([[-1.2, -3.4, -5.4],[-0.2, -0.1, -4.1],[-9.8, -9.5, -9.7]])

for i in range(len(mat)):
    for j in range(len(mat[i])):
        print(str(mat[i][j]), end = ' ')

imtusharsharma/Dul1DeepConferences repl talk student learn/teach notifications imtushars..▼ run share my reps No description Files mainpy saved | repl-run 1 (a) main,py Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux 3 4 # negative real number with one decimal digit 5 from numpy import* D b 7 mat-arrayC[-1.2, -3.4,-5.4],1-8.2,-0.1, -4.1),0-9.8 0 9 for i in range(len (mat)): 10 for j in range(len (mat[i])): print (str(mat[i][], end)


# (b)

# integer with 1 or 0 values

from numpy import * 

mat = array([[1, 0, 0],[0, 1, 1],[1, 1, 1]])

for i in range(len(mat)):
    for j in range(len(mat[i])):
        print(str(mat[i][j]), end = ' ')

imtusharsharma/DulDeepConferences share repl talk my repls student learn/teach notifications imtushars... No description Files mainpysved s main,py https://DullDeepConferences.imtusharsharma.repl.run |α 1 (b) Python 3.6.1 (default, Dec 2015, 13:05:11) TGcc 4.8.21 on linux. integer with 1 or θ values 5 from numpy import 7 mat -array([[1, e, ele, 1, 1],[1, 1, 1 9 for i in range(len(mat)): Db 10 for j in range(len(mat[i])) 0 print str(mat[i]i]), end -

Add a comment
Know the answer?
Add Answer to:
Given the elements of a 3 × 3 matrix as the nine variables a11, a12, ......
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A matrix A has 3 rows and 4 columns: a11 a12 a13 a14  a21 a22...

    A matrix A has 3 rows and 4 columns: a11 a12 a13 a14  a21 a22 a23 a24 a31 a32 a33 a34 The 12 entries in the matrix are to be stored in row major form in locations 7609 to 7620 in a computer’s memory. This means that the entires in the first row (reading left to right) are stored first, then entries in the second row, and finally entries in the third row. Which location with a22 be stored...

  • linear algebra Given the square matrix: A = 0:3 a) Find the cofactors A11, A12, and...

    linear algebra Given the square matrix: A = 0:3 a) Find the cofactors A11, A12, and A13- b) Find the determinant of the matrix A. c) Do you think that the matrix A is nonsingular? If yes find A-' using Elementary Row Operations. (Justify your answer) Remark: You may type your solution in the box below, or you can upload your solution as a pdf file.

  • Question 3 alues, and a get method for each of the member variables. The class implements...

    Question 3 alues, and a get method for each of the member variables. The class implements the ne member variables to the given Comparable interface, and compares two candidates based on their numbers of votes. 2. Designing a class named VotingMachine that contains a collection of candidates and the following methods: . addCandidate (String name): Add a candidate of a given name to the collection of candidates. This method throws an exception if a candidate of the given name already...

  • Programming Assignment 1 Write a class called Clock. Your class should have 3 instance variables, one...

    Programming Assignment 1 Write a class called Clock. Your class should have 3 instance variables, one for the hour, one for the minute and one for the second. Your class should have the following methods: A default constructor that takes no parameters (make sure this constructor assigns values to the instance variables) A constructor that takes 3 parameters, one for each instance variable A mutator method called setHour which takes a single integer parameter. This method sets the value of...

  • import java.util.List; import java.util.ArrayList; import java.util.LinkedList; public class ListPractice {       private static final int[]...

    import java.util.List; import java.util.ArrayList; import java.util.LinkedList; public class ListPractice {       private static final int[] arr = new int[100000];    public static void main(String[] args) {        for(int i=0; i<100000; i++)            arr[i] = i;               //TODO comment out this line        LinkedList<Integer> list = new LinkedList<Integer>();               //TODO uncomment this line        //List<Integer> list = new ArrayList<Integer>();               //TODO change the rest of the...

  • The following code uses a Scanner object to read a text file called dogYears.txt. Notice that...

    The following code uses a Scanner object to read a text file called dogYears.txt. Notice that each line of this file contains a dog's name followed by an age. The program then outputs this data to the console. The output looks like this: Tippy 2 Rex 7 Desdemona 5 1. Your task is to use the Scanner methods that will initialize the variables name1, name2, name3, age1, age2, age3 so that the execution of the three println statements below will...

  • Need help Purpose Calculate mileage reimbursements using arrays and methods. The Mathematical Association of America hosts...

    Need help Purpose Calculate mileage reimbursements using arrays and methods. The Mathematical Association of America hosts an annual summer meeting. Each state sends one official delegate to the section officers’ meeting at this summer session. The national organization reimburses the official state delegates according to the scale below. Write a Java program to calculate the reimbursement values, satisfying the specifications below. Details on array and method usage follow these specs. 1. The main method should declare all the variables at...

  • ***JAVA: Please make "Thing" movies. Objective In this assignment, you are asked to implement a bag...

    ***JAVA: Please make "Thing" movies. Objective In this assignment, you are asked to implement a bag collection using a linked list and, in order to focus on the linked list implementation details, we will implement the collection to store only one type of object of your choice (i.e., not generic). You can use the object you created for program #2 IMPORTANT: You may not use the LinkedList class from the java library. Instead, you must implement your own linked list...

  • PYTHON 3 node Node ADT Question. Question 3 (18 points): Purpose: To practice working with node chains created using...

    PYTHON 3 node Node ADT Question. Question 3 (18 points): Purpose: To practice working with node chains created using the Node ADT to implement slightly harder functionality Degree of Difficulty: Moderate to Tricky In this question you'll implement merge sort for node chains! Recall, merge sort is a divide-and-conquer technique that uses recursion to sort a given sequence (in this case a node chain). A overview of the algorithm is given below. Algorithm mergeSort (NC) Borts node chain NC using...

  • I'm not getting out put what should I do I have 3 text files which is...

    I'm not getting out put what should I do I have 3 text files which is in same folder with main program. I have attached program with it too. please help me with this. ------------------------------------------------------------------------------------ This program will read a group of positive numbers from three files ( not all necessarily the same size), and then calculate the average and median values for each file. Each file should have at least 10 scores. The program will then print all the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT