|
|
List comprehension is a very useful way to express mathematical ideas. It is a way of creating lists from other lists.
It has the structure [f(x) for x in [some list]] where f(x) can be a previously defined function or just some general expression:
[1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] |
[-5, -2, 3, 10, 19, 30, 43, 58, 75, 94, 115] [-5, -2, 3, 10, 19, 30, 43, 58, 75, 94, 115] |
[75, 58, 43, 30, 19, 10, 3, -2, -5, -6, -5, -2, 3, 10, 19, 30, 43, 58, 75, 94, 115] [75, 58, 43, 30, 19, 10, 3, -2, -5, -6, -5, -2, 3, 10, 19, 30, 43, 58, 75, 94, 115] |
[(-10, 75), (-9, 58), (-8, 43), (-7, 30), (-6, 19), (-5, 10), (-4, 3), (-3, -2), (-2, -5), (-1, -6), (0, -5), (1, -2), (2, 3), (3, 10), (4, 19), (5, 30), (6, 43), (7, 58), (8, 75), (9, 94), (10, 115)] [(-10, 75), (-9, 58), (-8, 43), (-7, 30), (-6, 19), (-5, 10), (-4, 3), (-3, -2), (-2, -5), (-1, -6), (0, -5), (1, -2), (2, 3), (3, 10), (4, 19), (5, 30), (6, 43), (7, 58), (8, 75), (9, 94), (10, 115)] |
|
|
Here's an idea for illustrating inverses:
[(75, -10), (58, -9), (43, -8), (30, -7), (19, -6), (10, -5), (3, -4), (-2, -3), (-5, -2), (-6, -1), (-5, 0), (-2, 1), (3, 2), (10, 3), (19, 4), (30, 5), (43, 6), (58, 7), (75, 8), (94, 9), (115, 10)] [(75, -10), (58, -9), (43, -8), (30, -7), (19, -6), (10, -5), (3, -4), (-2, -3), (-5, -2), (-6, -1), (-5, 0), (-2, 1), (3, 2), (10, 3), (19, 4), (30, 5), (43, 6), (58, 7), (75, 8), (94, 9), (115, 10)] |
|
|
|
|
x |--> 3*x + 19 x |--> 3*x + 19 |
[y == 1/10*x - 7/10] [y == 1/10*x - 7/10] |
x |--> 2/3*x - 5/4 x |--> 2/3*x - 5/4 |
2*x + 61/4 2*x + 61/4 |
2*x + 137/12 2*x + 137/12 |
[3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23] [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23] |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
|
|
Answer the following with
|
|