img

Why is it a known fact that the angle between two random vectors in a high dimensional space is atleast 45 degree?

I ran the simulations with two random vectors of length 100, and they were indeed atleast 45 degrees apart. But I can't seem to understand why? My approach: 1. Take two vectors of length 100. Randomly allocate values to each component. 2. Compute inverse cosine of ( a . b / |a| |b| ) The histogram is centered around 45 degrees. but why?

img
img

Jackietrader

Google

7 months ago

img

FreeDietCoke

Google

7 months ago

img

LeanAnnual

Anand Rathi

7 months ago

img

Gooner7

Goldman Sachs

7 months ago

img

Dhandha

Venture Capital

7 months ago

img

BareGloom41

Swiggy

7 months ago

img

Vindhyachal

Razorpay

7 months ago

img

hydrogen

Adobe

7 months ago

img

SoFar

Apple

7 months ago

img

EasyVirus

Accenture

7 months ago

img

Bicken_Chiryani

Eviden

7 months ago

Sign in to a Grapevine account for the full experience.

Discover More

Curated from across

img

Misc on

by salt

Gojek

[Thread] What is your favourite math equation?

TLDR: I was reading up on the Navier Stokes equations today and it is so elegant that it might be my favourite math equation. Equation 1: ∇u = 0 (conservation of mass) states that the divergence of the velocity vector u is zero, meaning there is no net change in fluid mass. Equation 2: ρ Du/Dt = -∇p + μ∇^2 u + ρF (conservation of momentum) expresses Newton's second law for fluid flow. It balances the acceleration of fluid particles (LHS) with internal forces (pressure and viscosity) and external forces (gravity or other external influences) on the RHS. This equation is foundational for modelling various fluid dynamics scenarios, from celestial bodies like stars and galaxies to F1 cars. Long Version: Here's how it works: Equation 1: ∇u = 0 (conservation of mass) So, u is velocity that can be represented as (u,v,w) vector, where u,v,w are x,y,z components of the vector. ∇u tells us that we need to do a partial derivative on u. So, ∇u = ∂u/∂x + ∂v/∂y + ∂w/∂z = 0 or, the partial derivative of every component wrt corresponding direction is 0. Equation 2: ρ Du/Dt = -∇p + μ∇^2 u + ρ F (conservation of momentum) LHS: Since, u is velocity, then Du/Dt is acceleration and ρ is density. Newton's second law, F = m x a, applies here. Wherein, Du/Dt is acceleration of fluid particles and m is the density of the fluid. RHS: -∇p + μ∇^2 are the internal forces of particles hitting into each other while F represents the external force. F in most cases is gravity, so one can replace it with g. However, if you put in electromagnetism then, you can combine Navier-Stokes with Maxwell's equations. This has over time led to the development of magnetohydrodynamics, ie how stars and galaxies form. You can model the growth of our sun with this. ∇p is our pressure gradient and represents the change in pressure. Essentially, fluids move from high pressure to low pressure. μ∇^2 represents viscous forces yielding from viscosity. Imagine this can model aerodynamics of F1 cars.

img
img

Software Engineers on

by salt

Gojek

Daily Series #2: Geeking out → Monte Carlo Simulations

I will continue with this series for people who like this kind of content, drop "+1" in the chat and I will tag you the next time I post content. Imagine you have a very complex situation with varying degrees of randomness. How do you evaluate the probability of certain outcomes? One way is a deterministic way which is to sit down and try to compute probabilities of events. Another way is to simulate these interactions with various seed values and see how these outcomes vary. This is called a Monte Carlo simulation, where we use random sampling to model and analyze complex systems that involve uncertainty. Let's set up a game and apply a Monte Carlo simulation to it. You(Hero) and Me(Villain) engage in a strategic coin flipping competition over a series of rounds. Before each round, both of us independently decide whether to flip a coin or pass the turn to the opponent. The outcomes are as follows: 1. If both players decide to flip, a fair coin is tossed, and the player who called it correctly gains a point. 2. If one player decides to flip and the other passes, the flipping player gains a point without the need for a coin toss. 3. If both players pass, no points are gained or lost. We can simulate it by making each decision random: 1. Hero and Villain both independently choose between 0 and 1 for deciding whether to toss or pass. We use 0 as Pass and 1 as Toss. 2. If both pass then we let the scores as is. 3. If one passes and not the other, then we add +1 to whoever decided to toss. 4. If both decide to toss then, we do a random coin flip where 0 = Heads and 1 = Tails. Hero can randomly choose between Heads or Tails. The Villain takes the opposite position. First is the Monte Carlo Simulation and the difference between potential outcomes for 1000 rounds and 20 simulations, which is the graph shared.

img