• jd (unregistered)

    Got fail

  • asdf (unregistered)

    Something telling me it's BASIC language family but it definetely looks like perl

  • (cs) in reply to asdf

    Might have something to do with the "#"'s and "&"'s on all the variable names, asdf. And yes, this was found in a Visual Basic program (although it apparently started life as a more obscure dialect).

  • Frank Nestel (unregistered)

    Notice that the Leibniz formula for determinants might be of theoretical interest, but it's complexity is n! whereas good methods are n^3 or less under appropriate circumstances.

  • mucki (unregistered)

    I# can&t* e#(ven): goto CO2

    CO2: read& th=is c0*de

    Which awful language is that? I can't even follow the control flow because of all the weird characters.

  • (cs) in reply to Frank Nestel

    Yes, but I linked that one because it's a fairly easy to understand formula- I think most of us don't work with determinants that often (I certainly don't).

  • NaN (Not a Name) (unregistered)

    I found that mathematical functions don't have to always return the correct answer as long as you can calculate the probability that they will or will not.

  • MindChild (unregistered)

    This is QBasic code that has been ported to Visual Basic. Visual Basic had an amazing/cursed ability at backward compatibility with QBasic. You could use line numbers. Any graphical output would draw to the main form instead of the DOS terminal. & = long, # means double.

  • (cs)

    This thing only does 3x3? As in a11*(a22a33-a23a32) - ...? Nice.

  • (cs) in reply to Remy Porter
    Remy Porter:
    Yes, but I linked that one because it's a fairly easy to understand formula- I think most of us don't work with determinants that often (I certainly don't).
    Then why did you start with "There are a large number of programming problems that involve the use of matrices and linear algebra."?
  • Avogadro (unregistered) in reply to NaN (Not a Name)
    NaN (Not a Name):
    I found that mathematical functions don't have to always return the correct answer as long as you can calculate the probability that they will or will not.

    Are they quantum functions?

  • Andrew (unregistered) in reply to NaN (Not a Name)
    NaN (Not a Name):
    I found that mathematical functions don't have to always return the correct answer as long as you can calculate the probability that they will or will not.
    If it's floating point, it doesn't have to be right, because we all know that floats are inaccurate by nature. Because of that, 2.0f + 2.0f = 5.0f
  • Accalia.de.Elementia (unregistered) in reply to TGV
    TGV:
    Remy Porter:
    Yes, but I linked that one because it's a fairly easy to understand formula- I think most of us don't work with determinants that often (I certainly don't).
    Then why did you start with "There are a large number of programming problems that involve the use of matrices and linear algebra."?

    because scientists find those sorts of problems interesting, programmers find them annoying and invent excuses to not do them.

    I think that's how enterprise software gets created.

  • (cs) in reply to TGV

    Because there are? Matrix operations are very common.

    But just because you're working with matrices doesn't mean you need to know the determinant of the matrix. A lot of matrix operations have been structured such that you don't need to know the determinant to calculate them.

  • Peter (unregistered)

    The only real way to do determinants is with APL...now, that's cryptic.

  • Swedish tard (unregistered) in reply to Remy Porter
    Remy Porter:
    Because there are? Matrix operations are very common.

    But just because you're working with matrices doesn't mean you need to know the determinant of the matrix. A lot of matrix operations have been structured such that you don't need to know the determinant to calculate them.

    I've worked with programming 5 years now, and I have not encountered a matrix so far. Even less so anything involving any nontrivial mathematic. And I work in *nix and linux systems, developing heavy lifting server software. Should the need arise to work with matrices and math, it's probably a good idea to refresh my university studies in the matter though. :D Since as I had to write a library for doing matrix math in my second programming course.

  • Demos (unregistered) in reply to Frank Nestel

    Notice that, for small n, n! < n^3

  • qazwsx (unregistered) in reply to Swedish tard
    Swedish tard:
    Remy Porter:
    Because there are? Matrix operations are very common.

    But just because you're working with matrices doesn't mean you need to know the determinant of the matrix. A lot of matrix operations have been structured such that you don't need to know the determinant to calculate them.

    I've worked with programming 5 years now, and I have not encountered a matrix so far. Even less so anything involving any nontrivial mathematic. And I work in *nix and linux systems, developing heavy lifting server software. Should the need arise to work with matrices and math, it's probably a good idea to refresh my university studies in the matter though. :D Since as I had to write a library for doing matrix math in my second programming course.

    Matrices are essential for any kind of 3D graphics programming.

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered)

    TRWTF is using LET statements in any form of Microsoft BASIC.

    The LET keyword was already obsolete in nineteen freaking seventy nine.

  • (cs) in reply to Swedish tard

    I haven't used them much, but I'm mostly writing pretty straightforward data-driven business applications. I've done a little graphics programming on the side, which sometimes calls for a little matrix work (although you'll usually let an API do the heavy lifting there).

  • Mike (unregistered)

    This is 60s/70s style programming, sadly still much in use in the 80s due to the crappy bits of kit called micros. Anything written like this in the 90s was just from a crappy coder.

  • MindChild (unregistered) in reply to Swedish tard
    Swedish tard:

    I've worked with programming 5 years now, and I have not encountered a matrix so far.

    Sure you have. Most folks call them 2d arrays.

  • (cs) in reply to Demos

    This stops working when n>6.

  • (cs) in reply to Peter
    Peter:
    The only real way to do determinants is with APL...now, *that's* cryptic.
    Somebody has to say it, so it might as well be me...

    "APL? It's all Greek to me."

  • (cs)

    I didn't see a requirement that the results of the computation had to be correct...this could be another variant of "sleep"

  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    Peter:
    The only real way to do determinants is with APL...now, *that's* cryptic.
    Somebody has to say it, so it might as well be me...

    "APL? It's all Greek to me."

    From http://dfns.dyalog.com/n_det.htm

    detriment←{∇{⍵+(¯1*+/^\⍺)×⍵⍵[⎕io;⍺⍳0]×⍺⍺ ⍺/1 0↓⍵⍵}⍵/(↓≠/¨⍳⍴⍵),0 0≡⍴⍵}

    Note that the boxes are really boxes, not boxed-out font gaps, and the zeros are, as usual in APL, the dotted kind.

  • Someone (unregistered)

    Stare at this for 5 seconds, tilt your head in awe or disgust and realize that the line after label DE2 really starts to look like a middlefinger?

  • Pista (unregistered)

    Dammit, my glasses jumped off my nose when they've seen this crap...

    Captcha: conventio. The above WTF uses a very lousy coding conventio

  • F (unregistered) in reply to Demos
    Demos:
    Notice that, for small n, n! < n^3
    More specifically: for n<6, n!<n^3.
  • Captain Oblivious (unregistered) in reply to qazwsx
    qazwsx:
    Swedish tard:
    Remy Porter:
    Because there are? Matrix operations are very common.

    But just because you're working with matrices doesn't mean you need to know the determinant of the matrix. A lot of matrix operations have been structured such that you don't need to know the determinant to calculate them.

    I've worked with programming 5 years now, and I have not encountered a matrix so far. Even less so anything involving any nontrivial mathematic. And I work in *nix and linux systems, developing heavy lifting server software. Should the need arise to work with matrices and math, it's probably a good idea to refresh my university studies in the matter though. :D Since as I had to write a library for doing matrix math in my second programming course.

    Matrices are essential for any kind of 3D graphics programming.

    Matrices are essential for all sorts of problems, including probability and statistics, including multivariable statistics, Markov chains, Montecarlo simulation, etc.

    Computing eigenvectors and eigenvalues from square matrices is a very useful operation, since the basis of eigenvectors tells us which directions are "preserved" by the linear transformation the matrix represents. You need determinants to compute these values.

    That said, if anything in CS is a "solved problem", this is it. You are better off knowing how to use a good linear algebra API than how to write one.

  • (cs) in reply to F
    F:
    Demos:
    Notice that, for small n, n! < n^3
    More specifically: for n<6, n!<n^3. </div>
    Even more specifically: none of you two have any idea about complexity, do you? For any N, (∀n<N)(O(f(n))=O(g(n)).
  • Carl (unregistered)
    There are a large number of programming problems that involve the use of matrices and linear algebra.
    Yeah, 32 years programming here, and still never found a reason why they put me through the most basic algebra class much less all that college stuff.

    OK so if you're going to be writing robot vision software or a digital multiplexing radio for the next smartphone maybe you'll need that. And maybe you'll need to code your own filesystem too since embedded devices don't have them. But for data processing, web development, operations, sys admin... you know -- where most all the jobs are... learning higher math is an absolute waste of time.

    Yes I even spent several years writing a 3D data visualization package, and I still never needed anything more than an understanding of when to call what trig function to transform a planar coordinate system to spherical. All the heavy math: handled by the graphics card. So still, unless you're making your own graphics card, it is Somebody Else's Problem.

  • Anon') or 1=1 (unregistered)

    Correct, fast to implement, fast to run: pick 2.

    Or maybe pick 0 or 1 in this case.

  • C-Derb (unregistered)

    This code is so hard to follow, I have no idea where the "That's it!" comment is supposed to go.

  • (cs) in reply to Remy Porter
    Yes, but I linked that one because it's a fairly easy to understand formula- I think most of us don't work with determinants that often (I certainly don't).
    Fairly easy to understand, maybe.

    But the fact is, for a programmer it is absolutely useless. It's not even on the Bubble Sort scale of inefficient, it's on the "nobody would EVER use this" scale.

    Regarding the code: It's about as easy to read as the corresponding disassembler output would be.

  • iToad (unregistered)

    d = det(X)

    MATLAB FTW...

    Sometimes, the proper use of an appropriate tool eliminates a lot of pain from your life.

  • Some Damn Yank (unregistered) in reply to Swedish tard
    I've worked with programming 5 years now, and I have not encountered a matrix so far.
    And I worked with matrices in my first job. We're even, or at least cancel each other out.
  • (cs)

    I tried to draw a flowchart of this algorithm, but my paint program refused to let me.

  • (cs)

    The Easy Reader version has it right, by the way...

  • (cs) in reply to MindChild
    MindChild:
    This is QBasic code that has been ported to Visual Basic. Visual Basic had an amazing/cursed ability at backward compatibility with QBasic. You could use line numbers. Any graphical output would draw to the main form instead of the DOS terminal. & = long, # means double.
    Although, the LETs tell us that this was either ported from an even older BASIC dialect in turn, or just coded by a major greybeard.
  • AGray (unregistered) in reply to iToad

    Don't forget about Octave, either It's equally as powerful for prototyping these machine-learning/matrix manipulation problems...

  • Some Damn Yank (unregistered) in reply to iToad
    iToad:
    d = det(X)

    MATLAB FTW...

    Sometimes, the proper use of an appropriate tool eliminates a lot of pain from your life.

    Sometimes, the boss says "I pay you to write code, not buy it. Request denied." In fact, in 32 years in this business I have never used a third-party tool. If it doesn't come with the compiler we can't have it. In one job I worked for an entire department that supported an in-house graphics library we could have purchased, but by then it was deemed cheaper to maintain ours than re-write code to use something else.

  • (cs) in reply to Carl
    Carl:
    There are a large number of programming problems that involve the use of matrices and linear algebra.
    Yeah, 32 years programming here, and still never found a reason why they put me through the most basic algebra class much less all that college stuff.

    OK so if you're going to be writing robot vision software or a digital multiplexing radio for the next smartphone maybe you'll need that. And maybe you'll need to code your own filesystem too since embedded devices don't have them. But for data processing, web development, operations, sys admin... you know -- where most all the jobs are... learning higher math is an absolute waste of time.

    Maybe you should have gone to a trade school to study programming rather than to college to study computer science. (Although I would be astonished to learn that any college, trade school, etc. was teaching web programming 32 years ago).

  • (cs) in reply to TGV
    TGV:
    F:
    Demos:
    Notice that, for small n, n! < n^3
    More specifically: for n<6, n!<n^3. </div>
    Even more specifically: none of you two have any idea about complexity, do you? For any N, (∀n<N)(O(f(n))=O(g(n)).</div>

    Yes, even: (∀n<N)(O(f(n))=O(g(n))=O(1))

    If you don't have a variable (sized) input, then you can calculate everything in constant time. Eg. I can calculate whether every number below 10^100000 is prime in constant time - by simply iterating through all numbers below that and test if it's a divisor, and not terminating until you've tested all of them. It will be a massive constant though.

    That doesn't mean you can't use the big-Oh notation to determine which algorithm is likely to be better. O(n!) may be better than O(n^3) for small n (n<6), unless the constant hidden in the order is bigger for O(n!). Of course, you can't know for sure easily. But it could very well make sense to change the algorithm:

    if(n < 6) { // Use algorithm O(n!) } else { // Use algorithm O(n^3) }

    Which isn't even necessary if all your matrices are small enough. If you're only using 3x3 and 4x4 matrices, for example...

  • (cs)

    Type Characters: http://msdn.microsoft.com/en-us/library/s9cz43ek(v=vs.71).aspx

    %: Integer &: Long @: Decimal !: Single #: Double $: String S: Short I: Integer L: Long D: Decimal F: Single R: Double C: Char

    *: Unreadable

    Definitely hurts the readability advantage of Visual Basic. Although I do admit casting strings as characters using this convention fairly often.

    Dim strWords() As String = strSentence.Split(" "c)
    
  • (cs) in reply to Some Damn Yank
    Some Damn Yank:
    iToad:
    d = det(X)

    MATLAB FTW...

    Sometimes, the proper use of an appropriate tool eliminates a lot of pain from your life.

    Sometimes, the boss says "I pay you to write code, not buy it. Request denied." In fact, in 32 years in this business I have never used a third-party tool. If it doesn't come with the compiler we can't have it. In one job I worked for an entire department that supported an in-house graphics library we could have purchased, but by then it was deemed cheaper to maintain ours than re-write code to use something else.

    Wow. If my boss was ever stupid enough to pull out a line like that, I'd respond something like this:

    "Yes, you pay me to write code. Approximately ABC dollars per day, in fact. Now if you want me to develop this, I estimate it will take three days to get the basic functionality, and then most likely the better part of a week over the course of the next two years dealing with edge cases. That's over X thousand dollars. Or you could find room for $XYZ somewhere in the budget, which is less than two days' salary for me, and we could have a mature library tomorrow that's already been through that process. It's up to you."

    Of course, if he was that dumb, I wouldn't continue working for him. I currently have a boss who gets it, and I like that.

  • Slapout (unregistered)

    " It’s optimized in the sense that it doesn’t always return the right answer."

    So it was optimized for speed then?

  • Rabble (unregistered) in reply to Some Damn Yank

    Same here. Used matrices first day on the job, and continued to use them for the next 14 years of my career, non-stop.

    Any time you need manipulate an object in > 1D space matrices come into play. Even 2D objects require 3x3 matrices to do all the fancy spinny/scaley effects (think: user interfaces).

    I make videogames, where all the fun and crazy-challenging jobs are. Every videogame programmer worth half his weight in salt knows linear algebra with as much expertise as his programming language of choice.

    /loves his job

  • Rabble (unregistered) in reply to Some Damn Yank
    Some Damn Yank:
    I've worked with programming 5 years now, and I have not encountered a matrix so far.
    And I worked with matrices in my first job. We're even, or at least cancel each other out.

    (^^ in reply to ^)

  • n_slash_a (unregistered) in reply to Carl
    Carl:
    There are a large number of programming problems that involve the use of matrices and linear algebra.
    Yeah, 32 years programming here, and still never found a reason why they put me through the most basic algebra class much less all that college stuff.

    OK so if you're going to be writing robot vision software or a digital multiplexing radio for the next smartphone maybe you'll need that. And maybe you'll need to code your own filesystem too since embedded devices don't have them. But for data processing, web development, operations, sys admin... you know -- where most all the jobs are... learning higher math is an absolute waste of time.

    Yes I even spent several years writing a 3D data visualization package, and I still never needed anything more than an understanding of when to call what trig function to transform a planar coordinate system to spherical. All the heavy math: handled by the graphics card. So still, unless you're making your own graphics card, it is Somebody Else's Problem.

    Somebody Else here. I help program avionics GPSs and about 1/4 of our code is trig functions, matrices, vectors, ect... And yes, I wish I paid more attention in my linear algebra class. Also, just because there is a library to transfer coordinate systems, you still need to know which function to call, and more importantly, if it returned the correct answer.

Leave a comment on “Determined”

Log In or post as a guest

Replying to comment #:

« Return to Article