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. The Lounge
  3. Math Problem ...

Math Problem ...

Scheduled Pinned Locked Moved The Lounge
helpquestioncsharp
61 Posts 15 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.
  • R Ray Kinsella

    Hey Guys, I have a math issue, I know how you like brain teasers so I thought I would post it here, say I have two points ab & cd, how do I find the point 20% of distance between these two points on the same slope ? Regards Ray "Je Suis Mort De Rire" Blogging @ Keratoconus Watch

    D Offline
    D Offline
    Denevers
    wrote on last edited by
    #38

    man.. these guys like complicated solutions :) let's p be the proportion of the line (0.2) x = (a * (1-p)) + (c * p) y = (b * (1-p)) + (d * p) unless I blew it.. this should work with any lines. Denevers -- modified at 18:08 Tuesday 13th June, 2006

    1 Reply Last reply
    0
    • E Ed Poore

      If I've understood the post correctly he wants to get 20% of the line between the two points.  Agree? If so then how can you simply take 20% of the width of the "triangle" formed and "20%" of the height to get a hypotenuse that is 20% of the original triangle? If you use Pythagoras it'll show you that if you do that you'll actually get a hypotenuse that's ~28% of the original rather than 20%.


      Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

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

      Though it does not qualify as an actual mathematical proof, I've tested your approach and Jun Du's approach in Excel with 10-15 different values and I get the same results. Remember that: θ = arctan( y / x ) x = cos( θ ) y = sin( θ ) from Inverse Tangent[^] You wrote: θ = arctan((d - b) / (c - a)) x = a + (0.2*|AB|*cos(θ) y = b + (0.2*|AB|*sin(θ) and based on the link from MathWorld, (c-a) = cos( θ ) and (d-b) = sin( θ ) PJC

      E 1 Reply Last reply
      0
      • C Chris Losinger

        yup. he was right up until the last little bit of arithmetic. Cleek | Image Toolkits | Thumbnail maker

        E Offline
        E Offline
        Ed Poore
        wrote on last edited by
        #40

        Chris Losinger wrote:

        he was right up until the last little bit of arithmetic.

        Yep, I've now confirmed that I've been a complete and utter nincompoop, see http://www.codeproject.com/lounge.asp?msg=1530321#xx1530321xx[^] for my explanation and excuses.  I now realise I was barking up the wrong tree :doh:


        Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

        1 Reply Last reply
        0
        • P Paul Conrad

          Though it does not qualify as an actual mathematical proof, I've tested your approach and Jun Du's approach in Excel with 10-15 different values and I get the same results. Remember that: θ = arctan( y / x ) x = cos( θ ) y = sin( θ ) from Inverse Tangent[^] You wrote: θ = arctan((d - b) / (c - a)) x = a + (0.2*|AB|*cos(θ) y = b + (0.2*|AB|*sin(θ) and based on the link from MathWorld, (c-a) = cos( θ ) and (d-b) = sin( θ ) PJC

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #41

          I just wrote it out on paper, basically if you substitute adjacent / hypotenuse in place of cos then the root will cancel out and you'll get what Jun Du gave.  I'm just too exhausted from 12 hours revision plus a 2 hour shooting walk with my father and the dog. I stand corrected and apologise if I was dogmatic :-O.


          Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

          P C 3 Replies Last reply
          0
          • E Ed Poore

            I just wrote it out on paper, basically if you substitute adjacent / hypotenuse in place of cos then the root will cancel out and you'll get what Jun Du gave.  I'm just too exhausted from 12 hours revision plus a 2 hour shooting walk with my father and the dog. I stand corrected and apologise if I was dogmatic :-O.


            Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

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

            Ed.Poore wrote:

            I stand corrected and apologise if I was dogmatic .

            Hey it's cool. It happens.

            1 Reply Last reply
            0
            • C Chris Losinger

              yup. he was right up until the last little bit of arithmetic. Cleek | Image Toolkits | Thumbnail maker

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

              Chris Losinger wrote:

              he was right up until the last little bit of arithmetic.

              I had that happen when I was in Calculus 15 years ago. It happens. The teacher dinged everyone on arithmetic mistakes even if we displayed knowledge of the material. Now I look back at those old midterm exams and laugh. PJC

              1 Reply Last reply
              0
              • E Ed Poore

                I just wrote it out on paper, basically if you substitute adjacent / hypotenuse in place of cos then the root will cancel out and you'll get what Jun Du gave.  I'm just too exhausted from 12 hours revision plus a 2 hour shooting walk with my father and the dog. I stand corrected and apologise if I was dogmatic :-O.


                Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

                C Offline
                C Offline
                Chris Losinger
                wrote on last edited by
                #44

                happens to the best of us... and the least :) without sitting down and working it through, i don't see how DU's solution works. maybe i'll give it some time later tonight. Cleek | Image Toolkits | Thumbnail maker

                P E 2 Replies Last reply
                0
                • C Chris Losinger

                  happens to the best of us... and the least :) without sitting down and working it through, i don't see how DU's solution works. maybe i'll give it some time later tonight. Cleek | Image Toolkits | Thumbnail maker

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

                  When substituting cos θ by

                       x2 - x1 
                  


                  √(y2 - y1)² + (x2 - x1)²

                  the magnitude of the two vectors cancel out and you are left with

                       x2 - x1
                  

                  With the equation for the y component, sin θ is substituted by

                       y2 - y1
                  


                  √(y2 - y1)² + (x2 - x1)²

                  the magnitude of the two vectors cancelled out again and you are left with

                       y2 - y1
                  

                  So in Jun Du's method, the magnitude of the two vectors and the trig functions drop out. PJC

                  1 Reply Last reply
                  0
                  • E Ed Poore

                    I just wrote it out on paper, basically if you substitute adjacent / hypotenuse in place of cos then the root will cancel out and you'll get what Jun Du gave.  I'm just too exhausted from 12 hours revision plus a 2 hour shooting walk with my father and the dog. I stand corrected and apologise if I was dogmatic :-O.


                    Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

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

                    As a friendly suggestion, I would recommend bookmarking the www.mathworld.com[^] link. I use it often as a good web reference :) Paul

                    E 1 Reply Last reply
                    0
                    • R Ray Kinsella

                      Hey Guys, I have a math issue, I know how you like brain teasers so I thought I would post it here, say I have two points ab & cd, how do I find the point 20% of distance between these two points on the same slope ? Regards Ray "Je Suis Mort De Rire" Blogging @ Keratoconus Watch

                      Y Offline
                      Y Offline
                      yang__lee
                      wrote on last edited by
                      #47

                      here it is suppose a and b are points.. I want point C 20% from point a then c.x= a.x+ 0.2 * (distnce between a & b ) * cos (angle between a and b ); c.Y= a.y+ 0.2 * (distnce between a & b ) * sin (angle between a and b ); Leya -- modified at 3:04 Wednesday 14th June, 2006

                      1 Reply Last reply
                      0
                      • R Ray Kinsella

                        Hey Guys, I have a math issue, I know how you like brain teasers so I thought I would post it here, say I have two points ab & cd, how do I find the point 20% of distance between these two points on the same slope ? Regards Ray "Je Suis Mort De Rire" Blogging @ Keratoconus Watch

                        B Offline
                        B Offline
                        Baconbutty
                        wrote on last edited by
                        #48

                        Use a tape measure :) I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days :)

                        E 1 Reply Last reply
                        0
                        • P Paul Conrad

                          As a friendly suggestion, I would recommend bookmarking the www.mathworld.com[^] link. I use it often as a good web reference :) Paul

                          E Offline
                          E Offline
                          Ed Poore
                          wrote on last edited by
                          #49

                          I know about MathWorld since I've got a copy of Mathematica, it's just I was being blind to the obvious yesterday, was feeling a bit more awake today but then sat down outside to read a book in the sun, big mistake.. Fell alseep.


                          Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

                          P 1 Reply Last reply
                          0
                          • C Chris Losinger

                            happens to the best of us... and the least :) without sitting down and working it through, i don't see how DU's solution works. maybe i'll give it some time later tonight. Cleek | Image Toolkits | Thumbnail maker

                            E Offline
                            E Offline
                            Ed Poore
                            wrote on last edited by
                            #50

                            Chris Losinger wrote:

                            happens to the best of us

                            God I hope you're not implying I'm one of the best :laugh: Far from it.


                            Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

                            1 Reply Last reply
                            0
                            • B Baconbutty

                              Use a tape measure :) I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days :)

                              E Offline
                              E Offline
                              Ed Poore
                              wrote on last edited by
                              #51

                              I was told I was making things too complicated (which I was by the way), I think you're oversimplifying a bit here :laugh: But it's the most realiable method, I've got to give you that.


                              Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

                              1 Reply Last reply
                              0
                              • E Ed Poore

                                I know about MathWorld since I've got a copy of Mathematica, it's just I was being blind to the obvious yesterday, was feeling a bit more awake today but then sat down outside to read a book in the sun, big mistake.. Fell alseep.


                                Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

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

                                Ed.Poore wrote:

                                Mathematica

                                I've always liked mathematica. Haven't worked with it in some time :sigh:

                                E 1 Reply Last reply
                                0
                                • P Paul Conrad

                                  Ed.Poore wrote:

                                  Mathematica

                                  I've always liked mathematica. Haven't worked with it in some time :sigh:

                                  E Offline
                                  E Offline
                                  Ed Poore
                                  wrote on last edited by
                                  #53

                                  Havn't used it much but liked what I saw, but I find it's more fun to program your own stuff rather than getting Mathematica to do it. Mind you, you do get a sense of satisfaction when asking it to calculate Pi to 5,000,000 places, you think it's crashed and then you go off to supper, lo and behold when you come back it's done it.


                                  Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

                                  P 1 Reply Last reply
                                  0
                                  • R Ray Kinsella

                                    Hey Guys, I have a math issue, I know how you like brain teasers so I thought I would post it here, say I have two points ab & cd, how do I find the point 20% of distance between these two points on the same slope ? Regards Ray "Je Suis Mort De Rire" Blogging @ Keratoconus Watch

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #54

                                    Ray Kinsella wrote:

                                    I have a math issue, I know how you like brain teasers so I thought I would post it here, say I have two points ab & cd, how do I find the point 20% of distance between these two points on the same slope ?

                                    Ask an Asian? Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash 24/04/2004

                                    1 Reply Last reply
                                    0
                                    • E Ed Poore

                                      Havn't used it much but liked what I saw, but I find it's more fun to program your own stuff rather than getting Mathematica to do it. Mind you, you do get a sense of satisfaction when asking it to calculate Pi to 5,000,000 places, you think it's crashed and then you go off to supper, lo and behold when you come back it's done it.


                                      Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

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

                                      Ed.Poore wrote:

                                      it's more fun to program your own stuff rather than getting Mathematica to do it

                                      I agree. It's nice to use a tool like Mathematica to check the program to ensure it is working correctly :) Took a Graduate course called Super Visualization and tools like Mathematica and SciLab were quite useful.

                                      E 1 Reply Last reply
                                      0
                                      • P Paul Conrad

                                        Ed.Poore wrote:

                                        it's more fun to program your own stuff rather than getting Mathematica to do it

                                        I agree. It's nice to use a tool like Mathematica to check the program to ensure it is working correctly :) Took a Graduate course called Super Visualization and tools like Mathematica and SciLab were quite useful.

                                        E Offline
                                        E Offline
                                        Ed Poore
                                        wrote on last edited by
                                        #56

                                        What's your opinion of SciLab?


                                        Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

                                        P 1 Reply Last reply
                                        0
                                        • E Ed Poore

                                          What's your opinion of SciLab?


                                          Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9

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

                                          Ed.Poore wrote:

                                          What's your opinion of SciLab?

                                          It is pretty alright. Had to use it in conjunction with MuPad to solve a problem with wavelet transforms. PJC

                                          E 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