Omniadisce

Posts tagged Programming

153 posts match

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

Computational physics 2.5: Adding up as you go

A running total starts at 0 before a loop, grows inside it and is printed after it; a count grows by 1. Add up 1 to 100, the distance of a journey and Galileo's rolling ball, and count with an ifโ€ฆ

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

Computational physics 2.6: A table of free fall

Turn s = ยฝgtยฒ into Python, then let a loop print a table of a falling stone's distance, speed and height, a row for every second, and count the seconds before it lands. Galileo had to time fallingโ€ฆ

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

Computational physics 2.7: while: repeat until

A while loop repeats as long as its condition is True: how many seconds until a dropped stone has fallen 100 m? Write the condition, and fix the loop that never ends. A for loop needs to know howโ€ฆ

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

Computational physics 3.1: Your own function

A function is a formula with a name: write it once, then use it as often as you like. Define speed = distance รท time as a Python function, call it with new numbers, and write a function's bodyโ€ฆ

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

Computational physics 3.2: Return or print?

Free fall, s = ยฝgtยฒ, as a function you call again and again; and the difference between a function that returns its answer and one that only prints it. A function that prints its answer looks as ifโ€ฆ

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

Computational physics 3.4: Lists

Keep many readings under one name: make a list, pick out one reading by its index (counting from 0), count the readings with len, and add a new one with append. In physics lesson 1.5 you timed theโ€ฆ

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

Computational physics 5.2: One small step at a time

How a computer works out motion: from where something is and how fast it goes, take a small step of time dt, again and again. x = x + vยทdt for a cyclist, v = v + aยทdt for a car speeding up. Physicsโ€ฆ

1 view by Weten 8 days ago
× Enlarged view