Help Miss_Lolitta Create Program for Integer Matrix

  • Thread starter Miss_lolitta
  • Start date
In summary, the program allows the user to input a number of integers such as N, and then stores them in an integer matrix. The arrangement of entries of the first row is the same arrangement of entries of the first column. The diagonal of the matrix is equal to the total of every row.
  • #1
Miss_lolitta
10
0
Hi,,
I am hoping that you will help me. I have trouble how can do this homework:
Write a program that allows the user to input a number of integers such as N, and then stores them in an integer matrix where:

1- The dimension of matrix = NXN.
2-Entries of matrix can take any number from 0-2.
3- Arrangement of entries of first row is the same arrangement of entries of first column.
4-The diagonal of matrix =o.
5- Total of every row =4,Also Total of every column.

Then, the program displays the result.

Your help would greatly be appreciated

Respectfully,,
Miss_Lolitta
 

Attachments

  • For example.doc
    59 KB · Views: 291
Computer science news on Phys.org
  • #2
Is there a particular language that the program is to be written in?
 
  • #3
hey perhaps we can sit your exams for you too?

At least try and do it, and post what progress you have gotten through!
 
  • #4
Isn't this in the wrong section? Shouldn't it be in the homework section?
 
  • #5
I would like to write this program in C++.I learn the programming language at an institute,and I am not expert in this branch but I try to become better with your first help.

I would be so ever grateful if you could help me on how to go about writing this program.

thanks,,
 
  • #6
OK, forget about the programming language, forget about the computer. Pick up a pencil.

Design you logic first. Start at a high level, then break it down.
1] Gets integer from user: N.
2] Creates a matrix: NxN.
3] Fills in the diagonal values with zeros.
4] ?? - You must decide on your algorthim for checking against your rules.

Clearly step 4 is the bulk of the program. How do you propose to check?
Brute force?
000 000 000 = No.
000 000 001 = No
000 000 002 = No
000 000 010 = No
etc.
Is there a better way to do this? Knowing the rules you have to stay within, and the possible values (0-2), are there any steps you can eliminate? (Note that of the above tests, only 2 of them are valid, considering the "diagonal rule". You don't even need to test them.)

Hint: you're going to be needing a lot of loops and a lot of 'if's.

There is no point in going anywhere near a programming language or a computer until you've worked out your logic.
 
Last edited:
  • #7
Really, forget about the programming language, forget about the computer. Look at this method to solve this problem in maths:

1] Gets integer from user: N. such as N=3

2] Creates a matrix: 3x3

X Y Z
X Y Z
X Y Z

3] Fills in the diagonal values with zeros.

0 Y Z
X 0 Z
X Y 0

>>> then we have the following system:

0 Y Z = 4
X 0 Z = 4
X Y 0 = 4

>>> by solving this system we have a unique solution:X=2,Y=2,Z=2

>>> So, we have matrix

0 2 2
2 0 2
2 2 0


Hint: we have a symmetry between diagonals of matrix

I know that there is relation between maths and CS to solve mathematical problems..because of this I would like to study the programming languages.

Any help you give I'd be very glad . Thank you for your assistance.
 

1. What is an integer matrix?

An integer matrix is a mathematical structure that consists of a rectangular grid of numbers, where each number is an integer. It is often represented as a two-dimensional array or table.

2. What is the purpose of creating a program for integer matrices?

The purpose of creating a program for integer matrices is to perform various mathematical operations on these matrices, such as addition, multiplication, and finding determinants. This can be useful in many fields, including statistics, engineering, and computer science.

3. What programming language will be used to create this program?

The programming language used to create this program will depend on the preferences and skills of the programmer. Some popular options for creating mathematical programs include Python, Java, and MATLAB.

4. What features will be included in the program for integer matrices?

The features of the program for integer matrices will depend on the specific needs and requirements of the project. Some common features may include the ability to input and display matrices, perform various operations on them, and save or export the results.

5. How can I contribute to the development of this program?

If you are interested in contributing to the development of this program, you can reach out to Miss_Lolitta and offer your skills and expertise. You can also provide feedback and suggestions for improvement once the program is released. Any contributions, big or small, are greatly appreciated and can help make the program more robust and user-friendly.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
1
Views
529
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
876
  • Programming and Computer Science
Replies
25
Views
2K
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Computing and Technology
Replies
1
Views
957
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Quantum Interpretations and Foundations
Replies
15
Views
2K
Back
Top