Skip to content

POW IN SCIENTIFIC CALCULATIONS

Python
#!/usr/bin/env python3
"""
POW IN SCIENTIFIC CALCULATIONS
Physics, chemistry, and engineering applications
"""

print("=== Scientific Notation ===")
# Express numbers as a × 10^b
numbers = [3000000, 0.000045, 602000000000000000000000]

for num in numbers:
    # Find the power of 10
    import math
    if num != 0:
        exponent = int(math.log10(abs(num)))
        mantissa = num / pow(10, exponent)
        print(f"{num} = {mantissa:.2f} × 10^{exponent}")

print("\n=== Newton's Law of Cooling ===")
# T(t) = Ts + (T0 - Ts) * e^(-kt)
# Using discrete approximation
T_surrounding = 20  # degrees
T_initial = 100  # degrees
k = 0.1  # cooling constant
time = 10  # minutes

T_final = T_surrounding + (T_initial - T_surrounding) * pow(2.71828, -k * time)
print(f"Initial temp: {T_initial}°C")
print(f"Room temp: {T_surrounding}°C")
print(f"After {time} minutes: {T_final:.2f}°C")

print("\n=== Sound Intensity (Decibels) ===")
# dB = 10 * log10(I/I0), but we can calculate I from dB
# I = I0 * 10^(dB/10)
I0 = 1e-12  # reference intensity
decibels = [30, 60, 90, 120]

for db in decibels:
    intensity = I0 * pow(10, db/10)
    print(f"{db} dB = {intensity:.2e} W/m²")

print("\n=== Compound Period Formula ===")
# Used in wave mechanics: f = f0 * 2^(n/12)
# Musical note frequencies
base_freq = 440  # A4 note (Hz)
semitones = [0, 2, 4, 5, 7, 9, 11, 12]  # Major scale
notes = ['A', 'B', 'C#', 'D', 'E', 'F#', 'G#', 'A']

print("Musical scale frequencies:")
for semitone, note in zip(semitones, notes):
    freq = base_freq * pow(2, semitone/12)
    print(f"{note}: {freq:.2f} Hz")

print("\n=== pH Calculation ===")
# pH = -log10[H+], but [H+] = 10^(-pH)
pH_values = [1, 4, 7, 10, 14]

for ph in pH_values:
    h_concentration = pow(10, -ph)
    acidity = "Acidic" if ph < 7 else ("Neutral" if ph == 7 else "Basic")
    print(f"pH {ph}: [H+] = {h_concentration:.1e} M ({acidity})")