# Physics Equations and Diagrams — Documenting Scientific Concepts

> Complete guide to documenting physics concepts with KaTeX equations, Mermaid diagrams, and scientific notation

## Introduction

Physics documentation requires precise mathematical notation, clear diagrams, and structured explanations. Whether you're documenting classical mechanics, electromagnetism, quantum physics, or any other physics domain, combining KaTeX for equations and Mermaid for diagrams creates professional, accessible scientific documentation.

This guide demonstrates how to document physics concepts effectively using AutEng's powerful features. You'll learn to write complex equations, create informative diagrams, and structure scientific content that's both rigorous and readable.

### Why Use AutEng for Physics Documentation?

- **KaTeX Support:** Write complex equations with LaTeX syntax
- **Mermaid Diagrams:** Create flowcharts, state diagrams, and visual explanations
- **Real-time Preview:** See equations and diagrams as you write
- **Version Control:** Track changes to your scientific documentation
- **Collaboration:** Share documentation with colleagues and students

### What You'll Learn

- How to write physics equations using KaTeX
- Creating diagrams for physical systems and processes
- Documenting derivations and proofs
- Best practices for scientific notation
- Structuring physics documentation effectively

## Classical Mechanics: Newton's Laws

Classical mechanics forms the foundation of physics. Let's document Newton's laws with proper equations and diagrams.

### Newton's Second Law

The fundamental equation relating force, mass, and acceleration:

```markdown

Newton's Second Law states that the force acting on an object is equal to the mass of the object multiplied by its acceleration:

$$\\vec{F} = m\\vec{a}$$

Where:
- $\\vec{F}$ is the net force vector (in Newtons, N)
- $m$ is the mass (in kilograms, kg)
- $\\vec{a}$ is the acceleration vector (in m/s²)

In component form:

$$F_x = ma_x, \\quad F_y = ma_y, \\quad F_z = ma_z$$

```

### Kinetic Energy

The energy of motion depends on mass and velocity:

```markdown

The kinetic energy of an object with mass $m$ moving at velocity $v$ is:

$$KE = \\frac{1}{2}mv^2$$

For a system of particles, the total kinetic energy is:

$$KE_{total} = \\sum_{i=1}^{n} \\frac{1}{2}m_i v_i^2$$

**Derivation from Work-Energy Theorem:**

Starting with $W = \\int F \\, dx$ and $F = ma = m\\frac{dv}{dt}$:

$$W = \\int m\\frac{dv}{dt} \\, dx = \\int m\\frac{dx}{dt} \\, dv = \\int mv \\, dv = \\frac{1}{2}mv^2$$

```

### Force Diagram

Visualizing forces acting on an object using a flowchart-style diagram:

```markdown

\`\`\`mermaid
graph TD
    A[Object on Incline] --> B[Weight: mg downward]
    A --> C[Normal Force: N perpendicular to surface]
    A --> D[Friction: f parallel to surface]
    
    B --> E[Component parallel: mg sin θ]
    B --> F[Component perpendicular: mg cos θ]
    
    style A fill:#e3f2fd
    style B fill:#ffebee
    style C fill:#e8f5e9
    style D fill:#fff3e0
    style E fill:#fce4ec
    style F fill:#fce4ec
\`\`\`

**Equations of Motion:**

Parallel to incline: $ma = mg\\sin\\theta - f$

Perpendicular to incline: $N = mg\\cos\\theta$

```

## Electromagnetism: Maxwell's Equations

Maxwell's equations are the foundation of classical electromagnetism. Here's how to document them with proper notation and context.

### The Four Maxwell Equations

