logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Elis PanaseykoEnglish
(5/5)

560 Answers

Hire Me
expert
Vivek ChauhanComputer science
(5/5)

541 Answers

Hire Me
expert
Laurence FarrellStatistics
(5/5)

532 Answers

Hire Me
expert
Fiona MoranPhilosophy
(5/5)

771 Answers

Hire Me
Others

shell/program for high-school students to solve questions involving matrices. It will be a MATLAB like tool although extremely limited in its capability and scope.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Description:

                MatShell: A shell/program for high-school students to solve questions involving matrices. It will be a MATLAB like tool (although extremely limited in its capability and scope).

Details:

                The program will behave like an interactive shell where the user can give commands (related to matrices) and see the results. Alternatively, the commands may be written in a script (with .msh extension) which can be passed as a command line argument. If a script is provided, the program will run all the commands given in the script, display corresponding results, and exit. If no script is provided as a command line option, it will enter into the interactive shell mode, where it will wait for user to type a command. For each typed command, it will display a result and wait for the next command. It will remain active until a command to exit the shell is given by the user. MatShell should be able to handle matrices of any size. Following commands are supported:

Commands:

1)       matrix_name = [ matrix values provided as rows separated by semicolons ]

A matrix can be created by providing a name, equal sign, and values of the matrix provided in rows separated by semicolons and enclosed in square brackets. The name of a matrix can only be composed of one or more letters e.g. A and First are valid names but Mat1 is not. The program should internally create a matrix with provided values and remember its name, as it would be used later by the user in other commands. The program should also print the matrix as a signal to user that it got the matrix and is ready for the next command. (Note that this is not really a command but a way to create a matrix.)

The following is how we can create a 2x4 matrix A.

A = [1 2 3 4; 5 6 7 8;]

The program will print the following as soon as the user provides the above command and presses enter.

A =

      1        2        3        4

                     5        6        7        8

                Note that the printed matrix is nicely formatted.

2)       size matrix_name

size command will print the size of the matrix matrix_name as number of rows x number of columns.

Example: (Note A was declared above.)

size A

ans = 4 x 2

3)        isRow matrix_name

isRow command will print yes if the given matrix matrix_name is a row matrix (has a single row), otherwise no.

Example:

isRow A

ans = no

4)       isColumn matrix_name

isColumn command will print yes if the given matrix matrix_name is a column matrix (has a single column), otherwise no.

Example:

isColumn A

ans = no

5)       isRectangular matrix_name

isRectangular command will print yes if the given matrix matrix_name is a rectangular matrix (number of rows and number of columns are different), otherwise no.

Example:

isRectangular A

ans = yes

6)       isSquare matrix_name

isSquare command will print yes if the given matrix matrix_name is a square matrix (number of rows and number of columns are equal), otherwise no.

Example:

isSquare A

ans = no

7)       isDiagonal matrix_name

isDiagonal command will print yes if the given matrix matrix_name is a square matrix whose all non-diagonal elements are 0, otherwise no.

Example:

B = [1 2 3; 4 5 6; 7 8 9;]

B =

      1        2        3

      4        5        6

      7        8        9

isDiagonal B

ans = no

C = [2 0; 0 5;]

C =

      2        0

      0        5

isDiagonal C

ans = yes

8)       isScalar matrix_name

isScalar command will print yes if the given matrix matrix_name is a diagonal matrix whose all diagonal elements are equal to some non-zero constant, otherwise no.

Example:

isScalar C

ans = no

D = [2 0; 0 2;]

D =

      2        0

      0        2

isScalar D

ans = yes

9)       isIdentity matrix_name

isIdentity command will print yes if the given matrix matrix_name is a diagonal matrix

whose all diagonal elements are equal to 1, otherwise no.

Example:

isIdentity D

ans = no

E = [1 0 0; 0 1 0; 0 0 1;]

B =

      1        0        0

      0        1        0

      0        0        1

isIdentity E

ans = yes

10)   isUpperTriangular matrix_name

isUpperTriangular command will print yes if the given matrix matrix_name is a square matrix whose all elements below the diagonal are 0, otherwise no.

Example:

isUpperTriangular E

ans = yes

11)   isLowerTriangular matrix_name

isLowerTriangular command will print yes if the given matrix matrix_name is a square matrix whose all elements above the diagonal are 0, otherwise no.

Example:

isLowerTriangular E

ans = yes

12)   isNull matrix_name

isNull command will print yes if all the elements of the given matrix matrix_name are 0, otherwise no.

Example:

isNull E

ans = no

13)   isSymmetric matrix_name

isSymmetric command will print yes if the given matrix matrix_name is symmetric, otherwise no. A symmetric matrix is a square matrix whose transpose is the same as the matrix itself (A’ = A).

Example:

isSymmetric E

ans = yes

14)   isSkewSymmetric matrix_name

isSkewSymmetric command will print yes if the given matrix matrix_name is skew-symmetric, otherwise no. A skew-symmetric matrix is a square matrix whose transpose is the same as the negative of the matrix. (A’ = -A)

Example:

isSkewSymmetric E

ans = no

15)   areEqual matrix_nameA matrix_nameB

areEqual command is followed by two matrix names; it prints yes if both matrices are the same size and their corresponding elements are the same, otherwise no.

Example:

areEqual A B

ans = no

16)   det matrix_name

det command prints the determinant of the provided matrix matrix_name if it is a square matrix, otherwise it prints an error message “Error: It is not a square matrix”.

Example:

det A

ans = Error: It is not a square matrix.

det B

ans = 0

F = [1 2 3; 2 5 4; 4 3 2;]

F =

      1        2        3

      2        5        4

      4        3        2

det F

ans = -20

17)   isSingular matrix_name

isSingular command prints yes if the determinant of the provided matrix matrix_name is 0. It prints no if the determinant is non-zero and prints an error message “Error: It is not a square matrix” if it is not a square matrix.

Example:

isSingular A

ans = Error: It is not a square matrix.

isSingular B

ans = yes

isSingular F

ans = no

18)   exit

This command will make the interactive shell stop executing

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

340 Experts Online