Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/13/2012 in all areas

  1. Just someone who needs a more graphical explanation. :-)Big-O notation is all about asking the question, "As my data set gets bigger, how much longer will this operation take?" Consider two decks of cards: a standard 52-card playing deck and an Uno deck with 108 cards. Both of them are in boxes. I can take each deck out of its box in about the same amount of time -- I just dump all the cards out into my hand at once. Since it takes the same amount of time no matter how big the deck is, we call this constant time. As the deck gets bigger, the operation is the same length. Obviously there's an upper bound in this example since at some point the deck will be big enough it'll be bigger than my hand, but we're talking theory here. :-) The time is some constant k. Since the shape of a the graph is the real point of interest, it doesn't matter what number we pick, so this is called O(1). If I sit at my desk and flip each of the cards into the trashcan, one per second, it'll take me 52 seconds for the standard deck and 108 seconds for the Uno deck. That's an operation that grows linearly -- as the size of the deck gets bigger, the time to do the operation goes up as a pure multiplier. In this case, the multiplier is "1 second". If we say that the size of the deck is N, then the function to find the time is k*N. Or, since the shape of the graph is all we care about, we can ignore the constant, and this is just O(N). Ok. I tossed all the cards in a trash can one by one. Now I need them back in sorted order. Oh dear. Now, I could get lucky -- I could scoop them off the floor and discover that by sheer chance I have picked them up in order. That's the best case. But big-O is all about the *worst* case. In the worst case, I have to pick up the cards and sort them. Suppose I were to scoop up all the cards and then leaf through them to find the 2 Clubs, and put that on top of the deck. Then look through for the 3 Clubs and put that on top, and repeat for every card. I could be very unlucky -- when I search for each card, it might be the very last card in the deck. If the cards are exactly in reverse order, worst case, then for each card, I have to look through all the remaining cards. Ug. The first few cards are very fast (there aren't many cards to look through), but it gets slower as I go. The early cards and the later cards average out, so for N/2 cards, you have to look through N/2 existing cards. N/2 * N/2 = N^2/4. Again, we don't care about the constant, so this is just O(N^2). Searching functions are generally O(N) for unsorted data and O(log N) for sorted data. Sorting functions are generally O(N^2) for dumb-but-easy-to-implement algorithms and O(N log N) for intellegent-but-often-have-off-by-one-errors algorithms. We call any function that is N^2, or N^3 or N to any power a "polynomial time function". These are generally tractable, useful algorithms. We call any algorithm that is 2^N or 3^N or any other constant raised to the N exponential. These often require more time to solve than is available for the time we have to solve the problem. Then there are the N^N algorithms or the N-star algorithms which generally cannot be solved in the life of the universe. N-star means if there is 1 item, the algorithm takes 1 second. 2 items takes 2^2 seconds. 3 items takes 3^3^3. 4 items takes 4^4^4^4, and so on. Ug. :-) Luckily, we don't have to guess. It's called math. :-)
    2 points
  2. Here are this year's limericks...including the one I forgot the words to while I was on stage! A Quick Drop programmer named Nate Devised a plugin so great! But when he pressed Ctrl-Space He soon got a long face When it said, "Populating List...Please Wait." My UIs you all will extol, 'Cause I only use Silver Controls. My only real problem Is that when I drop them They eat up space like a black hole. For ten years we've had egg on our face. Event Structures were missing in Base! But now they are there Which lets us declare That all polling loops are a disgrace! A Tools Network partner named Klaus Was an expert with Quick Drop and mouse. The add-on he sold Was certified gold And its revenues paid for his house. There once was a coder named Norm Who used LV Speak during a storm. Not wanting to go out He let out a shout-- "Get Pizza!"...and food arrived warm. My VIs were password-protected. So why am I now so dejected? Some noobs made some toys Which sadly destroyed The edifice NI erected. Thanks again to Justin for writing some of these...his are the good ones.
    2 points
  3. I've been following these forums for over five years now and can't articulate how much I get out of reading the threads. (I credit passing my CLD-R to reading them.) Over the years I've recognized the gulf that exists between my background and many of yours and have, more and more, wanted to narrow it. (I've often felt guilty about participating in a forum for Advanced Architects, because I'm neither.) I'd like to begin to change that, however, by studying the fundamentals of Computer Science. Higher education is changing drastically in many exciting ways (don't get me started on how it' looks like a bubble getting ready to burst) and I've begun participating by taking some free, online classes. I'm better than half-way through CS253, Web Application Engineering, on Udacity.com and have signed up for Algorithms, Part 1 and Statistics 1 on Coursera.org starting in August. I've seen many other courses I'd like to take, and I'd like to ask for advice on how to begin. Specifically, Coursera is going to offer a class on Automata, based on a 100-level course taught at Stanford University. While reading the course description I followed the link to I read the introduction and table of contents and think it's worth buying (don't have to, though, 'cuz it's online ), and the course worth taking. My questions for you are: will the CS courses mentioned above help me move in my desired direction, and what other resources do you recommend for beginning a Computer Science education? I understand that what I'm going to do will take a lot of effort and time and I'm open to taking college classes (but I don't prefer that route), online courses, reading books (purchased or online)... Just about anything, really. Do you have a favorite book that will help? I'd appreciate any advice you can give. Thank you.
    1 point
  4. [This is a follow-up on my presentation TS 8237 "State Pattern Implementation for Scalable Control Systems" delivered at NI Week.] Consider the following state machine: . Consider also an implementation of this using the State Pattern, where the different states are objects. Now examine the desired behavior for exit and entry actions for the transitions D to E and D to F. D to E: We expect to execute the exit method for D and the entry method for E (but not the entry or exit methods on the parents). D to F: We expect to execute the exit methods for D and B and the entry methods for C and F (but not the entry and exit methods on A). In other words, when executing exit and entry actions we want to stop at the least common ancestor (LCA) of the main source and main target states. [There is a good description of this here: http://www.amazon.co...&keywords=samek.] It is possible to do this in an inelegant fashion by adding specific code for the purpose in various places, but I'm pretty sure the only elegant solution for this (i.e., within the framework) requires reflection (not yet available in LabVIEW). Comments?
    1 point
  5. Well. As you know. It is the integral term that dampens ringing and overshoot. +-0.02v out of +-10V is 0.2% of FSD and I expect that is within the spec of the device. So the choices as I see it in the absence of being able to increase the integral and without getting into process modelling are: 1. Apply a 50-60Hz band-stop filter on the input (try and reduce the amplitude of the mains signal). 2. Apply a median filter to the Derivative term (reduce the feedback sensitivity to noise) 3. Introduce a dead-band (turn off control when within set limits-good for mechanical systems) 4. All or a combination of the above.
    1 point
  6. I'm late to this, but I wanted to make a recommendation for a project you should do someday: Build a compiler for a programming language. Just a small one. Sounds complicated, right? Really, it's not that bad. At its core, a compiler just translates information from one form to another. I guarantee, though, that you will learn more about how CS is applied than in just about any other project. And, it turns out, a huge number of day to day, real world problems can be solved with the exact same ideas that compilers implement. There are tons of resources on Google for compiler building. Good luck! Joe Z.
    1 point
  7. One or two nitpicks. GetLastError() queries a thread global variable in kernel32.dll and therefore can and usually only does return the right answer if called in the same thread than the function that caused the error. This might seem like being guaranteed by running the actual function call and GetLastError() in the UI thread, BUT unfortunately that doesn't work like that. LabVIEW is free to schedule other UI calls between the two CLNs such as drawing something in the front panel and many of those functions can also set the last error so the actual error caused by the first CLN might be already overwritten, when this VI tries to read it. The solution is to make the VI subroutine priority, which will tell LabVIEW to execute the entire VI in the same thread without scheduling anything in between but that also requires to make the CLNs run in any thread, as subroutine VIs can not contain code that can run asynchronously such as CLNs set to run in the UI thread. Also GetErrorStatus needs to be changed to subroutine as well as a subroutine can only contain subroutine VIs. Last but not least, GlobalMemoryStatusEx() returns a status of FALSE (0) on error and TRUE (<>0) on success. The GetLastError() and CO should only be executed when GlobalMemoryStatusEx() indicated a failure as Windows functions are not supposed to change the last error value on success at all, and you might retrieve a last error value from a previous API call somewhere in LabVIEW. Get Win32 Error Message.vi GlobalMemoryStatusEx.vi
    1 point
  8. lol. Great job. They don't normally check but I have been done once for overweight carry-on - they made me weigh the bag and then made me check it in I was screwed from the start as my laptop was an old, big, heavy Dell P4 and it weighed pretty much the limit I didn't feel that bad putting it in the hold tho, as it was a work PC Mental note: do not upset Asbo at LAVA BBQ
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.