Lite / Building Machines That Respond / Week 4
Week 4: Mathematical expressions
This week you will
- Translate an engineering formula into a correct Python expression, respecting operator precedence.
- Rearrange a formula for the unknown and convert inputs to consistent units in code.
- Use the math module (sqrt, sin, cos, radians) in a calculation with units stated.
Lessons
- Translate a formula into Python · about 40 min
Two programs compute a voltage divider's output. One says 3.4 V, the other 2211 V. Which pair of brackets is missing? - Rearrange the formula, then compute: an LED resistor · about 40 min
An LED needs 20 mA from a 5 V supply. Ohm's law says R = V/I. Which V, and why does the answer come out 1000 times too small? - The math module: roots, angles and radians · about 35 min
A 2.4 m ramp rises at 30°. Python says its height is −2.37 m. What did the program forget?