Why do we have to use algorithms?

Discussion in 'Programmer's Corner' started by asdf arfw, Dec 21, 2017.

  1. asdf arfw

    Thread Starter Member

    Sep 9, 2017
    43
    0
    It might be a stupid question for you but I really don't understand. I watched this video and I'm wondering if I want to find a peak I can just look at it
    and tell which is the peak. what is the point of using an algorithm?

     
  2. OBW0549

    Distinguished Member

    Mar 2, 2015
    2,855
    2,618
    The point, which should be obvious, is this: a computer can't "just look at it" as you or I would. It can only find the peak value in a data set by executing a logical sequence of mathematical steps, which we call an algorithm.
     
    Last edited: Dec 21, 2017
    xox, atferrari, absf and 1 other person like this.
  3. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    7,815
    3,666

    All electronics is based in math. Or it wouldn't work.
     
    OBW0549 likes this.
  4. Papabravo

    Expert

    Feb 24, 2006
    12,076
    2,611
    Perhaps you have some insight into how a non-algorithmic approach would work. Can you please enlighten us?
     
    OBW0549 likes this.
  5. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    5,698
    6,395
    That's a question only women can answer but how living systems process information is an open question that's unlikely to be completely algorithmic. We are trying to poorly simulate it with computer based AI while still having little success in actually understanding it.
    https://arxiv.org/pdf/1704.06154.pdf
     
  6. MrChips

    Moderator

    Oct 2, 2009
    18,488
    5,859
    Your brain is a parallel processor and an algorithmic machine. You are using an algorithm without realizing it.
     
  7. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    4,159
    6,135
    @MrChips alluded to it:

    A neural network "taught" to recognize peaks. No explicit algorithm necessary.
     
  8. atferrari

    AAC Fanatic!

    Jan 6, 2004
    3,246
    1,266
    In many daily activities we execute lot of algorithms which are not composed of "mathematical" steps but are oriented to achieve a predefined result.

    The OP is somewhat tricky: the TS says: "if I want to....". As long it is you, we could say that you could be looking at the peak not following an "algorithm". But at the end of the journey, tired of looking at that boring peak, if you decide to press a micro into work for that, sure you will resort to an algorithm.
     
  9. MrChips

    Moderator

    Oct 2, 2009
    18,488
    5,859
    Looking at a few objects standing in a row and asking yourself which is the tallest, you may think that you are not using any form of algorithm.

    Now consider the case where you have a million objects and you wish to determine which one weighs the most, how would you do that without some kind of algorithm?
     
    absf likes this.
  10. MrChips

    Moderator

    Oct 2, 2009
    18,488
    5,859
    Here is problem for the TS.

    A supplier packaged 64 steel ball bearings of the same diameter into a bag for a customer. However, the staff that packaged the bearings suddenly realized that one of the bearings was not of the right size but weighs slightly less than all the other 63 bearings.

    How can the staff member find the undersized bearing without having to weigh all 64 bearings?
     
  11. WBahn

    Moderator

    Mar 31, 2012
    24,093
    7,483
    Given a list of ten items you might think that you can just find the largest by just looking at them as a group. But is that really what you are doing? Your brain is somehow managing to see every individual value and somehow compare it to all of the others in such a way as to enable you to find the largest value. But how does your brain do it? We really don't know. We can design parallel circuits that could take in that same set of ten items and process them all at the same time to decide which is the largest, but the complexity grows exponentially as the number of items increases. The same appears to happen with your brain. Instead of a list of ten items, imagine a sheet filled with a thousand three digit numbers. You can still all of them at once, but can you confidently find the largest by "just looking at it"? No. At that point you are going to start using some systematic approach to scan the field of numbers, remembering things as you go along. You are now using an algorithm.

    Consider any number of things we do, even as small kids. Sorting a set of playing cards or doing a word search puzzle. For problems of small size, we think we just "do it", but when we sort a whole deck of playing cards or do a large word search puzzle, we start getting systematic about it. The kids that are more likely to make good engineers some day are the ones that spend the time to figure out efficient and effective ways of doing such tasks and always asking themselves if there are even better ways that what they currently know.
     
  12. philba

    Active Member

    Aug 17, 2017
    959
    302
    I generally look to the dictionary to start with:
    al·go·rithm
    ˈalɡəˌriT͟Həm
    noun
    a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
    "a basic algorithm for division"

    So, in just "looking at it" do you follow a process? (rhetorical question, of course you do) Perhaps you are thinking of a sequential algorithmic process. There are a number of non-sequential processes like neural networks and fuzzy logic but each has drawbacks (and strengths). In the end, they are all implemented on a turing machine type device so they are simulated with sequential logic.
     
  13. Papabravo

    Expert

    Feb 24, 2006
    12,076
    2,611
    It was a rhetorical question for the TS. No need for your contribution on this one.
     
  14. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    4,159
    6,135
    I was driving as I read this (stopped at a light). I looked out the windshield and immediately identified about 30 vehicles of various shapes and sizes, a bunch of trees, the road and its surface, a leaf blowing across the road, a church and its steeple, a construction site with various vehicles including shovels, dump trucks, and pickup trucks, blades of grass in the median, yellow and white stripes on the road surface with matching reflectors spaced periodically, power lines, the poles upon which the lines were mounted, an airplane (commercial jet flying about 5,000 ft. heading east to the airport), and a couple of birds against the background of a partly cloudy sky.

    Now, granted, if you asked me to identify each of the 30 cars by make, model, and color, I'd fail miserably. But I find it rather amazing that I executed the identify_environment() function almost immediately without any apparent associated algorithm.

    Edit: my point being that identify_environment() seems to be a far more complex (infinitely complex?) process than a simple sort() of any number of objects -- yet I can do the first far faster and without thinking about it.
     
    Last edited: Dec 21, 2017
    absf likes this.
  15. philba

    Active Member

    Aug 17, 2017
    959
    302
    That's because you have a massively parallel processor that is built to do pattern recognition.
     
  16. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    4,159
    6,135
    And I built it all by myself! :)
     
  17. philba

    Active Member

    Aug 17, 2017
    959
    302
    lol, more than you know. Every time you look at something, you are adding to it.
     
  18. WBahn

    Moderator

    Mar 31, 2012
    24,093
    7,483
    Agreed. Though it took a lot more effort than you probably realize. For instance, if you were to be blindfolded and then allowed to look out the windshield for one second before having the blindfold put back in place, you would be hard pressed to reconstruct that list (and it would be a lot more error filled). Your brain was processing your environment for quite some time before you did your little experiment and so much of the information that you observed was already in the model contained in your brain.

    But there is no doubt that the human brain (any critter's brain) is an amazingly powerful processor. What is equally amazing is the list of the things it is fabulously powerful at, such as complex pattern recognition, as well as signal extraction, estimation and prediction; but also the list of things that it is horrible at, such as most things related to probability. Interestingly, historically the brain has been good at things that computers were horrible at and vice versa. We are just now starting to make significant inroads into having computers become reasonably proficient at some of the things that come very naturally even to infant humans.
     
  19. Glenn Holland

    Active Member

    Dec 26, 2014
    629
    317
    On the subject remotely related to algorithms and reasoning, my mother was a piano and organ instructor and some gifted people can easily recognize and quickly memorize musical patterns.

    Many musicians can play Bach's organ works by ear after listening to a recording only a few times. Bach's complete organ works is on 12 CDs so if you compare how much a musician has in memory to the equivalent gigabytes on CD, it's quite astounding.

    Seems the algorithm involved in memorizing music would involve recognizing a logical relationship between audio frequencies and also their rhythm.
     
  20. MrChips

    Moderator

    Oct 2, 2009
    18,488
    5,859
    If you are not a musician you may not realized that it is easier than that. You don't have to know anything about audio frequencies. There are only twelve notes in the western musical scale. In any given song there will be two or three prominently recurring notes, which in music theory we call root, third, and fifth. Hence pitch and rhythm can be memorized very easily once you have an ear for it.
     
Loading...