Omniadisce

Posts tagged Python

153 posts match

Type
Subject
Difficulty
Tags
Show all 247 tags
Lesson
Scientific Computing Beginner Lesson

Computational physics 16.6: Standing waves

Start the rope in the shapes of physics lesson 10.4, sines with whole loops, and they swing in place, with nodes that never move. Time them with a stopwatch, check f = nv/(2L), and find the note ofโ€ฆ

1 view by Weten 8 days ago
Lesson
Scientific Computing Beginner Lesson

Computational physics 18.1: A drunkard's walk

A walker leaves a lamp post and takes each step left or right at random. Simulate his walk with rng.choice([-1, 1]), one step at a time and then all at once, and draw his whole path withโ€ฆ

1 view by Weten 8 days ago
Lesson
Scientific Computing Beginner Lesson

Computational physics 18.2: Many walkers at once

One walk tells one story; a crowd tells what is typical. Make a table of random steps with size=(walkers, steps), one row per walker, and add each row with np.sum(steps, axis=1) to find where allโ€ฆ

1 view by Weten 8 days ago
Lesson
Scientific Computing Beginner Lesson

Computational physics 18.3: Spreading as โˆšN

Square the ends so the two sides can't cancel: the mean of xยฒ comes out at N, the number of steps. Its square root, the typical distance, is โˆšN: four times the steps, only twice as far. See it atโ€ฆ

1 view by Weten 8 days ago
Lesson
Scientific Computing Beginner Lesson

Computational physics 18.4: Steps in time and space

A molecule in still water is knocked about at random: a random walk with a jump dx every dt. After a time t it is typically dxยทโˆš(t/dt) away, so it spreads as โˆšt, and twice as far takes four times asโ€ฆ

1 view by Weten 8 days ago
Lesson
Scientific Computing Beginner Lesson

Computational physics 18.5: Counting walkers

Where is the crowd? Count the walkers at each position with np.sum(x == k) and draw the counts: a histogram, bell-shaped, with gaps at every odd position. A walker who sometimes stays put fills theโ€ฆ

1 view by Weten 8 days ago
Lesson
Scientific Computing Beginner Lesson

Computational physics 19.1: A gas in a box

Three hundred molecules in a box, kept in two arrays and moved all at once with pos = pos + velยทdt. Walls that bounce them back, and a gas that spreads out to fill its box and stays spread. A litreโ€ฆ

1 view by Weten 8 days ago
× Enlarged view