tinycodinglm / sci /phys-0060.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
1.61 kB
opencode trace
System You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing c...

You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies.

User

Explain the key concepts of relativity in physics, with concrete details and common pitfalls. Include a runnable code example with its expected output.

Assistant

Two Postulates:

  1. Laws of physics are same in all inertial frames
  2. Speed of light is constant (c ≈ 3×10⁸ m/s)

Consequences:

  • Time dilation: Δt' = γΔt, γ = 1/√(1−v²/c²)
  • Length contraction: L' = L/γ
  • Mass-energy: E = mc²
  • Relativistic momentum: p = γmv
python
import numpy as np

c = 3e8  # m/s
def gamma(v):
    return 1 / np.sqrt(1 - (v/c)**2)

# Muon lifetime: 2.2μs at rest
# Without relativity: max distance = c × 2.2μs ≈ 660m
# With relativity at 0.99c: γ ≈ 7, lifetime ≈ 15.4μs
print(f'γ at 0.99c: {gamma(0.99*c):.1f}')
distance = 0.99 * c * 2.2e-6 * gamma(0.99*c)
print(f'Max distance: {distance/1000:.0f}km — explains cosmic ray muons!')

GPS correction: Satellites lose ~38μs/day from time dilation.