davv: The bluegreen quadruped. (Default)
[personal profile] davv
I do not like the Allman style, either.

I would write something more here, but... *grumble grumble* (The logical part of myself is even a bit surprised at how much I dislike it.)

Date: 2011-10-04 06:49 am (UTC)
From: [personal profile] lhexa
Speaking of ugly code: I just wrote a program with for loops thirteen deep. The relativistic expression the program is meant to evaluate takes up four lines of scratch paper. And if this expression comes out zero, like several simpler ones have before, I'll hit my head against the desk. :P

Date: 2011-10-06 09:13 am (UTC)
From: [personal profile] lhexa
I don't think recursion can be used here, but I did notice a repeated expression that I can place in a separate set of loops, to reduce the main one to nine loops deep. But the next try will be a different expression, anyway.

The expression is the bracket of two potential invariants, which has to be nonzero (or invertible, if you use more than two) if I am to be able to form a Dirac bracket (which is a way of restricting an original, too-powerful bracket). I'm working with relativistic expressions, so there are summed indices all over the place -- thirteen, in this case. When I wrote down the expression I made it up to pi in the Greek letters.

Also, it turned out to be zero. :P

Date: 2011-10-10 01:58 am (UTC)
From: [personal profile] lhexa
My subsequent attempt succeeded!

Anyway, it looks like doing it that way sacrifices readability for brevity, so it doesn't seem worthwhile here. I can see it being the only viable option when you don't know beforehand how many loops deep your program will go, however.

Date: 2011-10-11 12:54 am (UTC)
From: [personal profile] lhexa
And congrats! I thought the zero meant that you couldn't use your approach at all, not that your implementation was wrong :)

No, your first thought was correct, but I found a different set of invariants that did give a nonzero bracket.

March 2018

S M T W T F S
    123
45678910
1112131415 1617
18192021222324
25262728293031

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 15th, 2026 09:33 am
Powered by Dreamwidth Studios