Results 1 to 8 of 8
Thread: help in matrix
 10062010, 08:00 AM #1Member
 Join Date
 Aug 2010
 Location
 Egypt
 Posts
 34
 Rep Power
 0
 10062010, 08:06 AM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,372
 Blog Entries
 7
 Rep Power
 25
Well, time to go back to the drawing board ... A matrix is a two dimensional block of numbers. Do you want the sizes of that block to be adjustable on the go or do you want to 'set up' a matrix with the sizes given at construction time? What do you want to do with those matrixes? Just the 'normal' mathematical operations or more fancy stuff? Do those matrixes contain a lot of zeros, i.e. are they 'sparse'? Are those matrixes square matrixes? Any other structure imposed on the numberds they contain? (i.e. symmetrical, (tri)diagonal etc.) Do they contain complex numbers or just doubles? Are they extremely large?
kind regards,
Jos
 10062010, 09:02 AM #3Member
 Join Date
 Aug 2010
 Location
 Egypt
 Posts
 34
 Rep Power
 0
iam student in faculty of engineering.......
there are some of lows in algebra very complex i want to solve it with java
in my program i want the user enter the program and ask him to indicate the size of matrix
example ::please enter the numbers of row
3
please enter the numbers of coulms
2
enter your matrix
1 3
8 9
thats what i want ........:)
 10062010, 09:36 AM #4
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,372
 Blog Entries
 7
 Rep Power
 25
 10062010, 09:49 AM #5Member
 Join Date
 Aug 2010
 Location
 Egypt
 Posts
 34
 Rep Power
 0
oh, iam sorry for this example
enter your matrix
1 3
8 9
5 6
i want to know how can i make that
how to make user enter his matrix but i cant
Scanner num= new Scanner(System.in);
System.out.print("Enter the number of your rows");
int row=num.nextInt();
System.out.print("Enter the number of your coulmns");
int coulm=num.nextInt();
int[][] mx = new int[row][coulm];
for(int r=0;r<row; r++)
for(int c=0;r<coulm; c++){
double ro=num.nextDouble();
mx [row][coulm]=(int) ro;
System.out.print(mx [row][coulm]);
}
 10062010, 09:54 AM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,372
 Blog Entries
 7
 Rep Power
 25
Please use code tags when you're posting code. What do you think that last line does? hint: matrix mx only has row rows and 'coulm' colums so those values are not valid index values. You should print the value of the current mx[r][c] instead.
Also: why are you reading 'double' values and cast them to ints? Why not just reads ints instead?
kind regards,
Jos
 10062010, 12:38 PM #7Member
 Join Date
 Aug 2010
 Location
 Egypt
 Posts
 34
 Rep Power
 0
Scanner num= new Scanner(System.in);
System.out.print("Enter the number of your rows");
int row=num.nextInt();
System.out.print("Enter the number of your coulmns");
int coulm=num.nextInt();
int[][] mx = new int[row][coulm];
for(int r=1;r<row; r++){
for(int c=1;r<coulm; c++){
int ro=num.nextInt();
mx [r][c]= ro;
System.out.print(mx [r][c]);
}
}
this my code but there are errors in it???????
and didnt make what i want !!!!!!!!i tried
sorry, all options that make me put code in php are stop !!!!!!!
 10062010, 01:26 PM #8
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,372
 Blog Entries
 7
 Rep Power
 25
Similar Threads

Help with dox matrix printer
By Albert in forum Advanced JavaReplies: 7Last Post: 09062011, 08:50 AM 
matrix multiply
By slixtrix in forum New To JavaReplies: 8Last Post: 09132010, 06:50 AM 
scalability of matrix
By ajay kumar in forum New To JavaReplies: 1Last Post: 12072009, 09:21 AM 
Scalability of matrix
By ajay kumar in forum New To JavaReplies: 0Last Post: 12042009, 06:19 AM 
Help with matrix
By susan in forum New To JavaReplies: 1Last Post: 08072007, 04:37 AM
Bookmarks