Trying to understand the Haversine Formula

Поділитися
Вставка
  • Опубліковано 3 жов 2024

КОМЕНТАРІ • 89

  • @mikefochtman7164
    @mikefochtman7164 11 місяців тому +8

    Great math, but I see a tiny typo @5:57 The top formula in the left box, you have a '+' sign between the purple and green box. I think that should be a multipli symbol. The next line down, you have it correct. (I was pausing the video several times to work along with you). Still, a great explanation and derivation.

    • @Petey194
      @Petey194  11 місяців тому +5

      Thanks Mike, you're so right. Well spotted. I'll add to the description.

  • @scienceitout
    @scienceitout 11 місяців тому +9

    Nice one, as always!
    The first time I figured out this way of deriving the formula, I was fascinated by the result with the trapezoid, that the square of the diagonal is just the square of the leg plus the product of the bases. It's just so simple! And as it turns out, there is of course an old theorem from which it follows almost immediately: Ptolemy's theorem.
    There are two other ways of deriving the haversine formula I'm aware of. The second one is the one using dot products, which someone else already mentioned, and the third one is more like a proof than a derivation, and it's not pretty 😅I came up with it when I decided to try deriving the haversine formula using only the intrinsic geometry of a sphere, without referring to the 3D space at all. Well, let's just say that it's possible and leave it at that 😅

    • @Petey194
      @Petey194  11 місяців тому +3

      Thanks. Yeah, the relationships are all there and were begging to be unlocked 😃 It's all very beautiful. At first, I was toying around with rotating the sphere so the points lie on the same meridian. I soon gave that idea a miss. 🤣Thank you again!

  • @josleys
    @josleys 11 місяців тому +9

    Very well done!

    • @Petey194
      @Petey194  11 місяців тому

      Thanks Jos. Very much appreciated. 😋

  • @TakacsJanos
    @TakacsJanos 11 місяців тому +6

    I'm on a similar path. The stupidity of the flerf claims made me angry, and I learned celestial navigation and geodetic surveying. I'm not a professional in either of them, but now I can laugh harder at flerfs. :D

  • @realcygnus
    @realcygnus 11 місяців тому +7

    These are always educational in a clever way & they keep getting better !

  • @roohif
    @roohif 11 місяців тому +9

    Brilliant visualisation ❤

    • @Petey194
      @Petey194  11 місяців тому +5

      😊 Thanks so much Roohif. Much appreciated.

  • @mymumbakescakes
    @mymumbakescakes 11 місяців тому +7

    Could you do a version with Crayons and less numbers?
    Flerfs find numbers hard. But they like really BIG numbers.
    As BIG numbers make people scared. That is why 1000mph at the equator sounds impossible to flerfs.

    • @Petey194
      @Petey194  11 місяців тому +3

      lol. 😂 You know what they'll take away from this, don't you? _"See, you're using chords, and are chords curved? No!"_

  • @thirawatpongsathatkit6068
    @thirawatpongsathatkit6068 Місяць тому +2

    The best explanation of the Haversine Formula that I have seen, Thank you!

  • @theicewall7456
    @theicewall7456 11 місяців тому +5

    Great, I have tried on several occasions to see how this works. Not being a mathematician, all of the expectations previously encountered have baffled me. This was well presented and easily understood.
    Thanks

    • @Petey194
      @Petey194  11 місяців тому +3

      Thanks very much. When I first heard about the haversine formula about a year ago, I remember thinking, I know what sine, cosine, tangent are from school etc, but didn't know what haversine was. I didn't know what versine was! I remember googling it because I wanted to know what it is and how it fits with other circular functions. Searching youtube didn't help me much either because most of those searches returned videos that were about the end result or how to program it in python. I found one from Bob the science guy when he debunked Brian's Logic. He goes into the maths a bit but I was left wanting more and since then, like you, I searched now and again for it when someone brought the subject up. I don't expect this video to get many views but hopefully someone will find it and maybe find it useful.

    • @theicewall7456
      @theicewall7456 11 місяців тому

      Don’t want to contradict my previous comment, but as my algebra is virtually non existent I am unable to understand simplification at 5.49.
      Probably a silly question but where did the 4 go.

    • @Petey194
      @Petey194  11 місяців тому +3

      @@theicewall7456 Perfect Squares. Don't forget the first minus sign.
      In the same way (a-b)² becomes a²-2ab+b²,
      -(a-b)² becomes -a²+2ab-b²
      As (a+b)² = a²+2ab+b²
      add together and you should be left with 4ab

    • @theicewall7456
      @theicewall7456 11 місяців тому +1

      Thanks , easy when you know how.

    • @Isolder74
      @Isolder74 11 місяців тому

      @@Petey194 Sadly, fools like Brain do not look into it beyond the diagram used to derive the formula.
      Which means they learned terms like chord and such and not both to find out how they actually work.

  • @Richardj410
    @Richardj410 11 місяців тому +2

    Learned so spherical math today. It's been 50 years since college this was nice. Thanks.

  • @shainedupuis2649
    @shainedupuis2649 11 місяців тому +3

    I didn't understand any of the math but it was cool that you went to Fenway! Go Sox and Pats!

  • @marcg1686
    @marcg1686 11 місяців тому +10

    Hi Petey, I asked Roohif about the discrepency (0.5%) that I encountered when using great circle trig to determine the distance between two points in South Africa. In the comments section he stated that Google uses the Vincenty formula to account for the oblateness, whereas the great circle formula assumes two hemispheres of equal size. 0.5% is not bad though.

    • @Petey194
      @Petey194  11 місяців тому +11

      Hi Marc 😁 Yeah, Google Earth is different to Google Maps. Earth uses Vincenty whereas Maps uses Haversine. I worked out the % error for AKL to SCL airports was just 0.2% Hope you enjoy the video. It won't be everyone's cup of tea 🫖 mind. Still debunks the whold FE community in one fail swoop without even mentioning a flerf once. 😆

  • @clairecelestin8437
    @clairecelestin8437 7 місяців тому +2

    Very clear explanation. Haversine formula is no longer dark magic. Thank you!

  • @FlatEarthMath
    @FlatEarthMath 11 місяців тому +4

    Excellent. 🙂I can't imagine all the work behind the scenes to make those visuals with Geogebra!

    • @Petey194
      @Petey194  11 місяців тому +3

      Thanks mate. You mean the side highlights etc? Yeah, I did that in the editor by taking a screenshot, adding a layer and overlaying a line (50% opacity) to match. I spent a bit more time there than usual, thanks for noticing. 😊 Another time consuming thing was to write a 'condition to show' logic line for each point, line segment and angle for every step. eg, Showing a point k ≟ 5 ∨ 6 < k < 10, where k=step, ie this was the when to show the Origin. Show on Steps, 5, 7, 8 & 9. Then there was animating the arrows etc. Most time consuming thing though was typing with one hand! 🤣

    • @FlatEarthMath
      @FlatEarthMath 11 місяців тому +1

      @@Petey194 you are quite the -One Armed Bandit- Geogebra Sensei. 🙏 Here's a thought for you: take a LITTLE bit of your skill set and make a quickie tutorial "how to do X in Geogebra" then lather, rinse, repeat. It is such a fantastic tool, and I've only scratched the surface (not much farther than correctly spelling "Geogebra" LOL). I'd love to learn from you, and I'm sure many other folks would as well. You make it look so easy, but I bet it's a "skill stack" that you've developed over time! 🛠

    • @Petey194
      @Petey194  11 місяців тому +1

      @@FlatEarthMath Oh my goodness 😆 you put too much faith in me. 🤣 Maybe I could start adding stuff to this unlisted playlist ua-cam.com/play/PLkvaHD-eg_QtMkqB4YSKeqkHgc1DzyDgG.html
      I'm not sure what though. My problem is I lack the math skills to take full advantage of the software. I'm just high school level so I can only take it as far as what I remember and I've forgotten a lot over the decades.
      Maybe I can start a community post asking folks what would they like me to demo from something I've already done before. Can't guarentee they'll come thick and fast though. What dya think?

    • @FlatEarthMath
      @FlatEarthMath 11 місяців тому

      @@Petey194 Those are some cool demos! 🙂What I'm talking about are actual tutorials, where you walk a Geogebra user through a skill, starting with a blank canvas, and narrating your way through what you're doing. Assume nothing! If you go too fast, viewers can simply pause the video, or replay a bit. But if you start with a blank canvas, and simply screen-cap your workflow, while narrating what you're doing, then you'd do A LOT of people a huge service!!!
      This is a more advanced skill, but I'm fascinated how you "drew stuff" on the surface of a sphere in this video. Especially how you had pieces of the globe there! Drawing the coastline of the UK at 6:36 must have been at least 20 data points, and I can't imagine you did all that by hand, let alone all of North America at 7:20! Do tell! :-) And I hope you heal quickly.

    • @Petey194
      @Petey194  11 місяців тому +2

      @@FlatEarthMath I get what you mean but I'd need specific requests. I'm afraid I can't claim the credit for those coastlines. Someone else painstakingly made a world map and made the PolyLine list available on the geogebra website. I left a link to the 3D project in the description. Open it up to your app and then click the settings cog > settings > algebra and ensure auxiliary objects is checked. That should then make the maps visible in the list. They're big lines and messing with them can freeze the geogebra app or cause glitches.
      They are nifty though. What I did there was click on a bit of text which I've previously told, when clicked, update the lats and longs of points A & B. That in turn will draw a new arc. There's also an instruction there to rotate the view to look directly over the midpoint of that arc towards the origin. So there's a bit of scripting going on in the background.
      If(preset1,SetViewDirection(Vector(Midpoint(A,B),O)))
      SetValue(preset,1)
      There's also a condition to show each map based on the preset value.
      It sounds complex but it's really not. Let me have a nap and a think, lol.

  • @WalterBislin
    @WalterBislin 11 місяців тому +2

    Here for comparison is the equation to calculate the distances on a flat earth:
    D = E √(r1² + r2² - r1 r2 cos(Δλ))
    r1 = 1 - ψ1 / 90°
    r2 = 1 - ψ2 / 90°
    Δλ = λ2 - λ1
    E = 10,008 km
    D = flat earth distance
    E = distance north pole to equator
    ψ1, ψ2 = latitudes in degrees (-90° to 90°)
    λ1, λ2 = longitudes in degrees (-180° to 180°)
    Note: use the cos function in degree mode!
    Some may spot the law of cosines.

    • @Petey194
      @Petey194  11 місяців тому +2

      Oh my goodness. 😮 What would a circle of equal altitude look like on a flat earth? I thought it would be just a circle but now I'm not sure about anything! 😆 I'm gonna have to play with this at some point. Cheers, WB!

  • @Hirsutechin
    @Hirsutechin 11 місяців тому +6

    Unfortunately the flerf intellectuals (hahahahahaha, joke) didn't even manage basic trig at school, so our favourite chumps won't get any of this. Nevertheless, great job mate. 😇

  • @johnwilson839
    @johnwilson839 11 місяців тому +5

    Wouldn't this be easier just to make a 3 vector (X,Y,Z) for each location on a unit sphere and use the dot product (X1*X2+Y1*Y2+Z1*Z2) of them and simple trig (cos^-1) to get the angle between the vectors then multiply the angle by the radius of the earth?

    • @mikefochtman7164
      @mikefochtman7164 11 місяців тому +7

      I think the key is how you define 'easier'. This method was popular back before calculators when you had to look up each sin or cos function in tables to several decimal places. Converting lat/long to (x,y,z) in itself would be several 'lookups'. So, yeah maybe your method is 'easier' in some ways with modern calculators doing all the trig functions, but maybe not 100 years ago.

    • @Petey194
      @Petey194  11 місяців тому +2

      Thanks John, I did find out about the dot product when researching this and I did include it in the table while writing the geogebra script but decided to pull it at the end.

    • @johnwilson839
      @johnwilson839 11 місяців тому +1

      I think I see this point. Thanks.@@mikefochtman7164

  • @ThoughtandMemory
    @ThoughtandMemory 11 місяців тому +3

    Have one for the algorithm!
    Those poor flerfs. The pain in their brain (cell) must be terrible.

  • @QNFee
    @QNFee 11 місяців тому +2

    that took alot of time while put this together, respect

    • @Petey194
      @Petey194  11 місяців тому +2

      Thanks. I enjoyed learning about it.

  • @Ayush-pn8jk
    @Ayush-pn8jk 6 місяців тому +2

    That explaination was really clear and good. Thanks for such an awesome video.

    • @Petey194
      @Petey194  6 місяців тому

      Glad you liked 😊

  • @zz-curve5984
    @zz-curve5984 11 місяців тому +3

    Nicely presented video. I presume Brians Logic helped you with the maths? 😊

    • @Petey194
      @Petey194  11 місяців тому +1

      Aye, he insisted I needed a variable for the Earth's circumference which reach anywhere between the moon and the sun depending on the over6Rs!

  • @hesido
    @hesido 8 місяців тому +2

    Your channel is full of gems...

    • @Petey194
      @Petey194  8 місяців тому +1

      hehe, thanks! I'm on the learning curve 🤣

  • @carlaanastas4161
    @carlaanastas4161 Місяць тому +1

    Thank you so much for the video this was so helpful!!

  • @cuross01
    @cuross01 11 місяців тому +4

    But muh flat earf!

  • @marinberndt4049
    @marinberndt4049 4 місяці тому +1

    Hey Petey, absolutely love the video and I want to sincerly thank you for the effort you put in. There is only one thing that I am little unsure of. On the last side, we can see that you wrote 2*arcsin*sqrt(hav (theta)). This gets the right answer, however why the square root infront of the hav theta?? Thank you.

    • @Petey194
      @Petey194  4 місяці тому

      Thanks. It was all scary stuff for me at first but I was able to wrap my head around it in the end. Glad you liked. Yeah, I didn't really go in to much detail about that bit. I looked at the relationship between chord AB and hav(θ).
      Half of the chord distance squared was equal to the distance hav(θ) wasn't it.
      hav(θ) = (AB/2)² which means
      √hav(θ) = half the chord AB.
      The arcsin of √hav(θ) will give you half the angle θ 👍

  • @daoodmughal3301
    @daoodmughal3301 9 місяців тому +2

    at 5:11, I understand that CG is CB-AD, but why are we dividing this value by 2

    • @Petey194
      @Petey194  9 місяців тому +1

      It might not look like it because of the viewing angle, but ADBC is an isosceles trapezoid. If you google some images, you'll probably understand straight away without me having to explain. CB-AD leaves us with the bases of the 2 triangles. I only drew the left one in by way of AG. As we're only wanting the length of 1 of them, we divide by 2. 😊I should have really centred it properly. It's a bit misleading from that angle. Thanks!

    • @daoodmughal3301
      @daoodmughal3301 9 місяців тому +1

      @@Petey194 Thanks!. Just another question if you dont mind, could you explain the bit with the Inverse of Haversine. why is this value 2sin^-1 , and why are we square rooting the angle. thank you so much for your help, Love the video
      Edit: Haha I just did a little bit of research and figured it out. Amazing video, Thanks again

    • @Petey194
      @Petey194  9 місяців тому

      @@daoodmughal3301 Cool. I didn't have a clue to begin with. I had to do some research myself! Glad you enjoyed 😊

  • @JohnnyTokens1
    @JohnnyTokens1 5 місяців тому +1

    It's funny how Google Earth uses a straight curved line for the shortest distance. You would think that the tech company would use these arcs to show the shortest distance hmmmm. Strange

  • @Isolder74
    @Isolder74 11 місяців тому +3

    You brought up the chord as part of deriving it so you lose Brian at that point as he stopped listening.
    I suppose he still thinks a rhumb line is a chord.

    • @Petey194
      @Petey194  11 місяців тому +2

      Assuming he started listening in the first place then I agree. 😆
      _"Haversine been saying Chords for the longest time?"_

    • @Isolder74
      @Isolder74 11 місяців тому +3

      @@Petey194 Well he’s still convinced advanced math like this is a parlor trick made to fool the sheep. He’s never bothered to actually learn how the math works other than to try and say it only turns the flat distance(the rhumb line), which he still hasn’t figured out is actually longer, into the globe great circle distance.

  • @ariffuuu
    @ariffuuu 9 місяців тому

    hello! i understand the calculations for most part. however, i dont understand this part 4:30. can you explain to me why you multiplied Chord FE with cos(latA)? how does that mathematically make sense?

    • @Petey194
      @Petey194  9 місяців тому +1

      It's a ratio. eg, if you wanted to calculate the circumference of a circle of latitude, say 60°, you would multiply the equator distance by cos(60). At 60° the circle is half that of the equator because cos(60) is 0.5. Not sure if that answers the question but that's how I look at it.

    • @ariffuuu
      @ariffuuu 9 місяців тому +1

      @@Petey194 the moment you said ratio i immediately understood! thank you very much.

  • @reidflemingworldstoughestm1394
    @reidflemingworldstoughestm1394 11 місяців тому +2

    Check you out, using click bait language as a warning.

    • @Petey194
      @Petey194  11 місяців тому +3

      haha, I didn't know it was _that_ click baity. The warning was there because it wasn't an individual debunk per se which viewers tend to like more and I was thinking of them. Well that's my excuse and I'm sticking with it 😆

  • @BriansLogic
    @BriansLogic 11 місяців тому +1

    Petey MarcG spoke in a comment about Google Earth using the Vincenti ( spelled wrong ) formula for an oblate spheroid, but that is no good as it’s only pre-assistive and can’t be used to convert real measurements.
    The oblate spheroid thing is a an assumption based on the claim of rotation, as they assume centrifugal forces will create an oblate spheroid, but in CN they don’t use that formula as it won’t work with the latitude and longitude grid.
    In CN they convert via the Haversine, all measurements are placed on the UTM projection which is a flat globe projection, then via the XY they convert to latitude and longitude, but this is only possible if they reference a perfect sphere, as they won’t have 69.04 statute miles per degree if they use an oblate spheroid, which is why they must convert via Haversine which references a perfect sphere, technically CN disproves an Oblate Spheroid as CN covers the world 🗺 when they convert, but they only convert via Haversine.
    Good Video lots of work….

    • @Petey194
      @Petey194  11 місяців тому +5

      Hey Brian. Marc is a good guy and knows a lot more about CN than I do so I will always bow to his greater knowledge but I'm not sure what you mean about converting measurements. Both formulae obtain the distances between coordinates. As you say, one for a spheroid and the other for a pefect sphere. I'm not sure what the measurement is in either case. You either have coordinates or you don't.
      You yourself said that google earth distances are correct and GE uses Vincenty. Vincenty is more accurate than Haversine because it does take into account the oblateness whereas Haversine does not. At the end of the video I compared GE Vincenty distances to Haversine distances to show the differences in outputs. The error levels when compared with reality are small for Haversine and tiny for Vincenty. Haversine has the advantage of being computationally light.
      If you have any videos you can recommend to me where they implement either formula in CN then I'll take a look. Me, I'm just casually learning at a snail's pace when the feeling takes me. I enjoyed learing about the geometry in this video and of course learning new techniques in presenting it using geogebra. Cheers!

    • @BriansLogic
      @BriansLogic 11 місяців тому

      @@Petey194 Marc has nothing to do with my comment, I just referred to his comment as it was in his comment ?
      And the measurements I’m talking about are the measurements that are taken at sea 🌊 in CN, these measurements are converted to a globe ( perfect sphere ) via the UTM projection and then Haversine formula, they ARE and must be converted.
      They don’t use the formula Google earth is claimed to use by Roohif, which means that during conversion they are not referencing an oblate spheroid ?
      And the land distances are mostly correct on Google earth, unless they are using an oblate spheroid, as then they will be skewed as the latitude and longitude grid won’t fit or work, which is why the CN conversion always uses the Haversine.
      This means that CN on a globe opposes an Oblate Spheroid Petey ?

    • @Petey194
      @Petey194  11 місяців тому +2

      @@BriansLogic I'll be honest, I don't know what you're talking about. Can you tell me how the measurements which are taken at sea are converted and then how the haversine is applied? What are these measurements converted from and to? Got any examples? It's the only way I'll learn.

    • @BriansLogic
      @BriansLogic 11 місяців тому

      @@Petey194 They’re horizontal measurements that become the radius of circles of equal altitude, but then the circles are placed onto the UTM projection which is an XY globe map 🗺 a cylinder map of the globe where all the latitude lines are X and all the longitude lines are Y, they then convert it back to globe via the Haversine formula, as the longitude lines are in globe positions ( see Australia 🇦🇺 on the UTM projection for example )
      The circles of equal altitude are distorted by placing them on the UTM projection, as that projection is distorted….

    • @Petey194
      @Petey194  11 місяців тому +4

      @@BriansLogic Thanks for trying to explain but I still don't get it. Maybe you can make a video demonstrating it or show some examples. Personally, I don't have any issues taking the measurements to the stars on Protothad's videos and then making circles of equal altitude on a globe, all intersecting in the region of his location. I didn't use the haversine once. The circles of equal altitude come from the zenith distance and the mean radius of earth. No haversine needed. Of course the world isn't a perfect sphere but you only need to be in the ball park. If you're a sailor, being only a few NM off isn't the end of the world. As I say, I'm learning at a snail's pace and I usually learn by watching and reproducing for myself.

  • @cargy930
    @cargy930 11 місяців тому +5

    Great stuff, Petey. Seeing the various building blocks that are used to get the result really illustrates that, like most complex things, it;s actually just a series of relatively easy things. The sorts of things that a flerf could easily do, for example. I wonder why they don't? 😉

    • @Petey194
      @Petey194  11 місяців тому +3

      Yeah, I'm not good with simplifying long trig equations or remembering identities. I'm not a mathematician but as long as I'm aware they exist, it's stuff that can always be worked out. The trapezoid bit lends itself well to geogebra. ABCD&G all being coplanar. It's just a bit of pythagoras getting to AB². As you say, lots of little steps, nothing majorly complicated.

    • @carioca45
      @carioca45 11 місяців тому +4

      A friend of mine, a long time ago, used to say "Search in the simple the simplicity of complex", although it doesn't work well in English, that is the closest I can translate it.
      Petey's video is in fact an excellent example of it.

    • @cargy930
      @cargy930 11 місяців тому +4

      @@carioca45 The translation works well enough to convey the concept, and I agree: One of the reasons I first subbed to Petey is his knack for boiling things down to the basics - although he's far too modest to realise how good he is at it.

    • @Petey194
      @Petey194  11 місяців тому +2

      @@cargy930 🤨🤔😊 I don't know about that 🤭 Honestly, if I can put this together so can anyone! It's just one small project after another, building on methods previously learned. 😆

    • @cargy930
      @cargy930 11 місяців тому +2

      @@Petey194 See?!! I said you were too modest! 😆