img

[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

BiryaniEnthu

Stealth

9 months ago

img

salt

Gojek

9 months ago

img

AlphaGrindset

Series A Startup

9 months ago

img

salt

Gojek

9 months ago

img

ThanosIsRight

Meesho

9 months ago

See more comments
img

Iamjustauser

Stealth

9 months ago

img

salt

Gojek

9 months ago

img

Iamjustauser

Stealth

9 months ago

See more comments
img

Elon_Musk

X.com

9 months ago

img

salt

Gojek

9 months ago

img

Elon_Musk

X.com

9 months ago

img

AgilePompom

Zomato

9 months ago

img

salt

Gojek

9 months ago

img

tbk

Startup

9 months ago

img

Sane

KPMG

4 months ago

img

D0nkey05

Stealth

9 months ago

img

salt

Gojek

9 months ago

img

D0nkey05

Stealth

9 months ago

See more comments
img

Micheal_Scott

Grapevine

9 months ago

img

salt

Gojek

9 months ago

img

Micheal_Scott

Grapevine

9 months ago

See more comments
img

Yamprofessional

Stealth

9 months ago

img

salt

Gojek

9 months ago

img

President_Trump

Stealth

9 months ago

img

salt

Gojek

9 months ago

img

SirLewisHamilton

IBM

9 months ago

img

salt

Gojek

9 months ago

img

SirLewisHamilton

IBM

9 months ago

See more comments
img

Rhombus

CARS24

9 months ago

img

salt

Gojek

9 months ago

img

GallonMusk

Software engineer

9 months ago

img

salt

Gojek

9 months ago

img

Rhombus

CARS24

9 months ago

img

salt

Gojek

9 months ago

img

Rhombus

CARS24

9 months ago

img

Asiimov

Porter

9 months ago

img

salt

Gojek

9 months ago

img

Asiimov

Porter

9 months ago

img

salt

Gojek

9 months ago

img

RealOldmonk

Stealth

9 months ago

img

salt

Gojek

9 months ago

img

Sherlock007

TCS

9 months ago

img

salt

Gojek

9 months ago

img

Batman94

Standard Chartered

9 months ago

img

salt

Gojek

9 months ago

img

coala

Scaler

9 months ago

Sign in to a Grapevine account for the full experience.

Discover More

Curated from across

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