Mohamed sheik sirajuddeen
have greater quest to acquire more knowledge.. become indispensable ...become invincible
Monday, November 18, 2024
Sunday, August 18, 2024
Nuclear Advocacy Programme-2023 at ICTP, Trieste, Italy
Wednesday, July 10, 2024
Saturday, June 22, 2024
Learn Python codes for the rate of decay of atoms in radioactivity
import math
def compute_quantity(N0, lambda_, T):
N = N0 * math.exp(-lambda_ * T)
return N
# Example usage:
N0 = 100 # Initial quantity
lambda_ = 0.1 # Decay constant
T = 5 # Time
result = compute_quantity(N0, lambda_, T)
print(f"N = {N0} * exp(-{lambda_} * {T}) = {result}")
Chart a python program for the quadratic type x^2-5x+6=0 findings its roots.
import math
def solve_quadratic(a, b, c):
# Calculate the discriminant
discriminant = b**2 - 4*a*c
if discriminant < 0:
return "No real roots"
elif discriminant == 0:
# One real root
root = -b / (2*a)
return (root,)
else:
# Two real roots
root1 = (-b + math.sqrt(discriminant)) / (2*a)
root2 = (-b - math.sqrt(discriminant)) / (2*a)
return (root1, root2)
# Coefficients for the equation x^2 - 5x + 6 = 0
a = 1
b = -5
c = 6
# Solve the equation
roots = solve_quadratic(a, b, c)
print(f"The roots of the equation {a}x^2 + ({b})x + {c} = 0 are: {roots}")
Learn a program for a series (1-x)^2
ef compute_expression(x):
return (1 - x) ** 2
# Example usage:
x_value = 3
result = compute_expression(x_value)
print(f"(1 - {x_value})^2 = {result}")
Simple Code in Python (for beginners) for Prime numbers;
Def is_prime(n):
"""Check if a number is prime."""
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
def generate_primes(limit):
"""Generate a list of prime numbers up to a given limit."""
primes = []
for num in range(2, limit + 1):
if is_prime(num):
primes.append(num)
return primes
# Example usage
limit = 100
prime_numbers = generate_primes(limit)
print(f"Prime numbers up to {limit}: {prime_numbers}")