Approximate Square Roots with Calculus!

preview_player
Показать описание
This is a visual technique that uses linear approximation to find the square root of a whole number by finding the equation of the tangent line to points on the square root curve.

Thanks!

#manim #math​​ #mathshorts​ #mathvideo​
#algebra #calculus #mtbos​ #manim​ #animation​ #theorem​ ​​ #iteachmath #spiral #logarithm #square #root #squareroot #function

To learn more about animating with manim, check out:
Рекомендации по теме
Комментарии
Автор

I would love to see you show a visualisation for the generalized version of this like Newton's method of approximation.

frendlyleaf
Автор

Thank you for making square roots easier to calculate.

Salamander
Автор

Since a year ago, I am really interested about that function, but I interpret it as L(x) = a + (x-a^2)/2a, wherein a is the nearest whole number to the square root of x, because those are just the same thing. If you repeat it a lot of times or make a lot of iterations, the result will become much more accurate.

Here is an example:

1st iteration: (using the function you showed in the video)
√3 = √4 + (1/(2√4))(3-4)
=> √3 = 2 - 0.25
=> √3 = 1.75 (accurate to 1 decimal digit)

2nd iteration: (using my interpretation about the function)
√3 = 1.75 + (3 - 1.75^2)/(2 * 1.75)
=> √3 = 1.75 - 0.0625/3.5
=> √3 = (98 - 1)/56
=> √3 = 97/56 ≈ 1.7321 (accurate to 3 decimal digits)

3rd iteration: (also using my interpretation about the function)
√3 = 97/56 + (3 - (97/56)^2)/(2 * 97/56)
=> √3 = 97/56 - (1/3136)/(194/56)
=> √3 = 97/56 - 1/5432
=> √3 = (9409 - 1)/5432
=> √3 = 9408/5432 ≈ 1.7319 (accurate to 2 decimal digits)
Sometimes, that really happens (number of accurate decimal digits decrease), but notice that if the second last digit in the approximation (1.7319) is rounded off, it will become 1.7320, which is accurate to 4 decimal digits.

And so on... I remember watching a video from MindYourDecisions a month ago saying that this algorithm is also used by modern computers to calculate square roots.

Using my paper for computing and my calculator, the 4th iteration of doing the function on the squareroot of 3 is 18817/10864 is approximately 1.7320508, and it is accurate to 7 decimal digits!

Also for my calculations for √267, the result of the first iteration is 16.34375. :)

Bonus: Back then, I watched a video of Tecmath about approximating cube roots, and I saw there that the ∛x = a + (x - a^3)/3a^2, wherein a is the cube root of the nearest cube number to x, that can be rewritten as L(x) = ∛a + (1/3(∛a)^2)(x - a), which looks related to the function in your video that can also be rewritten as L(x) = √a + (1/(2(√a)^1))(x - a). Notice something? The radical power obviously changed, but the power of the variable in the coefficient in the denominator of one of the factors of the product to be added to the nth root of a increased by 1, that can be seen here: √a became ∛a^2.
Does that mean the approximation method for the 4th root of x is equal to ∜a + (1/4(∜a)^3)(x - a) or L(x) = ∜a + (1/4(∜a)^3)(x - a)?
I tried it with ∜50, with a as 81 (50 is nearer to 81 than 16), and the result in the first iteration was 293/108, which when powered by 4, is 7370050801/136048896 or approximately 54.17207, only off by 4 and a bunch of decimal numbers. But when I tried to do the 2nd iteration, I don't know if this was my fault but the result was really far away (in the millions digit) and even is a negative number.

That's all, thank you! 🙂

MellencePeanut
Автор

This is my favorite trick for approximating sqrt. It even works decently rounding to nearest (optionally even) power of two (computationally dirt cheap) as the point to expand at.

daliasprints
Автор

I generalized this to the square root of the nearest perfect square plus the difference over 2 times the square root of the perfect square. For example, √32 is approximately 6 - 4/12, or 5 and 2/3. The actual square root is about 5.65.

reiivc
Автор

This is where that formula came from. Nice

hamzavictor
Автор

You can also use newton-raphson's method (on f(x) = x²-a to find sqrt(a)), which is not very complicated, but can approximate very well within a few iterations!

ilovee
Автор

x² = (a + b)² = a² + 2ab + b²

You can take
a : your first approximation
b : the rest, or the difference

And probably a >> b,
a much bigger than b,
so :
x² = (a + b)² ~ a² + 2ab
2ab ~ x² - a²
==>
b ~ (x² - a²)/(2a)

In this case 144 is a square number just below 150, so
x² = 150
x = a+b
a² = 144
x² = 150 ~ a² + 2*a*b = 144 + 2*12*b
150 ~ 144 + 24b
6 ~ 24b
b ~ 6/24 = 0.25
So
x ~ a+b = 12.25

I think it's the same equation for approximation as in the video, but it's another approach, isn't it ?

whoff
Автор

It is a nice exercise in a calculus class. In general math just use the calculator in your phone.

danielsaldivar
Автор

16 + 267-256/32 ≈ 16.343

There is a simpler way to write it as √(a+b) where a is perfect square.
Then the approximate will be = n + b/2n, where n = √a.
Actually just a few days ago, I was bored & lazy and just asked chatgpt the same thing

cyberawm
Автор

ah yeah i remember our teacher talking about this
using the derivative and supposing that the closest integer is a connected to our number with a line

DanDCool
Автор

Even better: try adding 1 to the denominator. You'd be surprised about how good this approximation is. What it does is it linearly interpolates the graph between perfect squares.

By graphing them, we can see that the maximum error is much, much lower.
[√x]+(x-[√x])/2[√x]
vs
[√x]+(x-[√x])/(2[√x]+1)
[] means whole part.

Here's how to derive the thing in the video without calculus.
Let's divide √x in whole and fractional part.
[√x]=a
x=a²+d
√x=√(a²+d)=
√(a²+d+d²/4a²-d²/4a²)=
√((a+d/2a)²-d²/4a²)
Notice how small the d² term is, and it is amplified even further by √. So we ignore it.
√x≈√(a+d/2a)²=a+d/2a

Why does adding 1 improve it? Well, according to the law of odd numbers, the differences between consecutive squares are consecutive odd numbers.

It means that if we are currently at the point of the graph (a², a), in order to go 1 on the y-axis, we need to go 2a+1 on x axis.

If we do that, we'll find ourselves at the (a²+2a+1, a+1) point. Easy to see that we stay on the graph.

And would you look at that, by adding +1 to the denominator we're doing just that! By increasing d, we linearly move d to the right and d/(2a+1) up. So we'll trace a straight path between two perfect squares.

It's so cool, I think it deserves to have its own video.

KrasBadan
Автор

I just watched your previous video and it is exactly about what I was talking about in my previous comment damn

KrasBadan
Автор

Taylor series when n = 1, x0 = a
P_n(x) = f(x0) + f’(x0) ( x-x0) + ( f’’(x0) ( x - x0)**2 ) /2! + …… +
( f^n(x0) ( x -x0)**n ) /n!

amirammar
Автор

A quadratic approximation improves accuracy.

muralisaripalli
Автор

Achievement unlocked: How did we get here?

kepperbeegames
Автор

I'm not sure if anyone's noticed this, but this method is actually mathematically equivalent to the visual method.

error_o
Автор

(16+11/32)^2! (Without the factorial I guess)

deleted-something
Автор

use square root to calculate square root

goldmathshow
Автор

Isn't this pretty much the same as using the the two known squares either side of the target as demonstrated in your other video?

izzabelladogalini
visit shbcf.ru