HN user

amplitwist

39 karma
Posts0
Comments10
View on HN
No posts found.

Consider the solution to the quadratic equation

x = (-b ± sqrt(b^2-4ac))/(2a)

What is x? What is a? The wonderful thing about math is that it doesn't matter. x could be length, dollars, area, volume, mass, potatoes, lines of code, chickens, or electron-volts. But in the general case, it represents a number. Why would anyone consider it an improvement to write

Given that number1 answer^2 + number2 answer + number3 = 0, answer = (-number2 ± sqrt(number2^2-4 number1 number3))/(2 number1).

The extra characters convey no additional semantics. Even when presented with an equation where things have specific units, you can usually mentally figure out the units of everything else, due to conventions, previous definitions, and mental dimensional analysis.

In my experience, the notation isn't so much of an issue as knowing definitions, closely followed by being able to translate those definitions into intuition. You must be able to remember them exactly, otherwise nothing makes any sense, and you must have an intuition for what they mean, otherwise you'll never get anything done. Consider some terms from a recent talk I attended that was outside my immediate areas of expertise: "solvable Lie group", "left-invariant metric", "upstairs", "double cover". I was able to understand the main idea of the talk, but my full understanding of the talk was sunk by not knowing the definition of left-invariance [1].

Since math is inherently abstract, it is hard, and there is no substitute for the hard work necessary to acquire an intuition for it. When doing high-level math, it is necessary to have a rigorous intuition for the subject, where you are able to intuitively see a path to a proof, and then are able to translate that intuition into a suitably rigorous argument.

[1] To illustrate my point that knowing definitions precisely is one of the keys to understanding math, here's the definition of a left-invariant metric. Let G be a Lie group with metric <,>, L_g be left multiplication, and L_g^* denote the pullback of L_g. The metric is said to be left-invariant if L_g^* <u,v> = <u,v> for all u,v in G. It makes no sense unless you know what metrics, Lie groups, left multiplication, and pullbacks are, and you'll only shoot yourself in the foot if you can't define them precisely.

At work (I'm a physics/mathematics guy developing quantum optical simulations):

Fortran 2003/2008

C++

LaTeX

Sage

Mathematica

Haskell (My initial experiments look promising; ghc+llvm has consistently beaten gcc and gfortran when doing RK4 integration of complicated functions. I'm currently testing array performance with REPA.)

Emacs

Dislin (Looking for a replacement, since it's a real pain to use)

Charm++ (Looks promising, but also seems hard to use.)

MPI

At home: Haskell

Emacs, but it's still hard to do. That code excerpt is nothing compared to what I have worked with in some code I no longer I have access to; some of the formulas stretched on for about 6 lines of 80 chars each. It's not so much the unbalanced parens as it is about having the wrong thing in the denominator of a gigantic multilevel fraction.

I work on numerical simulations, where I deal with colossal arrays of floating point numbers on hundreds or thousands of nodes. I want tools that can help with the following:

1. Visualizing code. Rendering C++ and/or Fortran as LaTeX would be very helpful for lines of code like this, where I've spent too much time tracking down misplaced parens:

    k1(1,1)=-Im*(Omega_minus_n*(rho13(i,j)+conjg(rho12(i,j)))-Omega_plus_n*(rho12(i,j)+conjg(rho13(i,j))))+gamma1*(rho22(i,j)+rho33(i,j))
2. A better way to debug and test mathematical programs. Debugging is extremely hard when you have thousands of processes doing calculations that aren't reproducible by hand, so it's very difficult or impossible to create test cases for subunits of the program. The only tests are Fermi calculations and comparison of the whole program's output with an analytical solution, which is often not possible, and is not useful for debugging.

3. A language with the following characteristics: - Within 10% of Intel/PGI Fortran on tight numerical loops - Array and distributed/concurrent syntax with lightweight threads and syntactical support for GASnet/MPI. - Parallel load balancing, preferably across nodes. A few of the algorithms I use are adaptive or have parts of the solution domain that require much more work than other parts, leading to situations where naive/maintainable MPI code leaves most processors idle. - Hindley-Milner type inference, typeclasses/typeclass-like features, operator overloading/syntax extension, and effortless interoperation with C/Fortran. An IDE with syntax rendering like Maple or Mathematica's would be a HUGE plus. I don't know why this doesn't exist for usably fast languages. - Supports an interactive mode with easy visualization

The closest language I've seen is Cray's Chapel, but there are several things I don't like about it. Its imperative/oo design and lack of first class functions/tco are unacceptable, since the algorithms I use need to use the integer side of the machine as well as the floating point ones. Right now I use either Charm++ (http://charm.cs.uiuc.edu/) with Intel's array syntax, or Fortran 2008 for some inherited code. C++ has non-ideal semantics for numerical code, and doing non-trivial algorithms in Fortran is still a nightmare, especially when using MPI, as communication code quickly becomes the main part of the program. Something like Sisal (http://sourceforge.net/projects/sisal/), if it was modernized and extended to distributed architectures, would be amazing. It used to beat typical Fortran by 20%.

4. I absolutely need to account for cache behavior, otherwise my simulations will take months to run instead of weeks. I would love anyone who wrote a practical tool that automatically tiled loops, since doing this manually turns code into an unmaintainable rat's nest very quickly, or wrote a library of skeletons for tiled loops and cache oblivious algorithms.

I think it's pretty obvious what I'm talking about. The comment I was replying to suggested that people would be imprisoned for thoughtcrime. The original comment was disagreeing (slightly) with someone that has a very left-wing view of "social justice" or whatever. People like the person above clearly haven't learned their lessons about censorship, because there is a fair chance that even those with the "correct" politics like the author will disagree with the censors at some point, which could lead to imprisonment or death. Furthermore, you illustrate my point about people viewing their political opposition as evil perfectly, because instead of responding to me in a serious fashion, you call me mentally unstable.

People like you scare me, because you are so ignorant of history. While we might be heading towards a uber-PC socialist nightmare, one could argue just as easily that we'll end up in a hell like fascist Italy, where leftists were rounded up and shot for their opinions. You also scare me because you are so sure that you're right, and those that disagree with you are not just wrong, but evil. I disagree with you, but I don't think you should go to jail for it.

    The best lack all conviction, while the worst
    Are full of passionate intensity.
    
    -- William Butler Yeats

Thanks for the reply; I was wondering what key that it shifted to, since everything sounded weird when I tried it. I just do this stuff by ear and guess the key, but I've never had any music theory training. How do you recognize the key once you have the chords?

Actually, this is a fairly unusual song, in music theoretical terms. Almost all pop songs use the I, ii, IV, V, and VI chords, with popular progressions including I-IV-V, ii-V-I, and I-V-VI-IV. Since this is tonal music, it obviously includes the I chord. It does use only four chords, but they are uncommon. Most of the song uses the I chord (G major in this case), but during the buildup, it uses an surprising I-II-III-I-II-vii progression. The II and III chords aren't strictly in the key of the rest of the song, although they still blend well with the in-key chords. vii is just F# minor here, but it is not in the key of the rest of the song either. vii is not often seen in pop/rock/classical music; you often see vii° instead, since it is in-key. I can't argue with Psy's choices, though, since that little riff builds a lot of tension.

There's another article that makes an attempt to disentangle nature and nurture in the sex gap at http://www.lagriffedulion.f2s.com/math2.htm . Like I mentioned earlier, these articles are a few steps above Fermi problems; there are ways to calculate these things more accurately. However, these calculations should agree with the estimates, and the estimates indicate a significant genetic gender gap.