Saltar al contenido
The Lumenary
6.º a 8.º gradoComputationPlanificado

Programming for mathematics

Writing short Python programs that use variables, loops, conditionals and functions to explore mathematics: generating sequences, testing conjectures on many cases, and representing numbers in binary.

math.comp.programming-intro

La lección de este tema todavía no se ha escrito. El esquema siguiente forma parte del mapa del plan de estudios y no ha sido revisado.

Se basa en

Requisitos previos obligatorios, hasta el fondo: 9

Aprenderás a

  • Write programs with variables, loops, conditionals and functions to compute sums, tables and sequences.
  • Use a program to test a conjecture on many cases, and explain why this is evidence but not proof.
  • Convert between decimal and binary representations, by hand and in code.

Definición

  • A program variable names a stored value that can change while the program runs.
  • A program function takes inputs (arguments) and returns an output, possibly with other effects.
  • In base 2, the digits 0 and 1 count ones, twos, fours, eights and so on.

Teorema

  • Every positive whole number has exactly one binary representation without leading zeros.
  • Checking a statement for the first million cases is experimental evidence, not a proof.
  • Floating-point numbers are approximations: in Python, 0.1 + 0.2 == 0.3 evaluates to False.

Errores frecuentes

  • Reading '=' in a program (assignment) as mathematical equality.
  • Believing a program that runs without errors must compute the right answer.
  • Assuming computer arithmetic with decimals is exact.

Conduce a

Descubrimientos opcionales

Itinerarios de aprendizaje

Lecturas complementarias

  • Allen B. Downey, Think Python