Continued Fraction Arithmetic

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 49

  • @marcoottina654
    @marcoottina654 2 місяці тому +13

    5:03 as someone who somehow loves everything involving Phi, Fibonacci numbers, exponentials, Euler's constant and so on, I LOVE that continue fraction :D so simple and elegant, yet holding SO MUCH information and relations. WOW

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

    One of the first to work out a thorough system for CF arithmetic was Bill Gosper (apparently in 1972, according to info I found on Wikipedia). If you search him up with 'continued fractions' as part of the search, you should find some good information/sources on his original CF arithmetic work.
    It's highly likely that (please correct me if I'm wrong) the method described here and in the other linked video are at least indirectly inspired by Gosper's work.
    However, personally, I found reading Gosper's description just a little too difficult for me to try it out myself. (Probably I was just too impatient with myself?) And I found your video very helpful for overcoming that barrier. Thank you!
    Saved your video to a private playlist so I don't lose track of it when (hopefully soon!) I revisit CF arithmetic and want to figure out how to implement it on my own. I often like to try these kinds of things by hand on my own to really ensure that I completely understand it. This video will allow me to do that for sure!
    Great work, and I'd love to see more videos on CFs (and other related topics) in the future, if/when you delve deeper into them yourself!
    One little preference/critique:
    Although another commenter said they appreciated that you didn't show 'overly' much 'rigour' (e.g. not showing more D-hat expansions), I actually prefer videos that err more on the side of showing 'more than strictly necessary', for the purposes of helping more people really 'get it' by being able to see a more complete/thorough example.
    For those who 'get it' with just minimal 'rigour', IMHO they can just speed up the video playback to skim past the 'extra' detail. But if that extra detail is not in the video at all (or at the very least linked to in some other video perhaps, or link to a more thorough write-up in the description), then slowing down the video playback doesn't magically make that detail appear, for those who might need it.
    This is similar to the problem (well, I feel it is sometimes a problem) when a professor or textbook decides to leave the 'details of the proof' as an 'exercise for the reader'. While, yes, it is important for readers/viewers to get into the math and work on it directly themselves, such 'exercises for the reader' assume a certain level of experience/confidence in the audience of all possible readers and -- especially for something like a UA-cam video, I would say -- the actual interested audience often can have people with much less experience/confidence than is needed to be able to tackle such 'exercises for the reader'. In such cases, that portion of the potential audience just gets left behind. Whereas if the details are made explicit, then this provides an opportunity for the reader to 'catch up' to the topic by studying the details themselves, eventually understanding how the professor/author got from A to B.
    This is what happened to me with Gosper's work, for example. And I imagine that some of the elisions in this video may have made some people's eyes get lost in the sea of 'strange symbols'.
    Just my two cents!
    Thanks again for making this video on this topic! Cheers!

    • @TheGrayCuber
      @TheGrayCuber  2 місяці тому +2

      I developed my method before reading about Gosper's, but yes the linked video does discuss that one along with others. I also had some trouble following the sources.
      I appreciate the feedback. One of my main purposes making these videos is for entertainment, and I think at some point working out in detail loses value for the average viewer. lt would be nice to have extra detail available in notes or an extended cut for viewers like you who want that, but that would also take extra time to prepare which is beyond me at the moment.

    • @wyattstevens8574
      @wyattstevens8574 2 місяці тому

      ​@@TheGrayCuberThere's a Compass Learning Tech video all about it- almost all of the Compass Learning videos are about continued fractions, but the 50-min video is the one I'm talking about.

  • @roberttelarket4934
    @roberttelarket4934 2 місяці тому +2

    Never thought of continued fraction multiplication!

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

    There was a Project Euler problem where I basically had to derive the same steps as in this video, same problem solving approach, and it's neat to see it all in one place, with lots of extra details. Especially if more continued fraction challenges appear.

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

    23:14 "Heghhhh fu-"
    Truer words have never been spoken

  • @spencerdavis1708
    @spencerdavis1708 2 місяці тому +6

    I appreciate the level of rigor in this video. Very thorough, but not overly so. (Going in to show the first D hat equivalence, but not the other two)

  • @05degrees
    @05degrees 2 місяці тому +10

    I remember seeing matrix methods to do streaming computations with continued fractions in some old plaintext source... If only I could remember where!

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

    3:53 MR. 305 MR. WORLDWIDE WE DOIN CONTINUED FRACTIONS LEMME JUMP IN THIS TRACK AND SPIT SOME ARITHMETIC IN THIS HOUSE

  • @alexbennie
    @alexbennie 2 місяці тому +3

    Continued Fractions (CF) are really cool!
    I'll never forget my first introduction to them at university: The logical steps to convert between CF and decimals was so "New vs Obvious"!
    I saw this video and insta-clicked!
    Even though it was an immediate sub and spending about double the video length skipping backwards, enjoying/appreciating every step...
    I still feel hollow.
    I don't like it when "if" statements enter Algorithmic Algebra (for lack of a better word). Even worse is my dislike of the Floor function...
    People didn't like 'negatives' back in the day when taking Square Roots was in fashion and someone just decided: "screw it" and just followed the pattern now we have Complex numbers...
    It's been an explosion in Math History since that one person just decided: Screw it! The Algebra works!
    On the other end of the spectrum you get the Floor function. The Floor function doesn't play nice... It's too reliant on the the number base:
    What would Floor(x) be in Base 3, if
    x = 3,101010... Vs x = 3.20202... ?
    I really do appreciate that people went through all that tedious steps and calculations to eventually give us this Algorithm to multiply CFs, but dang! It's ugly!
    Don't get me wrong, it's (eventually) intuitive, and OP did a fantastic job of showing how to, but I'm just so upset that there's a reliance on a dodgy function.

    • @rarebeeph1783
      @rarebeeph1783 2 місяці тому

      the floor function is not base-dependent. all it does is take the integer portion of a value, and discards the rest. meanwhile bases don't affect the concept of an integer or the concept of value; they just alter how those values are represented. so it should clearly follow that bases don't affect the floor function.
      re: your specific example; neither 3.101010... nor 3.202020... are valid representations in base 3, because the symbol "3" does not exist in any base less than 4. but ignoring that, they would both floor to the value we'd refer to as 3. and, converting to base 10 reveals that those input values are what we would normally refer to as 3.375 and 3.75, which still both floor to 3.

  • @graf_paper
    @graf_paper 2 місяці тому +5

    Is this going to be a series of videos?? I love this, thanks for all the creativity and effort you put into these videos.

    • @tcaDNAp
      @tcaDNAp 2 місяці тому +1

      The upload schedule is fast af! I still need to finish the last series, but this lovely brown background showed up in my notifications... it must be hard keeping such a calm voice after bloopers 😂

    • @TheGrayCuber
      @TheGrayCuber  2 місяці тому +2

      Thanks! No, this is just a standalone video. Although I am planning to study continued fractions more in the future and I'm reserving this brown color scheme for the topic

  • @wilderuhl3450
    @wilderuhl3450 2 місяці тому +2

    Any continued fraction can be expressed as the product of matrices with column vectors [a_i,1] and [1,0]
    If you calculate the eigenvalues of the product then you will find the value of the continued fraction… iirc. I’d done some messing around with these years ago and I’d need to find my notes.

  • @eofirdavid
    @eofirdavid 2 місяці тому +10

    I am quite familiar with continued fraction, from their definition, to properties and their advanced applications, and your initial claim about finding the continued fraction of a multiplication was very intriguing. However, I got to admit that at some point I just stopped following the computations, as they seemed as just collections of letters, subscripts and superscripts.
    I suggest that at the very least you should keep a "small" definition of the various notations that you use at the corner of the screen. Maybe something like a=continued fraction of a with coefficients a_i = lim n^a_j / d^a_j = lim A_j, the same for b, and then something for the N,D and their hat version. While you remember all of the notations and the definitions since you studied it and worked on this video for a long time, it is much harder for someone who just view this video, even if you know a lot about continued fractions.

    • @TheGrayCuber
      @TheGrayCuber  2 місяці тому +1

      Thank you for the feedback. I like the idea of showing eeminders of those definitions

  • @catmacopter8545
    @catmacopter8545 2 місяці тому +3

    i wonder if there is a version of this for generalized continued fractions

  • @vishalmishra3046
    @vishalmishra3046 2 місяці тому +2

    *Much simpler solution*
    S = 1/(n + S) implies S^2 - nS - 1 = 0, therefore S = [-n +/- √(n^2 + 4)] / 2
    Here n = 2m is an even number, so S = m + 1/(2m + S) implies S = m - m + √(m^2+1) = √(m^2 + 1)
    With m = 2 and 3, S(2) = √(4+1=5) and S(3) = √(9+1=10), therefore S(2) x S(3) = √(5 x 10) = √50 *Simple. Right* ?

    • @MrDenislynch
      @MrDenislynch 2 місяці тому

      That’s what I got

    • @TheGrayCuber
      @TheGrayCuber  2 місяці тому +2

      This solution is great if the continued fraction repeats, but it won't work in the general case.

  • @wyattstevens8574
    @wyattstevens8574 11 днів тому +1

    Here's a way to, for example, turn the sqrt(50) number in the intro into a continued fraction!
    Let's say:
    M_0=0, D_0=1, A_0=int(sqrt(S)) (in the example, S=50)
    And let's call A_0 d to save on space later.
    Next M= D*A-M (on the RHS, all of these are current)
    Next D has the following equation: S= (old D)(new D)+(new M)^2.
    Next A= int((d+new M)/new D)
    Iterate until A=2d, and then the cf repeats this block over and over forever.

  • @catmacopter8545
    @catmacopter8545 2 місяці тому +5

    YESSSS CONTINUED FRACTIONS MY BELOVED!!!!

  • @Tom-z9h3p
    @Tom-z9h3p 2 місяці тому +3

    Really good video, well explained but it would be helpful if what was on screen was more clearly labelled. That way it is easier to follow and you do not have to rely wholly on what is said to figure out what is going on. Would lead to less pausing and rewinding, more understanding

  • @johnchessant3012
    @johnchessant3012 2 місяці тому +3

    What's the computational complexity of this method?

  • @happyvirus6590
    @happyvirus6590 2 місяці тому +3

    Wait, no one's gonna mention thr change of pfp? It's the same palette of the video. Does it mean anything?

    • @TheGrayCuber
      @TheGrayCuber  2 місяці тому +3

      I like to switch color schemes for different topics, and I think it's fun to have my pfp match the most recent video. It doesn't having any other meaning

  • @raydencreed1524
    @raydencreed1524 Місяць тому

    6:06 Why not just separate the integer part of each fraction? Take the reciprocal of the reciprocal of what’s left and repeat.

  • @disgruntledtoons
    @disgruntledtoons 2 місяці тому +4

    If the terms repeat, you have a quadratic number that can be calculated.

  • @cyruschang1904
    @cyruschang1904 2 місяці тому +1

    x = 1/(4 + x) => x^2 + 4x - 1 = 0
    x = -2 + ✓5
    y = 1/(6 + y) => y^2 + 6y - 1 = 0
    y = -3 + ✓10
    (2 + x)(3 + y) = (✓5)(✓10) = 5✓2

  • @Phylaetra
    @Phylaetra Місяць тому

    Interesting - though cumbersome.
    I think it worth noting that even simple square roots may not have a nice repeating number in the continued fraction (though there will always be a finite number of values that does eventually repeat). I think that is true for all algebraic numbers, but transcendental numbers, such as pi or e will not repeat.
    I would have liked to have seen also the method for going from square root (or, more generally, quadratic equation with real solutions) to the resulting continued fraction - that has long been a mystery to me (and I have also been too lazy to work it out).
    I wonder also if there is not a better method? I mean, quite possibly not, but it seems a little weird that it would be super easy to go from continued fraction to root to multiplying the two roots together to generate the continued fraction for that resulting root... Of course - sometimes math is like that - there just may not be a simpler method...

  • @crazygoatemonky
    @crazygoatemonky 2 місяці тому

    This is cool, but it also feels like trying to calculate in Roman numerals. I would so much rather convert out, calculate, and convert back. Obviously there are some continued fractions where that isn't possible, but I don't know how you'd actually run into them or whether there's any other situations where your approach is better

    • @TheGrayCuber
      @TheGrayCuber  2 місяці тому +1

      I agree. I don't think my approach is better in many or even any cases. This was mainly a thought experiment to see if it was possible

  • @penguincute3564
    @penguincute3564 Місяць тому

    The repeated fractions causes that it might have 2 values.

  • @ben_adel3437
    @ben_adel3437 2 місяці тому

    After a certain time it just started looking like alphabet soup i loved the video though

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

    10:01 that non binary friend of yours that's going to the gym and getting pretty swole

  • @orisphera
    @orisphera 2 місяці тому

    I had to look “negative continued fraction” up. The concept doesn't make much sense to me

  • @philipoakley5498
    @philipoakley5498 2 місяці тому

    how to get the repeated fraction who's infinite expansion is 0.999999... ? Tricky..

  • @roberttelarket4934
    @roberttelarket4934 2 місяці тому

    MONSTER MULTIPLICATION!!!
    HELP!!!

  • @RealQinnMalloryu4
    @RealQinnMalloryu4 2 місяці тому

    {2n+2n ➖ }+{1n+1n ➖ }={4n^2+2n^2}=6n^4 +{4n+4n ➖ }+{1n+1n ➖}=6n^4+{8n^2+2n^2}={6n^4+10n^4}=16n^8+{4n+4n ➖ }+{1n+1n ➖ }=16n^8+{8n^2+2n^2}={16n^8+10n^4}=26n^12+ {4n+4n ➖ }+{1n+1n ➖ }=26n^12+{8n^2+2n^2}={26n^12+10n^4}=36n^16 +{4n+4n ➖}+{1n+1n ➖ }=36n^16+{8n^2+2n^2}={36n^16+10n^4}=46n^20+{4n+4n ➖}+{1n+1n ➖}=46n^20+{8n^2+2n^2}={46n^20+10n^4}=56n^24+{4n+4n ➖ }+{1n+1n ➖ }=56n^24+{8n^2+2n^2}={56n^24+10n^4}=66n^28+{4n+4n ➖}+{1n+1n ➖ }=66n^28+{8n^2+2n^2}={66n^28+10n^4}=76n^32 .{3n+3n ➖}+{1n+1n ➖ }={6n^2+2n^2}=8n^4+{6n+6n ➖ }+{1n+1n ➖ }=8n^4+{12n^2+2n^2}={8n^4+14n^4}=22n^8+{ 6n+6n ➖ }+{1n+1n ➖ }=22n^8+{12n^2+2n^2}={22n^8+14n^2}=36n^12+ {6n+6n ➖ }+{1n+1n ➖ }=36n^12+{12n^2+2n^2}={36n^12+14n^4}=50x^16+{6n+6n ➖}+{1n+1n ➖ }=50n^16+{12n^2+2n^2}={50n^16+14n^4}=50n^20 +{6n +6n ➖ }=50n^20+{12n^2+2n^2}={50n^20+14n^4}=64n^24+{6n+6n ➖}+{1n+1n ➖ }=64n^24+{12n^2+2n^2}{64n^24+14n^4}=78n^28+{6n+6n ➖}+{1n+1n ➖ }=78n^28+{12n^2+2n^2}={78n^28+14n^4}=94n^32 {76n^32•94n^32}=7144n^1024 100^700^144n^512^512 100^10^70^144n^128^128 100^10^70^12^12n^64^64 10^10^10^7^10^12^12n^4^16^4^16 10^10^10^7^10^12^12n^4^4^4^4^4^4 2^5^2^5^2^5^7^2^5^3^4^3^4n2^2^2^2^2^2^2^2^2^2^2^2 1^1^1^1^1^1^7^1^1^1^3^2^2^3^2^2n^1^1^1^1^1^1^1^1^1^1^1^1 1^1^1^1^1^3^1^2 3^2n (n ➖ 3n+2).that is longest one i have written yet i think

  • @thingthingthingthingthingthing
    @thingthingthingthingthingthing 2 місяці тому

    Simply find the answer and multiply them

  • @jan-pi-ala-suli
    @jan-pi-ala-suli 2 місяці тому

    you lost me

  • @jjeastside
    @jjeastside 2 місяці тому

    I can do this but for only periodic simple continued. I hope this video doesn't convert these into their roots and add them and finds a more clever work around.

    • @jjeastside
      @jjeastside 2 місяці тому

      This approach works for non periodic simple continued fractions which is excellent but it seem very inefficient and doesn't really prove that you have the correct answer. Solving this algebraically using recursion because they're simple periodic continued fractions seems to be the best approach.

    • @jjeastside
      @jjeastside 2 місяці тому

      But finding a method for non quadratics solutions of continued fractions without error seems to still be a mystery

  • @Christian_Martel
    @Christian_Martel 2 місяці тому

    I’d say the answer is (rad5)(2rad5)= 10.

  • @wilderuhl3450
    @wilderuhl3450 2 місяці тому +3

    Any continued fraction can be expressed as the product of matrices with column vectors [a_i,1] and [1,0]
    If you calculate the eigenvalues of the product then you will find the value of the continued fraction… iirc. I’d done some messing around with these years ago and I’d need to find my notes.