Jump to content

Gauss Algorithm

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
I am trying to create a Gauss Algorithm in PHP. Can anyone help me? I can't even find that much info on it.

#2
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
Never even heard of it. What is a Gauss Algorithm.

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
erm...is that something to do with a matrix to solve a system of equations or something?

#4
Blaze

Blaze

    Programmer

  • Members
  • PipPipPipPip
  • 117 posts
Found this on the net:

In mathematics, Gaussian elimination or Gauss-Jordan elimination, named after Carl Friedrich Gauss and Wilhelm Jordan (for many, Gaussian elimination is regarded as the front half of the complete Gauss-Jordan elimination), is an algorithm in linear algebra for determining the solutions of a system of linear equations, for determining the rank of a matrix, and for calculating the inverse of an invertible square matrix. ...

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
i love math, and would love to help you, but my linear algrabra class is 2 years away, and therefor have no idea what to do.

is this what your trying to do? http://mathforum.org...view/53207.html

if not search here for gaussian http://mathforum.org/dr.math/ a lot of people stop by there for help with algorithm's; if they dont have the one your looking for you can submit a question (make sure you say your a student or they wont reply) and they can give you what you would need to do step by step. After that, if you need help with putting it into php i could try and give you a hand.

hth

#6
Sionofdarkness

Sionofdarkness

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 384 posts
Reminds me of a Gauss cannon, ha ha. However, that Gauss-Jordan elimination thing sounds very useful for mathematics.

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Gauss-Jordan Elimination is useful for inverting matrices, among other things... which can provide easy solutions to large systems of equations. I don't know a lot about how PHP stores variables, but I can definitely help with the algorithm. It'll be a little messy because you'll be doing a lot of nested For loops.

I'll assume you're storing your matrix in an array. The basic idea is to think of each row as a vector.

[1 2 3 4 5] <-- vector 1
[2 3 4 5 6] <-- vector 2
[3 4 5 6 7] <-- vector 3
[4 5 6 7 8] <-- vector 4
[5 6 7 8 9] <-- vector 5

Let A be the matrix, V[m] be a row from A, m be the row index, n be the column index. Then what you'll do is:
For n = 1 to 5 Do
  Let c=A[n,n]
  if c<>0
    For m = 1 to 5 Do
      if m<>n then
        V[m]=V[m]-A[m,n]/c*V[n]
     end if
    end For
  end if
end For

You'll have to tweak that a bit, but that's the basic algorithm.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog