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

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : Alex got a sequence of n integers a1,a2,…,an as a birthday present. Alex doesn't like negative numbers, so he decided to erase the minus signs from all negative numbers. As a result, he got a sequence of non-negative numbers. Print the resulting sequence. For example, if the sequence is  1, 5, -3, 4,...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...

  • Question:Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) Matlab question Matrix Notation Interpreter (matrix elements to cell array of formatted character...

    Question:Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) Matlab question Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) A system of linear algebraic equations can be writen in matrx notation by applying the definizion of matrix multiplication. For example, the linear system Can be writen as or where and x = 2 matrix input ror the variable A and a × T e function command dennes the output variable linearSystem Code has...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : i have 15 min to submit the solution please help me   You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other...

  • Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elemen...

    Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elements. which are called eernents (or components). The elements of an (m × n)-dimensional matrix A are denoted as a,, where 1im and1 S, symbolically, written as, A-a(1,1) S (i.j) S(m, ). Written in the familiar notation: 01,1 am Gm,n A3×3matrix The horizontal and vertical lines of entries in a matrix are called rows and columns, respectively A matrix with the...

  • Write a Python program that generate randomly a magic square of 3 x 3 elements. For...

    Write a Python program that generate randomly a magic square of 3 x 3 elements. For example: 4 3 8 9 5 1 2 7 6      = Matrix1 Matrix 1 above is an example of magic square. The rows total, the columns total, and the diagonal totals are all 15. Your program should randomly generate a 3x3 matrix. Check if it is a magic square. If it is a magic square, then print some information and quit. If the...

  • We are given a color picture consisting of an m?n array AŒ1::m;1::n? of pixels, where each...

    We are given a color picture consisting of an m?n array AŒ1::m;1::n? of pixels, where each pixel specifies a triple of red, green, and blue (RGB) intensities. Sup- pose that we wish to compress this picture slightly. Specifically, we wish to remove one pixel from each of the m rows, so that the whole picture becomes one pixel narrower. To avoid disturbing visual effects, however, we require that the pixels removed in two adjacent rows be in the same or...

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