• Post Reply Bookmark Topic Watch Topic
  • New Topic

Gauss Elimination HELP! :)  RSS feed

 
Krad Despair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day

I found a code online in the internet, I just want to have an explanation of the parts of the code because I cannot understand its intended use. Can you help me out? Thanks.



Can you guys help me understand the parts? Because there are no comments on the functions of the codes. Please Help.
I don't have an idea on how the equations are solve, so can you please?

I don't have problem understanding the INPUT part, but on the EQUATEOUT part, i do not understand most of the coding and how they come up with the answer. HELP!
 
Tim Cooke
Marshal
Posts: 4038
239
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must have some idea of what it's supposed to do right? After all, you were the one who found it on the internet. What were you looking for? What do you think it does? What were you hoping it does?

Just presenting a seemingly random block of code with a "What does this do" tagline is probably not going to get the responses you were hoping for. Please ShowSomeEffort (<-- click)
 
Krad Despair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I know how it works.



This part finds the pivot row, I guess it with the absolutes thing.

But don't understand this part sir.

 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krad Despair wrote:
But don't understand this part sir.



Looking at the code, it's doing a swap. Let me use a simpler example: Given a=5 and b=10, how to swap these variables to a=10 and b=5 "without" losing the original value? The key here without losing original value. I can always just do:

But that will have lost my original value. Therefore, I need a temp value to store the original value.


Voila. The code in your Internet code is doing the thing only the variable coef is a multi-dimensional array.
 
Krad Despair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the wonderful reply sir!

Can I ask some more?

How about this part sir?



Just like the comment I wrote, I know it is for pivoting, but can you give me another concrete example of what happens in this part of code?

Thanks sir!
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of the most basic constructs in Java. It 's going to be really hard to get an understanding of an algorithm without firstly understanding the language it is written in.

You might have a look at the for loop description in the tutorial. I'd say that you actually should read the entire Language Basic tutorial first before you go further on the algorithm.

Do you have any prior experience with programming? If not, I'd suggest starting with simpler algorithms than Gaussian elimination.
 
Krad Despair
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand the algorithm sir.

I just don't understand the Gaussian elimination applied in the codes. Im sorry sir for the inconvinience.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to be sorry. We'd like to help, but we'd also like to understand what do you really need help with.

Do you have any experience in Java? Or any experience with programming in general?

If you do, it should be quite straightforward to understand what is happening in these for loops, especially if you're already familiar with the algorithm. I've therefore assumed that Java and perhaps programming in general is new to you. I honestly don't know what is the best way to start programming, but from my own experience, the best way to start with Java is the tutorial I've posted a link to. Java has the best and most extensive online documentations and tutorials of all languages I've met so far.

I might start explaining you the for loop, but it has been already done, and by folks that have spent more time over it that I could right now. This is why I gave you this link. If you go there, read the page, and still cannot understand what the for loop does, please come back and tell us what is unclear.
 
Krad Despair
Greenhorn
Posts: 12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir, thanks for the link. I will study everything here.

and yes, I am a beginner Thanks for everything guys [♥
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!