P

@pustam_egr

Emptying time ratio vs cross-section ratio

Python
3 months ago
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import quad # ---------------------------- # Physical constants # ---------------------------- g = 9.81 a_out = 0.01 H0 = 1.0

Tank Emptying Comparison Analysis of Two Tapered Tanks (Dimensionless form)

Python
3 months ago
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import solve_ivp, cumulative_trapezoid from scipy.interpolate import interp1d # ---------------------------- # Physical parameters # ---------------------------- g = 9.81 a_out = 0.01

Tank Emptying Comparison Analysis of Two Tapered Tanks

Python
3 months ago
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import solve_ivp, cumulative_trapezoid from scipy.interpolate import interp1d # ---------------------------- # Physical parameters # ---------------------------- g = 9.81 a_out = 0.01

Tank Emptying Comparison Analysis of Two Tapered Tanks: Volume, Height, and Flow Rate

Python
3 months ago
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import solve_ivp, cumulative_trapezoid from scipy.interpolate import interp1d # ---------------------------- # Physical parameters # ---------------------------- g = 9.81 # gravity m/s² a_out = 0.01 # outlet area m²

Age Trend Comparison of Nobel Laureates in Physics, Chemistry, and Medicine (1901-2025)

Python
7 months ago
import csv import datetime import urllib.request import json import matplotlib.pyplot as plt import numpy as np AWARD_DAY = 10 AWARD_MONTH = 12

Nobel Prize Analysis using Nobel Foundation's API

Python
7 months ago
import csv import datetime import urllib.request import json import matplotlib.pyplot as plt import numpy as np AWARD_DAY = 10 AWARD_MONTH = 12 CSV_FILENAME = "physics_nobel_laureates_ages_1901_2025.csv"

Evaluation of bounded and unbounded double integrals

Python
1 year ago
import numpy as np from scipy.integrate import dblquad def integrand_u(x, y): rsq = x**2 + y**2 num = y * (1 - np.exp(-rsq)) denom = 2 * rsq return -num/ denom if rsq != 0 else 0 def integrand_v(x, y):

Rectangle defined by parametric/polar equations

R
1 year ago
library(ggplot2) a <- 150 b <- 75 atan_ba <- atan(b / a) theta1 <- seq(-atan_ba, atan_ba, length.out = 100) theta2 <- seq(atan_ba, pi - atan_ba, length.out = 100) theta3 <- seq(pi - atan_ba, pi + atan_ba, length.out = 100) theta4 <- seq(pi + atan_ba, 2 * pi - atan_ba, length.out = 100)

Cuboid using vertices/edges

Python
1 year ago
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D a, b, c = 150, 75, 50 vertices = np.array([ [-a, -b, -c], [-a, -b, c], [-a, b, -c],

Rectangle using vertices/edges

Octave
1 year ago
a = 150; b = 75; vertices = [ -a, -b; -a, b; a, b; a, -b ];

Rectangle using vertices/edges

Python
1 year ago
import numpy as np import matplotlib.pyplot as plt a, b = 150, 75 vertices = np.array([ [-a, -b], [-a, b], [ a, b], [ a, -b]

Rectangle defined by parametric/polar equations

Python
1 year ago
import numpy as np import matplotlib.pyplot as plt a = 150 b = 75 theta1 = np.linspace(-np.arctan(b/a), np.arctan(b/a), 100) theta2 = np.linspace(np.arctan(b/a), np.pi - np.arctan(b/a), 100) theta3 = np.linspace(np.pi - np.arctan(b/a), np.pi + np.arctan(b/a), 100) theta4 = np.linspace(np.pi + np.arctan(b/a), 2*np.pi - np.arctan(b/a), 100)

Rectangle defined by parametric/polar equations

Octave
1 year ago
a = 150; b = 75; theta1 = linspace(-atan(b/a), atan(b/a), 100); theta2 = linspace(atan(b/a), pi - atan(b/a), 100); theta3 = linspace(pi - atan(b/a), pi + atan(b/a), 100); theta4 = linspace(pi + atan(b/a), 2*pi - atan(b/a), 100); r1 = a ./ abs(cos(theta1)); r2 = b ./ abs(sin(theta2));

Solution to n^2=N with n and N together using each of the digits 1 to 9 only once

Python
1 year ago
from itertools import permutations def is_valid_solution(n, N): combined_digits = str(n) + str(N) return sorted(combined_digits) == ['1', '2', '3', '4', '5', '6', '7', '8', '9'] def find_solutions(): solutions = [] for perm in permutations('123456789'): for i in range(1, 9):

2D heatmap-like plots Christmas tree light length

Python
1 year ago
import numpy as np import matplotlib.pyplot as plt def christmas_light_length(r, h, n): rho = r / h L1 = (h / 2) * np.sqrt(1 + rho**2 * (1 + 4 * np.pi**2 * n**2)) L2 = (h * (1 + rho**2)) / (4 * np.pi * n * rho) * np.arcsinh((2 * np.pi * n * rho) / np.sqrt(1 + rho**2)) return L1 + L2 R_max = 10

Christmas tree light length

Python
1 year ago
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def christmas_light_length(r, h, n): rho = r / h L1 = (h / 2) * np.sqrt(1 + rho**2 * (1 + 4 * np.pi**2 * n**2)) L2 = (h * (1 + rho**2)) / (4 * np.pi * n * rho) * np.arcsinh((2 * np.pi * n * rho) / np.sqrt(1 + rho**2)) return L1 + L2

Prime dates

Python
2 years ago
import math def is_prime(num): if num <= 1: return False if num <= 3: return True if num % 2 == 0 or num % 3 == 0: return False i = 5

Red Heart ❤️

R
2 years ago
dat<-data.frame(t=seq(0,2*pi,by=0.1)) xhrt<-function(t) 16*sin(t)^3 yhrt<-function(t) 13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t) dat$y=yhrt(dat$t) dat$x=xhrt(dat$t) with(dat, plot(x,y, type="l",ylab="",yaxt="n",xlab="",xaxt="n")) with(dat, polygon(x,y, col="red"))

Pi using Ramanujan's formula and Chudnovsky algorithm

Python
2 years ago
#Estimating pi based on Ramanujan's formula and Chudnovsky algorithm import math def estimate_pi(iterations): # Initialize the sum sum_term = 0.0 # Perform the summation for k in range(iterations): term1 = math.factorial(4 * k) * (1103 + 26390 * k)

Triangle of asterisks using nested loops

C
2 years ago
#include <stdio.h> int main() { int n, i, j; printf("Enter the number of rows for the triangle: "); scanf("%d", &n); for (i = 1; i <= n; i++) { // Print spaces to align the asterisks to form a triangle