Math233 Math 233 Math/233 - Week 4 - Lab 4 - We saw in Section 6.6 of the textbook that you can use Markov Chains and matrix multiplication to answer questions about the probability of moving
    Math233 Math 233 Math/233 - Week 4 - Lab 4 - We saw in Section 6.6 of the textbook that you can use Markov Chains and matrix multiplication to answer questions about the probability of moving

Math233 Math 233 Math/233 - Week 4 - Lab 4 - We saw in Section 6.6 of the textbook that you can use Markov Chains and matrix multiplication to answer questions about the probability of moving

$19.99

We saw in Section 6.6 of the textbook that you can use Markov Chains and matrix multiplication to answer questions about the probability of moving from one state to another in a sequence of moves in a game scenario (given the initial transition between states probabilities). Since there are easy to use C++ classes to do the matrix multiplication for us, we can program some different game problems and allow the user to query about future states of the game and their probability of occurring.

Download Math233 iLab4.zip (or in Doc Sharing). This contains a Visual Studio C++ project (YMatrix.vcproj) containing a Matrix class (Matrix.hpp) and a test program (YMatrix.cpp).

Deliverables

For credit, your program must at least compile and run properly. It should also contain adequate comments such as:

  • Basic introductory comments including a brief description, date and author.
  • Descriptions of each variable.
  • Description of significant procedures.

Each student must write and submit his or her own code for the assignment. Discussion of the assignment is allowed. You may share ideas but not code files.

Sample Output (user input in bold and underlined):

Matrix M:
1       0       0       0       0       0       0
0.67    0       0.33    0       0       0       0
0       0.67    0       0.33    0       0       0
0       0       0.67    0       0.33    0       0
0       0       0       0.67    0       0.33    0
0       0       0       0       0.67    0       0.33
0       0       0       0       0       0       1

What is the probability that the game currently in state 'x' is in state 'y' after 'n' more moves?
Enter three integers x, y, n (1<=x<=7, 1<=y<=7, seperated by spaces): 354
Matrix M^4:
1       0       0       0       0       0       0
0.818137        0.0977704       0       0.0722334       0       0.0118592       0
0.647404        0       0.244426        0       0.0963112       0       0.0118592
0.300763        0.297755        0       0.293311        0       0.0722334       0.035937
0.201511        0       0.397007        0       0.244426        0       0.157056
0       0.201511        0       0.297755        0       0.0977704       0.402963
0       0       0       0       0       0       1

The probability that the game currently in state 3 is in state 5 after 4 more moves is 0.0963112

 

L A B S T E P S

 

STEP 1: Section 6.6 Exercise 1 (page 500) (30 points)

 

Write a program to answer Section 6.6 Exercise 1, page 500, and to allow the user to ask the additional question below. It is fine to hard-code the initial state transition matrix values. (i.e. it is ok to type in the entries of your matrix in the same type of format they are already typed in the original program in the zip file.) Thus, your matrix will be different from the one that appears in the original program in your zip file. Note, the Matrix M that you see up above isthe matrix that you will type into your program. Remove the old matrix that they have in the old program and replace it by the entries of M from up above.

Allow the user to ask questions of the following form:

 What is the probability that the game currently in state 'x' is in state 'y' after 'n' more moves?

So ask the user to input x, y, and n.

__________________________________________________________________________________________________________

*Note: This line of code in the YMatrix.cpp file contained in the zip file:
mathMatrix2 = mathMatrix1 * mathMatrix1;
is an example of the type of syntax that one uses in this program to multiply two matrices.

Be aware that what appears in the .cpp file in the original program in your zip file only squares mathMatrix1, displays mathMatrix1^2. You want the user to input
x y n
where x,y is the (x,y) entry of the matrix mathMatrix1^n. You thus have to modify your .cpp file so that it computes mathMatrix1^n for any power n that the user inputs.

 

Here is solution for Math233 - iLab 4

It is 100% correct.

Please using Visual Studio to open this project.

If you have more questions, please contact me via email support@extutorials.com

I will help you any time

Thank you very much

Attached Files

Move over [ preview ] file name to preview content in it!

  • Math233Ilab4.zip [11447KB]
    • ipch
    • Math233Ilab4
      • Math233Ilab4.cpp [1.4KB] [ preview ]
      • Math233Ilab4.vcxproj [4.4KB]
      • Math233Ilab4.vcxproj.filters [1.4KB]
      • Math233Ilab4.vcxproj.user [0.1KB]
      • Matrix.h [65.9KB] [ preview ]
      • ReadMe.txt [1.7KB] [ preview ]
      • stdafx.cpp [0.2KB] [ preview ]
      • stdafx.h [0.3KB] [ preview ]
      • targetver.h [0.3KB] [ preview ]
    • Math233Ilab4.sln [0.9KB]
    • Math233Ilab4.suo [11.7KB]
    • Math233Ilab4.sdf [8998.9KB]

Write a review

Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below:



PURCHASE SAVE
2 Tutorials 10%
3 Tutorials 13%
4 Tutorials 16%
5 Tutorials 19%
6 Tutorials 22%
7 Tutorials 25%
8 Tutorials 28%
9 Tutorials 31%
10 Tutorials 34%
add url more

9MZQASHWN73B