why you NEED math for programming

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] okay [Music] jesus nope not jesus it's just me what the hell is going on oh yeah um yeah i was working on this program and um yeah i i think i figured it out i think i got the formula so basically if you merge the projection equation wait wait wait what are you doing oh right um okay let let me just show you let me just finish up real quick [Music] ready [Music] wait i i i don't follow this is that it's a donut it's incredible isn't it so so all this just to render a donut on your terminal what the [ __ ] thanks for watching the idea and code were originally from the amazing andy sloan where he was able to code this whole program and see and made the code itself look like a donut he has an article explaining how the code works which i'll link in the description so why is math important for programming well it's because even if 99 of the time you won't need it there's a one percent chance that you might and it's in those moments that separate out a great programmer from average ones and if you do know your math you'll know how to modify this donut to increase the size change the rotation or even make a cube instead also if you want to do computer graphics machine learning or cryptography you're gonna need math so might as well get good at it as you did for programming anyway back to the donut how do we write this program well first you have to create a donut which is essentially a solid of revolution where we have a circle that rotates around the y-axis which will make a donut aka a tourist this is the formula to create the circle centered at r2 with radius r1 and this is the rotation matrix to rotate this circle around the y axis so when we combine them we get the coordinates of every point on your donut now that we have a donut shut up i know this is a bagel now that we have a donut we want to rotate it around the x and z axis so it looks cool all flying and stuff we can do that by multiplying our donut coordinates with these two rotation matrices now we have to map this 3d flying donut onto a 2d screen which will become our terminal so each character on the terminal will be a pixel on the screen to figure out how to shade our donut we calculate the dot product of the surface normal and the direction of the light so as you can see when the normal points this way it's way brighter and when it points that way it's way darker so the dot product will tell us how light or dark it is we take the result of the dot product and map it into these characters from darkest to brightest and lastly we draw that on our terminal and voila if you like the way i teach you can check out my new course on data structures and algorithms where i use easy to understand animations to explain these concepts the first 100 people to sign up for joma class will get 15 percent off joma class
Info
Channel: Joma Tech
Views: 8,668,409
Rating: undefined out of 5
Keywords: joma, vlog
Id: sW9npZVpiMI
Channel Id: undefined
Length: 5min 2sec (302 seconds)
Published: Wed Jan 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.