Skip to content

Instantly share code, notes, and snippets.

View vettukal's full-sized avatar

Vincent Mathew (vettukal) vettukal

View GitHub Profile
@vettukal
vettukal / births.py
Created October 14, 2023 05:04
more boy births in a small hospital vs big hospital per day
'''
A silly math question posed in our discord: There are two hospitals in a city,
a small and a bigger one. In which of them is the likelihood higher of
more boys than girls being born in one day?
(Provided that girls and boys are on average born equally frequently).
src: https://twitter.com/wagieeacc/status/1712958038871552020
'''
import random
SIMULATIONS = 1000
@vettukal
vettukal / physics
Created April 15, 2023 06:49
ChatGPT mains 2
Li++ Orbit Radius
_________________
Human: Find the radius of the orbit corresponding to the 4th excited state in Li++. (a0 is the radius of first orbit in H-atom)
ChatGPT: The Li++ ion is lithium with two electrons removed, leaving it with a single electron, similar to a hydrogen atom. The energy levels and radii of the orbits in the Li++ ion can be calculated using similar formulas as those used for the hydrogen atom, with adjustments for the different nuclear charge.The formula for the radius of the nth orbit in a hydrogen-like atom (an atom with only one electron) is given by:r_n = n^2 * a_0 / Zwhere:
r_n = radius of the nth orbit
n = principal quantum number (positive integer)
a_0 = Bohr radius (radius of the first orbit in the hydrogen atom, approximately 0.529 Å)
Z = atomic number (number of protons in the nucleus)For Li++, the atomic number Z is 3, since lithium has 3 protons in its nucleus.The 4th excited state corresponds to the 5th energy level, because the ground state is the 1st energy level (n
@vettukal
vettukal / phyics2
Created April 15, 2023 06:48
ChatGPT mains Physics
Kinetic Energy Change Calculation
_________________________________
Human: A block of mass 100 gm is placed on a smooth surface, moves with acceleration of a = 2x, then the change in kinetic energy can be given as (x^n/10), find the value of n.
ChatGPT: To solve this problem, we need to calculate the change in kinetic energy of the block as it accelerates with acceleration given by the expression "a = 2x." We'll then compare the result to the expression "(x^n/10)" to find the value of "n."The kinetic energy of an object is given by the equation KE = (1/2)mv^2, where "m" is the mass of the object and "v" is its velocity.The change in kinetic energy (ΔKE) is the difference between the final kinetic energy (KE_f) and the initial kinetic energy (KE_i). Therefore, ΔKE = KE_f - KE_i.Let's assume that the initial velocity of the block is "u" and the final velocity is "v." The acceleration "a" is given by the expression "a = 2x," where "x" is the displacement of the block. We can use the kinematic equation v^2 = u^
@vettukal
vettukal / mask_filling.py
Created November 1, 2022 02:26
Simple function to fill foreground object after subtraction of two images.
# @njit
def fill_vertical_box2(img, kr, kc):
is0, is1, ks0, ks1 = *img.shape, kr, kc
is0, is1, ks0, ks1 # (5, 4, 3, 1)
rs0, rs1 = is0 - ks0 + 1, is1 - ks1 + 1
rs0, rs1 # (3, 4)
for i in range(rs0):
for j in range(rs1):
le = (i+ks0)
for kle in range(le-1, i-1, -1):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">