```markdown

Maxwell's equations describe how electric and magnetic fields are generated and altered by charges and currents:

**1. Gauss's Law (Electric):**

$$\\nabla \\cdot \\vec{E} = \\frac{\\rho}{\\epsilon_0}$$

Electric field divergence equals charge density divided by permittivity.

**2. Gauss's Law (Magnetic):**

$$\\nabla \\cdot \\vec{B} = 0$$

No magnetic monopoles exist; magnetic field lines form closed loops.

**3. Faraday's Law:**

$$\\nabla \\times \\vec{E} = -\\frac{\\partial \\vec{B}}{\\partial t}$$

A changing magnetic field induces an electric field.

**4. Ampère-Maxwell Law:**

$$\\nabla \\times \\vec{B} = \\mu_0\\vec{J} + \\mu_0\\epsilon_0\\frac{\\partial \\vec{E}}{\\partial t}$$

Magnetic fields are generated by currents and changing electric fields.

**Where:**
- $\\vec{E}$ = electric field (V/m)
- $\\vec{B}$ = magnetic field (T)
- $\\rho$ = charge density (C/m³)
- $\\vec{J}$ = current density (A/m²)
- $\\epsilon_0$ = permittivity of free space
- $\\mu_0$ = permeability of free space

```

### Electromagnetic Wave Equation

```markdown

Taking the curl of Faraday's law and substituting Ampère-Maxwell law (in vacuum, $\\rho = 0$, $\\vec{J} = 0$):

$$\\nabla \\times (\\nabla \\times \\vec{E}) = -\\frac{\\partial}{\\partial t}(\\nabla \\times \\vec{B})$$

Using the vector identity $\\nabla \\times (\\nabla \\times \\vec{E}) = \\nabla(\\nabla \\cdot \\vec{E}) - \\nabla^2\\vec{E}$ and $\\nabla \\cdot \\vec{E} = 0$:

$$-\\nabla^2\\vec{E} = -\\mu_0\\epsilon_0\\frac{\\partial^2 \\vec{E}}{\\partial t^2}$$

This gives the **wave equation**:

$$\\nabla^2\\vec{E} = \\mu_0\\epsilon_0\\frac{\\partial^2 \\vec{E}}{\\partial t^2}$$

The wave speed is:

$$c = \\frac{1}{\\sqrt{\\mu_0\\epsilon_0}} \\approx 3 \\times 10^8 \\text{ m/s}$$

```

### Electromagnetic Wave Propagation

```markdown

\`\`\`mermaid
graph LR
    A[EM Wave] --> B[Electric Field E]
    A --> C[Magnetic Field B]
    A --> D[Direction of Propagation k]
    
    B --> E[Perpendicular to B]
    C --> F[Perpendicular to E]
    D --> G[Perpendicular to both E and B]
    
    E --> H[E ⊥ B ⊥ k]
    F --> H
    G --> H
    
    H --> I[Right-hand rule: E × B = k]
    
    style A fill:#e3f2fd
    style B fill:#ffebee
    style C fill:#e8f5e9
    style D fill:#fff3e0
    style H fill:#f3e5f5
    style I fill:#fce4ec
\`\`\`

**Key Properties:**
- Electric and magnetic fields oscillate perpendicular to each other
- Both fields are perpendicular to the direction of propagation
- Energy flows in the direction of $\\vec{E} \\times \\vec{B}$ (Poynting vector)

```

## Quantum Mechanics: Wave Functions and Operators

Quantum mechanics requires careful notation for wave functions, operators, and probability amplitudes.

### Schrödinger Equation

```markdown

The time-dependent Schrödinger equation describes how quantum states evolve:

$$i\\hbar\\frac{\\partial}{\\partial t}\\Psi(\\vec{r}, t) = \\hat{H}\\Psi(\\vec{r}, t)$$

Where:
- $\\Psi(\\vec{r}, t)$ is the wave function
- $\\hbar = h/2\\pi$ is the reduced Planck constant
- $\\hat{H}$ is the Hamiltonian operator

**Time-Independent Form:**

For stationary states with $\\Psi(\\vec{r}, t) = \\psi(\\vec{r})e^{-iEt/\\hbar}$:

$$\\hat{H}\\psi(\\vec{r}) = E\\psi(\\vec{r})$$

**For a Particle in a Potential:**

$$-\\frac{\\hbar^2}{2m}\\nabla^2\\psi + V(\\vec{r})\\psi = E\\psi$$

```

### Heisenberg Uncertainty Principle

```markdown

The uncertainty principle states that certain pairs of physical properties cannot be simultaneously known to arbitrary precision:

**Position-Momentum Uncertainty:**

$$\\Delta x \\cdot \\Delta p \\geq \\frac{\\hbar}{2}$$

**Energy-Time Uncertainty:**

$$\\Delta E \\cdot \\Delta t \\geq \\frac{\\hbar}{2}$$

**General Form for Operators:**

For any two observables $\\hat{A}$ and $\\hat{B}$:

$$\\Delta A \\cdot \\Delta B \\geq \\frac{1}{2}|\\langle[\\hat{A}, \\hat{B}]\\rangle|$$

Where $[\\hat{A}, \\hat{B}] = \\hat{A}\\hat{B} - \\hat{B}\\hat{A}$ is the commutator.

```

### Quantum State Evolution

```markdown

\`\`\`mermaid
stateDiagram-v2
    [*] --> Superposition: Prepare state
    Superposition --> Measurement: Apply measurement operator
    Measurement --> Eigenstate1: Probability |⟨ψ₁|ψ⟩|²
    Measurement --> Eigenstate2: Probability |⟨ψ₂|ψ⟩|²
    Measurement --> Eigenstate3: Probability |⟨ψ₃|ψ⟩|²
    
    Eigenstate1 --> [*]: Definite value
    Eigenstate2 --> [*]: Definite value
    Eigenstate3 --> [*]: Definite value
    
    note right of Superposition
        |ψ⟩ = c₁|ψ₁⟩ + c₂|ψ₂⟩ + c₃|ψ₃⟩
        Σ|cᵢ|² = 1
    end note
    
    note right of Measurement
        Wave function collapse
        Non-deterministic outcome
    end note
\`\`\`

**Key Concepts:**
- Before measurement: system exists in superposition of states
- Measurement causes wave function collapse
- Outcome is probabilistic, determined by $|\\langle\\psi_i|\\psi\\rangle|^2$
- After measurement: system is in definite eigenstate

```

## Thermodynamics: Laws and Processes

Thermodynamics deals with heat, work, and energy transfer. Let's document the fundamental laws and key processes.

### The Four Laws

```markdown

**Zeroth Law (Thermal Equilibrium):**

If systems A and B are each in thermal equilibrium with system C, then A and B are in thermal equilibrium with each other.

**First Law (Energy Conservation):**

$$\\Delta U = Q - W$$

Where:
- $\\Delta U$ = change in internal energy
- $Q$ = heat added to system
- $W$ = work done by system

**Second Law (Entropy):**

For any thermodynamic process:

$$\\Delta S_{universe} \\geq 0$$

The entropy of an isolated system never decreases. For a reversible process:

$$dS = \\frac{dQ_{rev}}{T}$$

**Third Law (Absolute Zero):**

As temperature approaches absolute zero, the entropy of a perfect crystal approaches zero:

$$\\lim_{T \\to 0} S = 0$$

```

### Carnot Cycle

```markdown

The Carnot cycle represents the most efficient heat engine possible between two temperature reservoirs.

**Efficiency:**

$$\\eta = 1 - \\frac{T_C}{T_H} = \\frac{W}{Q_H}$$

Where:
- $T_H$ = hot reservoir temperature (K)
- $T_C$ = cold reservoir temperature (K)
- $W$ = work output
- $Q_H$ = heat input from hot reservoir

**Carnot Cycle Stages:**

\`\`\`mermaid
graph TD
    A[1. Isothermal Expansion] --> B[2. Adiabatic Expansion]
    B --> C[3. Isothermal Compression]
    C --> D[4. Adiabatic Compression]
    D --> A
    
    A --> E[T = T_H, absorb Q_H]
    B --> F[No heat transfer, T drops]
    C --> G[T = T_C, release Q_C]
    D --> H[No heat transfer, T rises]
    
    style A fill:#ffebee
    style B fill:#e3f2fd
    style C fill:#e8f5e9
    style D fill:#fff3e0
\`\`\`

**Key Insight:** No real engine can exceed Carnot efficiency.

```

### Ideal Gas Law

```markdown

**Ideal Gas Law:**

$$PV = nRT$$

Where:
- $P$ = pressure (Pa)
- $V$ = volume (m³)
- $n$ = number of moles
- $R$ = universal gas constant (8.314 J/(mol·K))
- $T$ = temperature (K)

**Alternative Forms:**

Using $n = N/N_A$ where $N$ is number of molecules:

$$PV = NkT$$

Where $k = R/N_A$ is Boltzmann's constant.

**Internal Energy of Ideal Gas:**

For a monatomic ideal gas:

$$U = \\frac{3}{2}nRT$$

For a diatomic ideal gas:

$$U = \\frac{5}{2}nRT$$

```

## Best Practices for Physics Documentation

Follow these guidelines to create clear, accurate, and professional physics documentation.

### 1. Use Standard Notation

Follow established conventions for symbols and notation:

### 2. Define All Variables

Always explain what each symbol represents and include units:

### 3. Show Derivations Step-by-Step

Break complex derivations into clear, logical steps:

### 4. Use Diagrams Effectively

Complement equations with visual representations:

- Use flowcharts for processes and decision trees
- Use state diagrams for quantum states and transitions
- Label all components clearly
- Use consistent color coding
- Keep diagrams simple and focused

### 5. Provide Physical Interpretation

Don't just present equations—explain what they mean physically. Connect mathematical formalism to real-world phenomena and intuition.

### 6. Include Worked Examples

Demonstrate concepts with concrete numerical examples:

### 7. Cite Assumptions and Limits

Clearly state when equations apply and when they break down. For example, specify if an equation assumes non-relativistic speeds, ideal conditions, or classical (non-quantum) behavior.

## Common Pitfalls & Solutions

### Pitfall 1: Inconsistent Notation

Using the same symbol for different quantities or switching notation mid-document.

### Pitfall 2: Missing Units or Dimensions

Forgetting to specify units makes equations ambiguous and error-prone.

### Pitfall 3: Confusing Scalars and Vectors

Not distinguishing between scalar and vector quantities leads to confusion.

### Pitfall 4: Overly Complex Diagrams

Trying to show too much in one diagram makes it hard to understand.

❌ AVOID:

- Cramming multiple concepts into one diagram
- Using too many colors or styles
- Unlabeled or poorly labeled components
- Overly detailed technical drawings

✅ INSTEAD:

- Create separate diagrams for different concepts
- Use consistent, minimal color schemes
- Label everything clearly
- Focus on the key idea

### Pitfall 5: Skipping Mathematical Steps

Jumping from one equation to another without showing the intermediate steps.

## Advanced Documentation Techniques

Take your physics documentation to the next level with these advanced techniques.

### Tensor Notation

For advanced topics like general relativity, use proper tensor notation:

### Bra-Ket Notation

For quantum mechanics, use Dirac notation consistently:

### Matrix Representations

Use matrices for operators and transformations:

### Combining Multiple Representations

Show the same concept in different forms for deeper understanding:

- Differential form and integral form
- Coordinate representation and abstract notation
- Time domain and frequency domain
- Position space and momentum space

## Conclusion

Effective physics documentation combines precise mathematical notation, clear diagrams, and thoughtful explanations. By using KaTeX for equations and Mermaid for diagrams, you can create professional scientific documentation that's both rigorous and accessible.

### Key Takeaways

- Use standard notation and define all variables
- Show derivations step-by-step with clear explanations
- Complement equations with diagrams and visual aids
- Provide physical interpretation alongside mathematical formalism
- Include worked examples and specify assumptions
- Keep diagrams focused and well-labeled
- Maintain consistency throughout your documentation

### Next Steps

Ready to create your own physics documentation? Start with:

- Review the [KaTeX Syntax Guide](/docs/math/notation/katex-syntax) for equation formatting
- Explore [Mermaid diagrams](/docs/guides/markdown-syntax) for visual representations
- Check out [documentation best practices](/docs/guides/best-practices/documentation-best-practices)
- Start documenting your own physics concepts and experiments
