Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. convert Metric to English and English to Metric using pseudocod

convert Metric to English and English to Metric using pseudocod

Scheduled Pinned Locked Moved Algorithms
designalgorithmshelptutorial
80 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 123 0

    Stephen Hewitt wrote:

    just because a system is composed of simple components doesn’t imply a lack of complexity; the complexity is often in the interactions

    But it does imply that if we can fully understand the simple components, we can build a machine that replicates the behavior of the larger system without needing to understand all of the complex interactions before we do; and that we'll be in a better position to understand those complex interactions after we replicate them using just our understanding of the underlying and simpler components. For example, after constructing a mechanical or computer replica of ants making random turns and dropping pheromones when they have food in hand, we can better understand the behavior of the colony as a whole. The point being that this kind of investigation is doable - we can make immediate progress on the first step because it is simple; and that having made that progress, it will be easier to take a next step, etc. And that's the kind of thinking and doing we advocate. Start with something small and simple - even if you don't understand the whole thing - and see what happens. But always insist on small and simple. The other camp says, "If you don't fully understand the complex mathematics underlying aerodynamics and can't build a 400-passenger airliner capable of transatlantic flight, then get back to the bicycle shop boys, because you're nothing but quacks". Take your pick.

    E Offline
    E Offline
    El Corazon
    wrote on last edited by
    #46

    The Grand Negus wrote:

    But always insist on small and simple. The other camp says, "If you don't fully understand the complex mathematics underlying aerodynamics and can't build a 400-passenger airliner capable of transatlantic flight, then get back to the bicycle shop boys, because you're nothing but quacks".

    So you are saying anyone can and should build a 400 passenger airbus to cross the ocean, without understanding aerodynamics, fuel consumption, weight loss to fuel use balance dynamics? You are more far gone than I thought! Well, go for it! But I can guarantee you that you shall NEVER achieve flight unless it is just long enough to kill all the witnesses. Madness. But keep those monkeys typing, sooner or later they will type out a full copy of war and peace through random strokes. When they do, call me, you can laugh then. Until then, the rest of us have real work to accomplish, and are doing so, including aerodynamics and spatial physics, in 4+ dimensions. You can stick to your one dimensional thought, personally I prefer a wider universe of movement or my legs fall asleep. I don't make mountains out of molehills, if anything through quaternion mathematics I have reduced complexity by increasing dimensions. There is never more math than needed, which is far more than you will ever understand.

    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

    1 P U 3 Replies Last reply
    0
    • E El Corazon

      The Grand Negus wrote:

      But always insist on small and simple. The other camp says, "If you don't fully understand the complex mathematics underlying aerodynamics and can't build a 400-passenger airliner capable of transatlantic flight, then get back to the bicycle shop boys, because you're nothing but quacks".

      So you are saying anyone can and should build a 400 passenger airbus to cross the ocean, without understanding aerodynamics, fuel consumption, weight loss to fuel use balance dynamics? You are more far gone than I thought! Well, go for it! But I can guarantee you that you shall NEVER achieve flight unless it is just long enough to kill all the witnesses. Madness. But keep those monkeys typing, sooner or later they will type out a full copy of war and peace through random strokes. When they do, call me, you can laugh then. Until then, the rest of us have real work to accomplish, and are doing so, including aerodynamics and spatial physics, in 4+ dimensions. You can stick to your one dimensional thought, personally I prefer a wider universe of movement or my legs fall asleep. I don't make mountains out of molehills, if anything through quaternion mathematics I have reduced complexity by increasing dimensions. There is never more math than needed, which is far more than you will ever understand.

      _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

      1 Offline
      1 Offline
      123 0
      wrote on last edited by
      #47

      Y'know, Jeffry, I think you've got a bit too much of your self-esteem tied up in this math thing. Perhaps it's time we turn out the lights and dream of Mr Edison doing (or not doing) quaternion mathematics in 4+ dimensions...

      E P U 3 Replies Last reply
      0
      • 1 123 0

        Y'know, Jeffry, I think you've got a bit too much of your self-esteem tied up in this math thing. Perhaps it's time we turn out the lights and dream of Mr Edison doing (or not doing) quaternion mathematics in 4+ dimensions...

        E Offline
        E Offline
        El Corazon
        wrote on last edited by
        #48

        or perhaps you turn out the lights and dream of crashing a space shuttle for inaccurate math! :wtf:

        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

        U 1 Reply Last reply
        0
        • E El Corazon

          The Grand Negus wrote:

          But always insist on small and simple. The other camp says, "If you don't fully understand the complex mathematics underlying aerodynamics and can't build a 400-passenger airliner capable of transatlantic flight, then get back to the bicycle shop boys, because you're nothing but quacks".

          So you are saying anyone can and should build a 400 passenger airbus to cross the ocean, without understanding aerodynamics, fuel consumption, weight loss to fuel use balance dynamics? You are more far gone than I thought! Well, go for it! But I can guarantee you that you shall NEVER achieve flight unless it is just long enough to kill all the witnesses. Madness. But keep those monkeys typing, sooner or later they will type out a full copy of war and peace through random strokes. When they do, call me, you can laugh then. Until then, the rest of us have real work to accomplish, and are doing so, including aerodynamics and spatial physics, in 4+ dimensions. You can stick to your one dimensional thought, personally I prefer a wider universe of movement or my legs fall asleep. I don't make mountains out of molehills, if anything through quaternion mathematics I have reduced complexity by increasing dimensions. There is never more math than needed, which is far more than you will ever understand.

          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #49

          Jeffry J. Brickley wrote:

          So you are saying anyone can and should build a 400 passenger airbus to cross the ocean, without understanding aerodynamics, fuel consumption, weight loss to fuel use balance dynamics? You are more far gone than I thought!

          :laugh: I sure wouldn't get in his airplane :rolleyes:


          Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

          U 1 Reply Last reply
          0
          • 1 123 0

            Y'know, Jeffry, I think you've got a bit too much of your self-esteem tied up in this math thing. Perhaps it's time we turn out the lights and dream of Mr Edison doing (or not doing) quaternion mathematics in 4+ dimensions...

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #50

            The Grand Negus wrote:

            you've got a bit too much of your self-esteem tied up in this math thing

            :|:zzz:


            Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

            U 1 Reply Last reply
            0
            • 1 123 0

              Stephen Hewitt wrote:

              Or more succinctly: f = 9/5*c+32 Where "c" is degrees centigrade and "f" is degrees in fahrenheit.

              And what language is that last line?

              Stephen Hewitt wrote:

              Not only is it clearer but also more useful. Using the basic rules of algebre I can derive the f->c conversion as follows: f = 9/5*c+32 f-32 = 9/5*c (f-32)*5 = 9*c (f-32)*5/9 = c So c = (f-32)*5/9

              Let me make this perfectly clear, at least between you and I, once and for all. We're not saying that algebra is useless, or that algebraic notation is less appropriate than Plain English for certain specific tasks. We're saying that algebraic notation is more easily thought of as a sub-language of English rather than the reverse. We're saying that an intelligent machine should understand both; specifically, it should understand the sub-language in the context of the larger, natural language - exactly as you have used both "languages" in the quotations above. The letters "c" and "f" can be appropriate abbreviations, in certain contexts, but only if their meanings are clearly defined at a higher, more descriptive level. The reason we are emphasizing (at this time) the natural language aspect is that computers already know how to parse, manipulate, and otherwise process algebraic notation - but they don't know how to deal with natural languages with the same level of expertise. And because most programmers are unaware of the amazing power and flexibility that natural languages possess. C'mon - off the top of your head, would you think that an efficient native-code-generating compiler could be conveniently written in English?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #51

              The Grand Negus wrote:

              Stephen Hewitt wrote: Or more succinctly: f = 9/5*c+32 Where "c" is degrees centigrade and "f" is degrees in fahrenheit. And what language is that last line?

              The language is math, or more specifically, algebra! The writing of the sentence is in the script of English. Computers and programming were invented in the images of math and science, which has its own miriad of languages.

              Dave Kreskowiak Microsoft MVP - Visual Basic

              U 1 Reply Last reply
              0
              • 1 123 0

                Stephen Hewitt wrote:

                In short, I contend that your example was a bad example of the merits of plain English.

                Agreed. Mathematical relations are a weak point in every natural language; that's why things like algebraic notation are invented in the first place. But I didn't get the choose the example here - the problem assigned by the instructor was clearly math-centric. Nevertheless, I'm quite sure that a complete solution to the given problem - including the interface, etc - would include a much smaller percentage of formulaic matter and would therefore benefit from the "compiled pseudocode" I recommended. It's not unlike a MIDI music machine I programmed years ago on and Apple II. There were certain routines that, for performance, had to be written in assembler. But the bulk of the program was much more easily written, tested, modified, and perfected in Applesoft Basic (a more English-like language). Besides, formulaic languages reach their "limits" very quickly (no pun intended). Consider, for example, this natural language description of an object:

                a two-inch aluminum cube with a quarter-inch spherical void at its center

                What's the formula for that? And for the other zillion things that can be easily described in half a sentence but that nevertheless defy mathematical description?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #52

                The Grand Negus wrote:

                Besides, formulaic languages reach their "limits" very quickly (no pun intended). Consider, for example, this natural language description of an object: a two-inch aluminum cube with a quarter-inch spherical void at its center What's the formula for that? And for the other zillion things that can be easily described in half a sentence but that nevertheless defy mathematical description?

                BS! Do you want to retract this example before or after I direct your attention to NURBS? A two inch cube with a cavity in the middle CAN be represented mathematically. Or did you forget about the existance of Maya, AutoCAD, Rhino3D, [many more]??

                Dave Kreskowiak Microsoft MVP - Visual Basic

                U 1 Reply Last reply
                0
                • 1 123 0

                  PaulC1972 wrote:

                  That's not necessary, just look at the "nasty" replies you get

                  But from how many of the larger community here? A handful of cranks do not a majority make. Besides, I don't say what I say because it's popular (or not). I say these things simply because I believe them to be true. In other words, even if I got three million nasty remarks on this forum, I'd still be compelled to say the same kind of things.

                  S Offline
                  S Offline
                  Sebastian Schneider
                  wrote on last edited by
                  #53

                  >> do not a majority make Yoda! You're back! ;)

                  Cheers, Sebastian -- Contra vim mortem non est medicamen in hortem.

                  1 Reply Last reply
                  0
                  • E El Corazon

                    xcom2001 wrote:

                    as a teaching aide to help me understand how this works.

                    I will add some background, since ... other ... discussions led astray this discussion. Pseudo code is not meant to compile, deliberately. Think of it as programmer short-hand. What I posted was close to Pascal in structure, but need not be, you will find C like references of pseudo code. program Celsius To Fahrenheit (input: double celsius) begin // Convert Celsius to Fahrenheit. double fahrenheit = (celsius * 9 / 5) + 32 return fahrenheit; end or purely algorithmic Celsius to Farhrenheit fahrenheit = (celsius*9/5)+32 return fahrenheit Pseudo code originated as an alternative to flowcharts, which for Fortran programming could become very long and tedious drawings. The goal was to design your code, not write it "yet" so it should be A) shorter than your actual code B) be easy to write, without any formal rules, but should be consistent in what ever rules it uses. Back in the Fortran era, language, and column (yes good old punch-card limits) rules made full program writing difficult, thus pseudo code was a way of exchanging ideas and perfecting ideas. There is a REAL reason behind this. As you are designing an algorithm you want to be able to shape it, change it rapidly, yet also be able to understand it. If it follows any persistent "syntax" it gets bogged down in rules than make it wordy and/or impossible to maintain, again like flow-charts. It should be consistent in what few rules it does use for ease of peer-exchanges. The goal is not to finish your code, period. Not with pseudo code at least. Pseudo code or UML or flowcharts are what you bring to design-reviews. Obviously if you have a finished product, and you made poor assumptions in your design, you've just wasted everyone's time by trying to short-cut the process. So Pseudo code is fast, friendly and "similar" to what ever language you are using with absolutely the most minimal rules. In this way a design review can review the pseudocode, you can show what you intend to do without wasting too much time in doing so. You can change that code rapidly from input in the design review, or shortly thereafter. For my design reviews I use a combination of pseudo code, uml flow diagrams and mind-maps. Given the original purpose, the speed of which to A) design code B) present your design C) standardized exchange of peer thought... This combination works well.

                    U Offline
                    U Offline
                    User 12346520
                    wrote on last edited by
                    #54

                    thanks: https://movied.org

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      The Grand Negus wrote:

                      Besides, formulaic languages reach their "limits" very quickly (no pun intended). Consider, for example, this natural language description of an object: a two-inch aluminum cube with a quarter-inch spherical void at its center What's the formula for that? And for the other zillion things that can be easily described in half a sentence but that nevertheless defy mathematical description?

                      BS! Do you want to retract this example before or after I direct your attention to NURBS? A two inch cube with a cavity in the middle CAN be represented mathematically. Or did you forget about the existance of Maya, AutoCAD, Rhino3D, [many more]??

                      Dave Kreskowiak Microsoft MVP - Visual Basic

                      U Offline
                      U Offline
                      User 12346520
                      wrote on last edited by
                      #55

                      thanks: https://movied.org

                      1 Reply Last reply
                      0
                      • P Paul Conrad

                        Jeffry J. Brickley wrote:

                        So you are saying anyone can and should build a 400 passenger airbus to cross the ocean, without understanding aerodynamics, fuel consumption, weight loss to fuel use balance dynamics? You are more far gone than I thought!

                        :laugh: I sure wouldn't get in his airplane :rolleyes:


                        Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

                        U Offline
                        U Offline
                        User 12346520
                        wrote on last edited by
                        #56

                        thanks: https://movied.org

                        1 Reply Last reply
                        0
                        • P Paul Conrad

                          The Grand Negus wrote:

                          you've got a bit too much of your self-esteem tied up in this math thing

                          :|:zzz:


                          Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

                          U Offline
                          U Offline
                          User 12346520
                          wrote on last edited by
                          #57

                          thanks: https://movied.org

                          1 Reply Last reply
                          0
                          • E El Corazon

                            or perhaps you turn out the lights and dream of crashing a space shuttle for inaccurate math! :wtf:

                            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                            U Offline
                            U Offline
                            User 12346520
                            wrote on last edited by
                            #58

                            thanks: https://movied.org

                            1 Reply Last reply
                            0
                            • 1 123 0

                              Stephen Hewitt wrote:

                              just because a system is composed of simple components doesn’t imply a lack of complexity; the complexity is often in the interactions

                              But it does imply that if we can fully understand the simple components, we can build a machine that replicates the behavior of the larger system without needing to understand all of the complex interactions before we do; and that we'll be in a better position to understand those complex interactions after we replicate them using just our understanding of the underlying and simpler components. For example, after constructing a mechanical or computer replica of ants making random turns and dropping pheromones when they have food in hand, we can better understand the behavior of the colony as a whole. The point being that this kind of investigation is doable - we can make immediate progress on the first step because it is simple; and that having made that progress, it will be easier to take a next step, etc. And that's the kind of thinking and doing we advocate. Start with something small and simple - even if you don't understand the whole thing - and see what happens. But always insist on small and simple. The other camp says, "If you don't fully understand the complex mathematics underlying aerodynamics and can't build a 400-passenger airliner capable of transatlantic flight, then get back to the bicycle shop boys, because you're nothing but quacks". Take your pick.

                              U Offline
                              U Offline
                              User 12346520
                              wrote on last edited by
                              #59

                              thanks: https://movied.org

                              1 Reply Last reply
                              0
                              • 1 123 0

                                Stephen Hewitt wrote:

                                Possibly, but you can't just know how to make a transistor and make a computer: you have to know how to put them together.

                                Of course not. I never said anything like that. I said that having made a transistor, and hooking a few of them together to "see what happens", you'll be in a better position to take the next step, and the next, eventually leading to a computer. Are you purposely being contrary?

                                U Offline
                                U Offline
                                User 12346520
                                wrote on last edited by
                                #60

                                thanks: https://movied.org

                                1 Reply Last reply
                                0
                                • E El Corazon

                                  The Grand Negus wrote:

                                  But always insist on small and simple. The other camp says, "If you don't fully understand the complex mathematics underlying aerodynamics and can't build a 400-passenger airliner capable of transatlantic flight, then get back to the bicycle shop boys, because you're nothing but quacks".

                                  So you are saying anyone can and should build a 400 passenger airbus to cross the ocean, without understanding aerodynamics, fuel consumption, weight loss to fuel use balance dynamics? You are more far gone than I thought! Well, go for it! But I can guarantee you that you shall NEVER achieve flight unless it is just long enough to kill all the witnesses. Madness. But keep those monkeys typing, sooner or later they will type out a full copy of war and peace through random strokes. When they do, call me, you can laugh then. Until then, the rest of us have real work to accomplish, and are doing so, including aerodynamics and spatial physics, in 4+ dimensions. You can stick to your one dimensional thought, personally I prefer a wider universe of movement or my legs fall asleep. I don't make mountains out of molehills, if anything through quaternion mathematics I have reduced complexity by increasing dimensions. There is never more math than needed, which is far more than you will ever understand.

                                  _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                  U Offline
                                  U Offline
                                  User 12346520
                                  wrote on last edited by
                                  #61

                                  thanks: https://movied.org

                                  1 Reply Last reply
                                  0
                                  • S Stephen Hewitt

                                    The Grand Negus wrote:

                                    But it does imply that if we can fully understand the simple components, we can build a machine that replicates the behavior of the larger system without needing to understand all of the complex interactions before we do; and that we'll be in a better position to understand those complex interactions after we replicate them using just our understanding of the underlying and simpler components.

                                    Possibly, but you can't just know how to make a transistor and make a computer: you have to know how to put them together.

                                    Steve

                                    U Offline
                                    U Offline
                                    User 12346520
                                    wrote on last edited by
                                    #62

                                    thanks: https://movied.org

                                    1 Reply Last reply
                                    0
                                    • 1 123 0

                                      Y'know, Jeffry, I think you've got a bit too much of your self-esteem tied up in this math thing. Perhaps it's time we turn out the lights and dream of Mr Edison doing (or not doing) quaternion mathematics in 4+ dimensions...

                                      U Offline
                                      U Offline
                                      User 12346520
                                      wrote on last edited by
                                      #63

                                      thanks: https://movied.org

                                      1 Reply Last reply
                                      0
                                      • S Stephen Hewitt

                                        The Grand Negus wrote:

                                        Are you purposely being contrary?

                                        No. I could ask you the same question.

                                        Steve

                                        U Offline
                                        U Offline
                                        User 12346520
                                        wrote on last edited by
                                        #64

                                        thanks: https://movied.org

                                        1 Reply Last reply
                                        0
                                        • E El Corazon

                                          Stephen Hewitt wrote:

                                          and understood mathematically

                                          Actually you are fully correct and well... the other, never mind. What the human brain does is parallel thought, what we think of as "lacking" mathematical thought is actually extremely complex mathematical relationships. From 3D vision, distance estimation, location memorization (and planning), everything that we do can be represented mathematically. One of the great shocks to scientists was discovering how bees give away location in their "dance" to find new places of nectar. The result was a 6-dimensional description of air-flight to the location, 6D being a shorter description similar to a quaternions (4D) being an excellent representation of 3D spatial references. Are human beings mathematically deficient because we don't use 6D? No, on the contrarary, some of the mathematics we use are so complex, yet automatically solved by the human brain that we are still working on figuring it out. Everything you do from typing, reading this text, to putting your socks and shoes on in the morning takes into account extremely complex mathematical relationships as an automatic reflex. But just because the mathematics are solved by reflex and subconcsious does not mean the math is lacking. Trust me, it is there, in huge volumes!

                                          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                          U Offline
                                          U Offline
                                          User 12346520
                                          wrote on last edited by
                                          #65

                                          thanks: https://movied.org

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups