Markdown Cheatsheet

COMP 536: Computational Modeling for Scientists

Author

Anna Rosen

Quick reference for writing research and growth memos.

NoteGitHub Compatibility

This guide prioritizes GitHub-compatible Markdown since your memos will be viewed directly on GitHub. All examples here will render correctly in GitHub, VS Code preview, and most Markdown viewers.

Quick Learning Resources

# Clone your assignment repo
git clone https://github.com/YOUR_USERNAME/project-01-YOUR_USERNAME.git

# ALWAYS test before committing
python main.py  # Run your code
python -m pytest tests/  # Run tests if you have them

# Check what files changed
git status

# Add specific files (recommended) or all files
git add src/star.py  # Add specific file
git add .            # Add all changed files

# Commit with descriptive message
git commit -m "Implement Star class with ZAMS properties"

# Push to GitHub
git push

# View commit history
git log --oneline

Basic Formatting

# Heading 1 (Use for memo title)
## Heading 2 (Main sections like "Methodology")
### Heading 3 (Subsections)

Regular paragraph text. No special formatting needed.

Text with **bold emphasis** for important points.
Text in *italics* for emphasis or figure captions.
You can also use ***bold and italic*** together.

> Blockquote for highlighting important findings or quotes.

Horizontal rule (section separator):
---
**Bullet points (unordered):**
- First point
- Second point
  - Nested point (indent 2 spaces)
  - Another nested point
- Back to main level

**Numbered lists:**
1. First step
2. Second step
3. Third step
   1. Sub-step (indent 3 spaces)
   2. Another sub-step

**Mixed lists:**
1. Main point
   - Supporting detail
   - Another detail
2. Next main point
Inline code: Use `np.array()` or `dt = 0.01` in sentences.

Code blocks with syntax highlighting:

```python
def calculate_luminosity(mass, metallicity=0.02):
    """
    Calculate ZAMS luminosity using Tout et al. (1996) fits.

    Parameters
    ----------
    mass : float
        Stellar mass in solar masses
    metallicity : float, optional
        Metallicity (Z), default is solar

    Returns
    -------
    float
        Luminosity in solar luminosities
    """
    # Implementation here
    return luminosity
```

Shell commands:
```bash
python project1_analysis.py --plot_hr_diagram
```

Plain text output:
```
L = 0.698 L_sun, R = 0.888 R_sun, T_eff = 5602 K
```

Advanced Features

GitHub supports LaTeX math notation using dollar signs:

Inline math: The force follows $F = ma$ where $a = GM/r^2$.

Display equations (centered on their own line):

$$
L = 4\pi R^2 \sigma T_{\text{eff}}^4
$$

$$
t_{\text{MS}} = 10 \text{ Gyr} \times \frac{M/M_\odot}{L/L_\odot}
$$

Common symbols:
- Subscripts: $x_i$, $t_0$
- Superscripts: $r^2$, $10^{-5}$
- Greek letters: $\alpha$, $\beta$, $\gamma$, $\Omega$
- Fractions: $\frac{a}{b}$
- Square root: $\sqrt{2}$
- Solar units: $M_\odot$, $L_\odot$, $R_\odot$

Critical for your memos: Figures must be in your outputs/figures/ directory and committed to Git!

## Single Figure

![HR diagram](outputs/figures/hr_diagram.png)
*Figure 1: Hertzsprung-Russell diagram showing the ZAMS main sequence.
Stars are colored by mass, with blue representing hot massive stars
and red representing cool low-mass stars.*

## Referencing Figures in Text

As shown in Figure 1, the main sequence is clearly visible...

## Multiple Related Figures

![Initial conditions](outputs/figures/initial_state.png)
*Figure 2a: Initial stellar population from IMF sampling.*

![Final state](outputs/figures/mass_luminosity.png)
*Figure 2b: Mass-luminosity relation showing Tout et al. fit.*

Important Figure Guidelines:

  1. Always use relative paths starting with outputs/figures/
  2. Include descriptive alt text in the square brackets
  3. Write detailed captions in italics immediately below
  4. Number your figures for easy reference
  5. Save figures before committing - broken image links lose points!

Tables work well for parameters, results comparison, and data summary:

## Simple Table

| Parameter | Value | Units | Description |
|-----------|-------|-------|-------------|
| M | 1.0 | $M_\odot$ | Stellar mass |
| L | 0.698 | $L_\odot$ | ZAMS luminosity |
| R | 0.888 | $R_\odot$ | ZAMS radius |
| $T_{\text{eff}}$ | 5602 | K | Effective temperature |

## Method Comparison Table

| Method | Time (s) | Accuracy | Notes |
|--------|----------|----------|-------|
| Loop | 2.5 | Baseline | Simple but slow |
| Vectorized | 0.3 | Same | 8x faster |
| Pre-allocated | 0.25 | Same | Slightly better |
## External Links
[Tout et al. 1996](https://ui.adsabs.harvard.edu/abs/1996MNRAS.281..257T)

## Internal Links (to other files in your repo)
See [`src/zams.py`](src/zams.py) for implementation details.

Details in the [research memo](research_memo.md).

## Acknowledging Collaborators (REQUIRED if you discussed with others)
### Acknowledgments

I discussed debugging strategies with Jane Doe and the concept of
stellar evolution with John Smith. All code implementation is my own work.

## References Section
## References

1. Tout, C. A., et al. (1996). MNRAS, 281, 257
2. Carroll & Ostlie (2017). *An Introduction to Modern Astrophysics*

Memo Templates

# Research Memo - Project 1: Stellar Populations

**Author:** Your Name
**Date:** February 10, 2026

## Executive Summary

This project implemented ZAMS stellar models using Tout et al. (1996)
fitting functions. Using vectorized calculations, we computed properties
for 10,000 stars sampled from a Salpeter IMF. Key findings include
validation of the mass-luminosity relation and 10x speedup from vectorization...

## Methodology

### ZAMS Relations

We implemented the Tout et al. (1996) fitting functions:
$L = \frac{a_1 M^{5.5} + a_2 M^{11}}{a_3 + M^3 + a_4 M^5 + ...}$

### Object-Oriented Design

Created modular code with `Star` class for individual stars
and `StellarPopulation` for collections...

## Results

### HR Diagram

Figure 1 shows the computed HR diagram...

![HR diagram](outputs/figures/hr_diagram.png)
*Figure 1: HR diagram showing ZAMS main sequence.*

### Vectorization Performance

The vectorized approach achieved 8x speedup...

## Validation

Verified implementation through:
1. Solar ZAMS values: L = 0.698 L_sun (expected ~0.7)
2. Mass-luminosity power law: slope = 3.5 (expected 3-4)
3. Unit tests for edge cases

## Extensions

### Alternative IMF Comparison
Compared Salpeter, Kroupa, and Chabrier IMFs...

## Conclusions

This project demonstrated OOP principles and vectorization
benefits for stellar population synthesis...

## References

1. Tout, C. A., et al. (1996). MNRAS, 281, 257
## Growth Memo - Project 1

**Name:** Your Name
**Date:** February 10, 2026
**Project:** Stellar Populations and OOP

### Summary

We built a stellar population model using object-oriented design,
implementing ZAMS relations to compute luminosity, radius, and
temperature for thousands of stars.

### Technical Skills Developed

I can now design Python classes with proper encapsulation, use
NumPy broadcasting for vectorized calculations, and create
publication-quality HR diagrams with matplotlib.

### Key Challenges & Solutions

**The Problem:**
My vectorized calculation was giving different results than the loop.

**My Solution:**
Discovered I was using integer division instead of float division
in one coefficient. Added explicit float casting and results matched.

**What This Taught Me:**
Always compare vectorized output to a simple loop first. Unit tests
with known values catch subtle bugs.

### AI Usage Reflection

**Most Significant AI Interaction:**
Asked Claude about NumPy broadcasting rules. It explained how shapes
must be compatible and showed examples.

**Critical Thinking Check:**
Claude initially suggested using pandas, but NumPy was simpler for
this problem. I stuck with NumPy after testing both approaches.

### What Got Me Excited

Seeing the HR diagram emerge from just physics equations was amazing!
The main sequence just... appears. That's the actual physics working.

### Reflection

Starting to see why modular code matters. When I found the bug in
my luminosity function, I only had to fix it in one place.

Best Practices

The Golden Rule: Test Before You Commit!

# 1. Test your code runs without errors
python project1_analysis.py

# 2. Quick validation check
python -c "from src.star import Star; s = Star(1.0); print(s.luminosity)"

# 3. If you have tests, run them
python -m pytest tests/

# 4. Check your figures were generated
ls outputs/figures/

# 5. NOW you're ready to commit!
git add .
git commit -m "Add Star class with ZAMS property calculations"

Good commit messages:

# Good - Specific and informative
git commit -m "Add ZAMS luminosity function from Tout et al. fits"
git commit -m "Fix unit conversion bug in temperature calculation"
git commit -m "Add HR diagram plotting function"

# Bad - Too vague
git commit -m "Update"
git commit -m "Fix bug"
git commit -m "Changes"

Essential Setup:

  1. Install “Markdown Preview Enhanced” extension
  2. Use Cmd+Shift+V to preview your memo
  3. Use Cmd+K V to open preview side-by-side

Helpful Extensions:

  • Markdown All in One: Table formatting, shortcuts
  • markdownlint: Catches formatting issues
  • Python: Syntax highlighting, linting

Quick Commands:

  • Toggle bold: Cmd+B
  • Toggle italic: Cmd+I
  • Format document: Shift+Option+F

Before Submitting Research Memo:

Before Submitting Growth Memo:

Git Requirements:

Special Characters

Copy and paste as needed:

Symbol Character LaTeX
Degree \(^\circ\) -
Plus/minus \(\pm\) $\pm$
Approximately \(\approx\) $\approx$
Not equal \(\neq\) $\neq$
Less/greater or equal \(\leq\) \(\geq\) $\leq$ $\geq$
Multiplication \(\times\) $\times$
Arrow \(\to\) $\rightarrow$
Infinity \(\infty\) $\infty$
Solar mass \(M_\odot\) $M_\odot$
Solar radius \(R_\odot\) $R_\odot$
Solar luminosity \(L_\odot\) $L_\odot$

Keep this cheatsheet open while writing your memos. Copy-paste the templates and modify as needed!