- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
this beam comes first
Admin
I was so close to being first. I suppose instead of reading the article I should have just made a guess at what it was about and see if my comment stuck or was removed.
Admin
No such thing as a W4x10.
Admin
Heh. Root finding launched me to cult hero status in college, as I managed to be the first person to program my graphing calculator to calculate roots via Newton's Method while showing the work. Made a tedious test question the work of seconds.
Sure it was cheating, but I was a CS major, and I felt it was "better" for my career to be able to hack together the code on my calculator than it was to actually be able to do the math.
Admin
Real wtf is the salesperson not responding with "That feature is in the latest version, I can bring that in for you tomorrow if you like". Almost makes me want to work for that vendor.
Admin
Haha, I loved doing this too. The teachers would proclaim "show your work!" so we wouldn't just let the calculators do it for us. I'd write a little application to show me what my work would have been had I done it out :) I never shared with anybody though... probably would have been a good way to make some friends looking back...
Admin
I don't see how that follows. If the engineer wants a list of beams that meet X criteria, and the program spits out an accurate list, then all is well. If the program cannot be trusted to accurately judge whether or not a beam meets specified criteria, then it's just as invalid whether its talking about one beam, or one-hundred beams.
That's like saying it's the calculator's fault that the engineer made a math error. Regardless of the tools he uses, it's still his responsibility. I remember a case where the engineer was held responsible for a design decision that the contractors made without consulting him: the court decided that he should damn well have supervised.
Admin
It's important not to let your computer calculate too much you know.
It might take more than a second and that's an awful waste of time.
Admin
Heh. This was possibly the best javascript-based introduction to non-linear minimization I have ever read.
Admin
So, the root problem solved like this would be:
Brillant!
Admin
Unfortunately, I don't really have anything relevant to note about today's post. So I'm just going to say thanks for the interactive Javascript root finder - that defnitely added a certain something to the tale for me.
Admin
the real wtf is that parseFloat returns a new number. your function should be called terribleBabylonianGuessPlusStringConcatenation
Note from Alex: Whoops, my bad: the "interactive" babylonianGuess() script has now been fixed. Score one for CDD (Community Driven Development).
Admin
Hmm... the javascript root finder doesn't do so well with finding the root of negative numbers. :)
Admin
I'd like to reiterate my hope that one day we can sticky friends' posts as something to blue-ify for the main page.
Admin
Admin
Admin
Try to guess 0, the answer is NaN !
Admin
Btw I don't understand why if I put 10 and guess 10 the first guess is 50.5 ?
Admin
babylonians couldn't parse floats... and neither can alex
Admin
Admin
I like how if you give the root finder script a decimal number for your guess, it only guesses NaN..
Admin
Admin
OK, you were probably supposed to do it during the exam, rather than just once in your life, but so what :)
(For some things, when you may need to have an intuitive grasp of them, doing them by hand is definitely useful. But AFAIK almost everyone only calculates roots by hand a few times when they first learn it.)
Admin
A typical example of some 'manager' and it's crew designing an application from their point of view, without considering the real users, let alone actually having those real users help designing it or testing it. A shame, as this happens a lot and so many generic software applications could be so much better and so much more useful if people actually bothered to bring in the target audience to help with development (and if those people actually cared to help).
Admin
do { guess = 0.5 * (guess + numbr/guess); } // 0.5 * ("10" + "10"/"10") // = 0.5 * ("10" + 10/10) // = 0.5 * ("10" + 1) // = 0.5 * "101" // = 0.5 * 101 // = 50.5 while (confirm('Refine Further? ' + guess)); // ok do { guess = 0.5 * (guess + numbr/guess); } // 0.5 * (50.5 + "10"/50.5) // = 0.5 * (50.5 + 10/50.5) // basically it works as expected the second time onwards while (confirm('Refine Further? ' + guess)); }
Admin
I started writing a detailed explanation as to why the code gives a poor first approximation, as people are still asking.
About 2 words into it, it occured to me- Did we just get trolled by Alex?
Admin
The university I attended had a professor who not only wrote part of the STL for C++ but was a math major. As such, he offered a down to the metal, C++, math course. It was applying mathematical equations to programming, basically. We dealt with round off errors, IEEE floating point specs (we had to write a version of the entire IEEE spec for one assignment and had to actually manipulate the bits to do it) as well as applying Newton's method to get accurate roots, etc.
Sounds like you guys might have enjoyed it. It had more direct application to programmers than a typical math class. It was one of the best classes I ever took there :)
Admin
You know you're right - I'm not a PE - thats a US term and I work exclusively in Europe, mostly in England and we have different rules, regulations and qualifications. Alex has done a fair job of translating what I told him into Americanese, converting sizes and regulations etc, so cut him some slack.
Why would there be a problem with a computers suggestion? Maths is maths, it doesn't matter if its done by a human or a pc. Potential for screw ups are -1) the program can't add up, in which case its the programmers liability, -2) The engineer makes a stupid choice, engineers can do that without needing to use a computer.
Next point, why did we use GWBASIC over QUICKBASIC. Well GWBASIC was released in 83 and QUICKBASIC came out in 85, sorry but we didn't have a time machine.
Admin
That's what I eventually figured out. Easily done.
Interestingly, because of the multiplication, it does work just fine if you start with an integer (just slightly longer because the first guess was off). And it gives NaN for negative inputs, which is probably correct :)
(It would be more general if it correctly took complex square roots, and obviously more information is always potentially helpful, but there are many applications where NaN is much more meaningful than 3i; and if you want to treat a field more general than R+, you have to choose which square root to return, as there are two; and complex numbers is a natural place to stop, since square roots are again closed in C, but there are other fields where you can take roots so it's not the only correct answer, as it may appear :))
Admin
TRWTF is thinking engineers cannot be good software developers. You know, as in Software Engineering.
Admin
Hi Gabe, have you considered upgrading it from GWBASIC to QUICKBASIC?
Admin
And before all those mentions to square roots of negative numbers trigger it, here is a preventive strike: http://xkcd.com/179/
Admin
Root finding - can't we optimize it a bit and just "guess" that the initial root is the number entered? (Or to optimize further, half the initial value, and then just test for 1).
That way we have an automated square root function.
The next challenge is figuring out what the stop condition is.
Admin
Admin
All it took was someone registering his name for him to realize that maybe, just maybe, he ought to register a name if he plans to continue the regularly scheduled farce.
Admin
I want the square root of 2049.
I think that it is 45.26588119
Would I like to refine further than NaN?
FAIL
Admin
Gabe, this IS TopCod3r so please don't feed the trolls :)
Admin
Why don't you tell me what the square root of -25 is?
Admin
gimme teh codez :)
Admin
Why didn't he just write a script wrapped around the vendor's program to iteratively feed in each beam size and have it print out the ones that passed the test?
Admin
It's obvious the engineering firm was just too stubborn for their own good. All they needed to do was write a program to automatically input values into the forms to try every beam. When will people learn that fear of change is paralysis?
Admin
5i? :)
Admin
Any decent engineer would have have known in 1983 that QUICKBASIC was in development, and would have designed programs using the beta version, as even it was vastly superior to GWBASIC. Obviously that means that your firm was clueless.
Besides, TRWTF is that an engineer would use "83" and "85" to represent dates. Didn't you folks learn anything from that y2k fiasco?
Admin
5i !?!
Admin
That's incorrect.
I'm not a professional - yet. I'm an EIT, and they're wrapping up the paperwork next month.
In order to accept computer calculations as valid for public safety and professional work, it is strongly suggested that you do three sets of calculations:
These recommendations are as a result of the roof collapse at a Save-on-Foods in Burnaby (Yes, it's called Cave-On-Foods by locals) due to a software glitch in the selection of the building materials. Luckily, nobody was killed. There was one injury (trampling) during the panicked customer egress.
The investigation found that if the engineers had done a rough calculation, they would have found that the computer's answers were woefully inadequate. Thus the recommendation of rough calculations. The suggestion of the second computer is because computers are cheap.
Admin
Laughing my a** off! Thank tc
Admin
This code would be better if it was more generic, to deal with decimal and negative numbers (you know, for when engineering goes imaginary).
Please use generify-wand on the code.
Admin
Admin
5j!
Admin
For any positive real number b
sqrt of negative b equals i sqrt of b