Bobater
Bobater
  • 2
  • 143 077
How can Computers Calculate Sine, Cosine, and More? | Introduction to the CORDIC Algorithm #SoME3
In this video, I'll explain the motivation for an algorithm to calculate sine, cosine, inverse tangent, and more in a fast and efficient way. I'll cover topics like geometry, calculus, and computer science to explain where and how these ideas are developed.
Music by Vincent Rubinetti
Download the music on Bandcamp:
vincerubinetti.bandcamp.com/album/the-music-of-3blue1brown
Stream the music on Spotify:
open.spotify.com/playlist/3zNK20qC96mVSww60lVi1k
มุมมอง: 141 211

วีดีโอ

What Does it Mean to Change the Base of a Number? | An Introduction to Binary and Hexadecimal
มุมมอง 2Kปีที่แล้ว
In this video, I'll cover how numbers can be represented in different ways using different base systems, and what makes those systems so useful. Music used is from: th-cam.com/video/m8IRu3lEUPs/w-d-xo.html Outer Wilds Soundtrack Piano Cover

ความคิดเห็น

  • @premkumarsr4021
    @premkumarsr4021 2 วันที่ผ่านมา

    May I know if this algorithm is better than Taylor series computation of sine and cosine?

  • @PubEstVacPrin
    @PubEstVacPrin 12 วันที่ผ่านมา

  • @debabratadas4569
    @debabratadas4569 14 วันที่ผ่านมา

    Lol I think I just visualised the Taylor series expansion of the functions

  • @ilanvitor5400
    @ilanvitor5400 23 วันที่ผ่านมา

    I entered with a question, the video title, I exit with another, how computers calculate the trigonometric values (without another trigonometric function)?

  • @medazizmhenni2249
    @medazizmhenni2249 26 วันที่ผ่านมา

    Even if the terms of a series are gradually getting smaller when n is getting bigger, the series can diverge. For example, the harmonic series (1/n) diverges even though the sequence 1/n converges to 0. In fact, if a series converges, then the corresponding sequence converges to 0. But, if a sequence converges to 0, the corresponding series can either converge or diverge.

  • @yewo.m
    @yewo.m หลายเดือนก่อน

    Unfortunately, the setup was just a bit too complicated here

  • @yewo.m
    @yewo.m หลายเดือนก่อน

    Back when I was first learning to program (using C++), I was so enthusiastic that I wanted to make my own command-line calculator. At first I made it using just basic arithmetic operations. And then later on I added trig functions (along with the other typical math functions). But at the time I didn't know the standard library already provided built-in sine/cosine/tangent functions, so I ended up writing my own rudimentary ones using Taylor's series approximations 😅

  • @mihaleben6051
    @mihaleben6051 หลายเดือนก่อน

    Nope. I give up. Ill never get trig

  • @mihaleben6051
    @mihaleben6051 หลายเดือนก่อน

    Not even clarity makes me get it

  • @mihaleben6051
    @mihaleben6051 หลายเดือนก่อน

    Wait this looks like physics diagram... Oh. Oh my god. Anyways, its a/theta. It came to me in a dream today around 6:00 at morning.

  • @mihaleben6051
    @mihaleben6051 หลายเดือนก่อน

    Nah imma just use ((n-2)*180°)/2 For my angles. Oh, rotation? Just multiply the variable

  • @Antagon666
    @Antagon666 หลายเดือนก่อน

    7:30, well multiplication speed is relative. In x86 floating point multiplication takes the same number of cycles as addition.

  • @YourMom-rg5jk
    @YourMom-rg5jk 2 หลายเดือนก่อน

    W VIDEO

  • @umedmaru4445
    @umedmaru4445 2 หลายเดือนก่อน

    Quick question. I was wondering if computers could use the complex plane to rotate points(by multiplying complex numbers), instead of using a rotation matrix. Is there a reason this isn't used?

  • @CesarGrossmann
    @CesarGrossmann 3 หลายเดือนก่อน

    Very interesting. Is that how scientific calculators do this kind of calculations? Like the venerable TI-30?

  • @rudypieplenbosch6752
    @rudypieplenbosch6752 4 หลายเดือนก่อน

    In the old days, i calculated the Arctan in assembler using a the CORDIC. There is a mathematical proof of the CORDIC somewhere.

  • @yolamontalvan9502
    @yolamontalvan9502 4 หลายเดือนก่อน

    Thank you for this lesson. I learned something beyond my capability. You forgot to mention the software you use to make those circles and triangles.

  • @yolamontalvan9502
    @yolamontalvan9502 4 หลายเดือนก่อน

    This is cool stuff. Highly advanced for rocket engineers.

  • @zxborg9681
    @zxborg9681 4 หลายเดือนก่อน

    Super interesting, I always wondered how CORDIC worked. Question, though, at 12:19, I'm not sure that the ratio of a[n+1]/a[n] is really sufficient to prove convergence, since the latter terms of the harmonic series (1/2 + 1/3 + 1/4 + ...) satisfies that test but still doesn't converge. Maybe I'm missing something though. Anyways, great video!

    • @bobater
      @bobater 4 หลายเดือนก่อน

      Thanks for watching! The key with the ratio test is that we’re evaluating the ratio as a limit as we approach infinity. For the harmonic series, that ratio approaches 1 as we approach infinity. Since the ratio isn’t less than 1, the test does not tell us that the terms of the harmonic series are shrinking relative to each other at the limit, and therefore doesn’t imply that the harmonic series converges, which is why there is no contradiction in using the test

  • @BB-mr3vy
    @BB-mr3vy 5 หลายเดือนก่อน

    how do you keep track of what theta is in order to compare it to the target angle? i understand how you track the x and y coordinates, but not the angle.

    • @bobater
      @bobater 4 หลายเดือนก่อน

      Good question! We can store the total angle that we’ve rotated by in memory. Each time we iterate the algorithm, we can add or subtract the angle that we’ve just rotated by with our total angle so that we know what angle we are currently at and can compare it with the target angle.

    • @BB-mr3vy
      @BB-mr3vy 4 หลายเดือนก่อน

      thanks for your response. my confusion was more about how you actually know what angle you're adding, since we only know them as arctan of 2^{-k}, not an approximate decimal value which we could sum and keep track of. do you just start by calculating decimal approximations of arctan(2^{-k}) in some other way for a sufficiently large number of values of k, and then storing them for use in the CORDIC algorithm?@@bobater

    • @bobater
      @bobater 4 หลายเดือนก่อน

      Yep that’s exactly right! We can pre calculate the angles using some other method and then store them in a lookup table in memory which we can reference while using the algorithm

  • @chrisd561
    @chrisd561 5 หลายเดือนก่อน

    I've been trying to find this. Thanks!

  • @user-pd2lx8fb3n
    @user-pd2lx8fb3n 6 หลายเดือนก่อน

    This video is AWESOME

  • @augustodufloth1578
    @augustodufloth1578 6 หลายเดือนก่อน

    Multiplication is not repetitive sum

  • @gigantopithecus8254
    @gigantopithecus8254 7 หลายเดือนก่อน

    i found my own method for calculating cos(x) 1.choose accuracy n 2. divide the input number by 2^n-1 3.square the number and subtract 2from that 4. repeat 3 n times 5.divide the answer by two this works due to the double angle formula and chebesev polinomials

  • @kafel4796
    @kafel4796 7 หลายเดือนก่อน

    not well explaind. There are other videos with this topic and much easier explaind.

  • @wesleytaylor-rendal5648
    @wesleytaylor-rendal5648 8 หลายเดือนก่อน

    I'm really impressed. I'm currently implementing a cordic calculation in an FPGA. Both HLS and HDL implementations for two separate projects, but i have to admit this was a great refresher. Please keep it up. You're doing gods work.

  • @MrSilversMathSheets
    @MrSilversMathSheets 9 หลายเดือนก่อน

    I was disappointed that this did not receive a mention in the final announcement. I hope you continue to make videos though.

  • @nomzz8106
    @nomzz8106 9 หลายเดือนก่อน

    can you make one explaining how a logarithm is calculated? ive always wanted to know

  • @damyankorena
    @damyankorena 9 หลายเดือนก่อน

    13:10 technically this statement is incorrect and the harmonic series is a popular counter example. Awesome video though!

  • @Lavamar
    @Lavamar 9 หลายเดือนก่อน

    Ahhhh this video was so confusing! 1. At 7:18, you say that because we have the rotation matrix, "we have a way to rotate vectors and get their x and y coordinates after we rotate them" (correct) "...that gives us our sine and cosine" BUT the rotation matrix requires that we calculate sine and cosine! I don't understand why we're any better off at this point. 2. Was the motivation behind why we're adding successively smaller angles to an initial 45° ever explained? I don't see what doing that is giving us and I feel like it's probably a crucial part of this algorithm. Is it that you precalculate the terms of the summation AND their sines and cosines? Then you can just store those in a list and easily plug them into the rotation matrix? I appreciate the video but feel that this key point could have been explained a little more in depth.

    • @bobater
      @bobater 9 หลายเดือนก่อน

      Really appreciate your feedback. This was my first real attempt at making a video explaining a topic not many people had seen before. When I made this video, I had about 6 subscribers, so the amount of people I expected it to reach and the quality standards I set for myself were somewhat low. If I have time, I might make another version of this video with all of the feedback I got and mistakes I made in mind, but I am pretty busy right now so I’m not sure if/when that will happen.

  • @ddognine
    @ddognine 10 หลายเดือนก่อน

    Warning: unless you've had a Calculus II class (infinite series, product sums, l'Hopital's Rule, etc.), this will be over your head. Otherwise, this is a good video.

  • @WolfgangBrehm
    @WolfgangBrehm 10 หลายเดือนก่อน

    Shrinking terms is not sufficient. Look at sum(1/n,n,1,m) ≈ log(m)+g

  • @katefick4246
    @katefick4246 10 หลายเดือนก่อน

    This is awesome and so are you!!! Excellent graphics and clear explanation!

  • @user-vf2lx5eo6p
    @user-vf2lx5eo6p 10 หลายเดือนก่อน

    Thanks.

  • @redf1sh
    @redf1sh 10 หลายเดือนก่อน

    I didn't understand how should we get tan(x) values? Have we a precalculated table of tan(45), tan(22.5) ... ?

  • @kaustubhpandey1395
    @kaustubhpandey1395 10 หลายเดือนก่อน

    Really cool entry P.S. love the effort in the 8 bit computer you made. I have seen ben's series on it

  • @qqw1-101
    @qqw1-101 10 หลายเดือนก่อน

    did anyone else find it hard to follow, or am i just dumb

  • @donaldhobson8873
    @donaldhobson8873 10 หลายเดือนก่อน

    If K is constant, start at (K,0) and remove one multiplication.

  • @JohnDlugosz
    @JohnDlugosz 11 หลายเดือนก่อน

    16:44 The numbers on the right don't match the drawing on the left. That's more like 1 or 2 degrees, not 36 (I assume you mean degrees here but it's not indicated)

    • @bobater
      @bobater 11 หลายเดือนก่อน

      The number on the right is actually the total angle we've rotated the vector by up until this point, not the current angle the vector makes with the x-axis. Also yes, this is measured in degrees not radians.

  • @anon_y_mousse
    @anon_y_mousse 11 หลายเดือนก่อน

    One that's fun to play with is base64, since you can use different dictionaries to do the translation. The standard dictionary for internet communications just seems wrong to me, so for my own personal use, as in it doesn't need to be decoded by anyone else, I'll use [0-9a-zA-Z\-+] which are even safer for URL encoding due to the lack of a /. Note that I don't use a \ literally, it's escaping the -. Now I'm going to play with some math and see if I can finally understand how sine and cosine were derived generically.

  • @anon_y_mousse
    @anon_y_mousse 11 หลายเดือนก่อน

    I think you've just given me the insight I needed to figure out how the equations were derived in the first place. Taking the simple ratios of a unit circle and making them more complicated by stepping makes so much sense I don't know why I didn't think of it before, but hopefully I'll build up a better understanding of math because of this.

  • @roger7341
    @roger7341 11 หลายเดือนก่อน

    CORDIC rotations first used in HP35 calculator?

    • @vladimirbenrath6646
      @vladimirbenrath6646 10 หลายเดือนก่อน

      No, many years ago before: in 1956 in DIVIC.

  • @RisetotheEquation
    @RisetotheEquation 11 หลายเดือนก่อน

    Hey Bobater, great job! I was wondering if any of this might help explain the super cool phenomenon of tan 89, tan 89.9, tan 89.99, etc. Why they keep going up by factors of 10 has always been something I've been curious about.

    • @Noname-67
      @Noname-67 9 หลายเดือนก่อน

      It's easier to see when you convert them contangents using the fact that cot x = tan(90-x). This results in cot 1, cot 0.1, cot 0.01. They approximately scales by factor of 10 is because cot x is close to 1/x for small x, using sin x ≈ x and cos x ≈ 1.

  • @nikita_x44
    @nikita_x44 11 หลายเดือนก่อน

    in practice, if you alredy have microcomputer capable of simple operations then you should use polynomial approximation of sin/cos up to 5th power for sine(3 terms) and 4th for cosine(constant + 2 terms). it is pretty fast and uses only couple multiplications and additions.

    • @bobater
      @bobater 11 หลายเดือนก่อน

      Yes if you have access to fast hardware multiplication it’s usually better to use a polynomial based method rather than CORDIC. CORDIC is a better method on computers without access to fast hardware multiplication.

  • @Stakodron
    @Stakodron 11 หลายเดือนก่อน

    Very good Video really. But out of the eye of a newbie to Math and Computersince i would like to know why we need to do it this way. So why is this such a big problem for Computers in the first place ;) .

    • @bobater
      @bobater 11 หลายเดือนก่อน

      Well, think about it. How would you go about computing sin(x) if you had to do it yourself? Since sin(x) is a transcendental function, we need to use something like an infinite series or some approximation to actually calculate it. We can’t actually add infinite terms though, and often the terms of the series are expensive to compute. This is where the challenge lies and what led to the development of algorithms like CORDIC and other approximations.

  • @MrSilversMathSheets
    @MrSilversMathSheets 11 หลายเดือนก่อน

    This is a really nice video. I am excited about the content on this channel because it corresponds well to the content on my new channel. Your video is very professional and easy to understand - a feat considering the content. One quibble: the part about convergence misses a really important point - you need to cover all possible values. It turns out that the atan(.5^n) basis works, but not because the rate of converge is 0.5. For example, tan (pi/4*(.5^n)) would have the same asymptotic rate of convergence but leaves the range of computable values a Swiss cheese of holes. The property you need is sum of all remaining basis numbers must equal or exceed the last included basis number.

    • @bobater
      @bobater 11 หลายเดือนก่อน

      Good point. I'll admit this is something I missed when researching the video, but it makes intuitive sense as to why that property needs to be satisfied. Thanks for bringing this up.

  • @loszhor
    @loszhor 11 หลายเดือนก่อน

    Thank you for the information.

  • @oceannuclear
    @oceannuclear 11 หลายเดือนก่อน

    Thanks for this! I've been meaning to understand CORDIC for a while but there's just too much fluff/ computer science background that I couldn't be bothered to read into. This cuts right through all the fluff (especially the (1/2)^n series at the beginning of the video) and helps me understand it!

    • @bobater
      @bobater 11 หลายเดือนก่อน

      That was exactly my goal in making this video, to just present the ideas and motives behind CORDIC without going too far into the technicalities of it. Glad you liked it!

  • @OmegaQuark
    @OmegaQuark ปีที่แล้ว

    Glad to be here before this channel blows up. Such amazing visuals and intuitions are a scarce thing

  • @Nim2
    @Nim2 ปีที่แล้ว

    Kudos. This is one of my favorites of this SoMe so far.