Results 1 to 5 of 5
Thread: Gauss program
 05022014, 01:54 PM #1Member
 Join Date
 May 2014
 Posts
 2
 Rep Power
 0
Gauss program
Hello.
I have a big problem with writing Gauss Elimination in Java code. This is my homework, it's true. But I want to learn this, and I don't know how to bite this. I will be very gratefull if you give me some advices or hints. I must realise some points:
1) Create new class  Gauss Elimination with two attributes (table A (nxn) and table B with vector (n));
2) Add new method "eliminate" which transform matrix A and parametr vectors B ;
3) Add new method "solve" which calculate inverse substitution.
Thanks for all :)
 05032014, 01:42 AM #2
Re: Gauss program
What have you tried?
What specific questions do you have?If you don't understand my response, don't ignore it, ask a question.
 05032014, 11:07 AM #3Member
 Join Date
 May 2014
 Posts
 2
 Rep Power
 0
Re: Gauss program
This is my beginning :)
Java Code:public class GaussElimination { double[][] A; double[] b; public void eliminate(double[][] A, double[] b) { </code> I have tried this code: <code> public void GaussianElim(double[][] A, double[] b) { for (i = 0; i < n; i++) { // Process row i /*  (A) Select pivot  */ pivot = A[i][i]; /*  (B) Normalize row i  */ for (j = 0; j < n; j++) A[i][j] = A[i][j]/pivot; b[i] = b[i]/pivot; /*  (C) Sweep using row i  */ for (k = 0; k < n; k++) { if ( k != i ) { factor = A[k][i]; for (j = 0; j < n; j++) A[k][j] = A[k][j]  factor*A[i][j]; b[k] = b[k]  factor*b[i]; } <
But I don't understand this loops. Where can I start? I don't understand these methods :(Last edited by Norm; 05032014 at 01:42 PM. Reason: < > changed to [ ] around code tags
 05032014, 01:47 PM #4
Re: Gauss program
I don't understand this loops
The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)
I don't know anything about Gauss, it is not a part of java. Java is a programming language that can be used to solve lots of different problems.
If you have any specific questions about java programming, post them.If you don't understand my response, don't ignore it, ask a question.
 05032014, 03:51 PM #5
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,016
 Blog Entries
 7
 Rep Power
 23
Re: Gauss program
Note that Gaussian elimination (and Gauss/Jordan elimination) is more complicated if the pivot element (the element on the diagonal of the matrix) is zero. You need to permute the rows (or columns) to get a nonzero element in that position.
kind regards,
JosI have the stamina of a seal; I lie on the beach instead of running on it.
Similar Threads

Prime Number Program in Java, simple program giving headache to me
By immohan in forum New To JavaReplies: 6Last Post: 12152013, 07:40 AM 
ILL CONDITION MATRICES and gauss jordan elimination
By manunited in forum New To JavaReplies: 1Last Post: 09282013, 04:35 PM 
Workout program progression  Ways to make my Java program shorter/smarter?
By LasseA in forum New To JavaReplies: 4Last Post: 11212012, 02:19 PM 
How to code a program to send messages to a chat program?
By josh2992 in forum New To JavaReplies: 2Last Post: 04022011, 12:57 PM
Bookmarks