Declarators and integrals.

main
Joshua Potter 2024-12-06 14:25:50 -07:00
parent f24d5bfa69
commit 65cd49bf20
22 changed files with 824 additions and 231 deletions

View File

@ -230,7 +230,13 @@
"ordered-rooted-tree-cmp.png",
"ordered-binary-tree-cmp.png",
"lcrs-nodes.png",
"binary-tree-nodes.png"
"binary-tree-nodes.png",
"abs-right.png",
"abs-left.png",
"abs-up.png",
"abs-down.png",
"abs-right-down.png",
"abs-left-down.png"
],
"File Hashes": {
"algorithms/index.md": "3ac071354e55242919cc574eb43de6f8",
@ -345,7 +351,7 @@
"c17/strings.md": "b021b6f18f865aa89b3088907cdaae94",
"c17/index.md": "856fa90e945e84cf6b651fed44df4cad",
"c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500",
"c17/declarations.md": "87f1339be820217aec4d92cc41448805",
"c17/declarations.md": "d66c1fb83f3bddaec61f3b9644f9fd6d",
"algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd",
"_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4",
"_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7",
@ -684,7 +690,7 @@
"_journal/2024-07-13.md": "13b5101306b5542b8a1381a6477378ca",
"_journal/2024-07/2024-07-12.md": "8073584fae2fe7bffcd4b69a7cd29058",
"hashing/static.md": "3ec6eaee73fb9b599700f5a56b300b83",
"hashing/addressing.md": "d00477899acfdb87c7f5d4e6493faa58",
"hashing/addressing.md": "d7d508ac10a66a6ca7b372eb6b76040d",
"ontology/index.md": "0994403dcd84415f1459752129b55f65",
"ontology/permissivism.md": "643e815a79bc5c050cde9f996aa44ef5",
"ontology/properties.md": "91ece501551c444afcd119d7197958ef",
@ -807,9 +813,9 @@
"c17/enums.md": "9414fb67aa256a0a11b7240534c67bf6",
"c17/derived-types.md": "6fb8f23a2423f05d5bdccb6672a32e38",
"c17/basic-types.md": "7c6653bf6dc24c2f2aa72fc95c4f7875",
"c17/types/simple.md": "6355a7dbe53ddc4e77085bece76f3c29",
"c17/types/simple.md": "d54f9f20c2f74c9e7278cb6f06201df7",
"c17/types/enumerated.md": "e1f70a30677c776b7b44ac3e0ff4e76d",
"c17/types/derived.md": "73d2d84eefc83585afbecce54890b3d1",
"c17/types/derived.md": "fd1ecb61bed82fb6e44c170b023e5eeb",
"c17/types/basic.md": "5064e21e683c0218890058882e06b6f3",
"c17/types/index.md": "df9b52726a27ae97864aecf42609e9e2",
"_journal/2024-08-25.md": "e73a8edbd027d0f1a39289540eb512f2",
@ -928,7 +934,7 @@
"_journal/2024-10/2024-10-31.md": "8c5e70f566953974f252da9472e527f0",
"_journal/2024-10/2024-10-30.md": "054bdbf52843fa2445f6b9f91d5ca46e",
"_journal/2024-10/2024-10-29.md": "432b3b073dafd54421ff6f7182ab9a58",
"c17/alignment.md": "8d52fdf4834e9f13da3be0719da45b9a",
"c17/alignment.md": "94c20731411dc244c13bc00bbf924589",
"_journal/2024-11-05.md": "6a599e6bc9dcd12a0940956285ae4d00",
"_journal/2024-11-06.md": "c91de8a099cfee2514e1054400996e76",
"_journal/2024-11/2024-11-05.md": "79a1304037e18fefa135d576db040784",
@ -939,7 +945,7 @@
"_journal/2024-11/2024-11-08.md": "806bbade5f8339579287687f9433334e",
"_journal/2024-11/2024-11-07.md": "434ec3f15d7065ea740127aa8477dd17",
"x86-64/directives.md": "019c1c1d04efb26c3e8758aac4543cc7",
"geometry/cartesian.md": "52eed93bf2d456ffab76e73d1031187c",
"geometry/cartesian.md": "662f241b94c78dfb8ac1e7fd0c1120e8",
"geometry/index.md": "cac68c1b624dbb0552e56cce47bcc21d",
"_journal/2024-11-10.md": "5478337fd2017b99d0b359713a511e66",
"_journal/2024-11/2024-11-09.md": "46f3a640223ef533f4523837b67b57c3",
@ -952,14 +958,14 @@
"_journal/2024-11/2024-11-12.md": "24c858a93c0a5063820bd96207e6f8ab",
"_journal/2024-11/2024-11-11.md": "d3ad8ddc5ecdb2cc08773fdef2ce6869",
"_journal/2024-11/2024-11-10.md": "38ce405754e3823c8239df44546f3b35",
"x86-64/instructions/procedures.md": "f4e17501f64007883cd656c9a834d926",
"x86-64/instructions/procedures.md": "14d81b7adb4325f3f01da6a1673b0ad6",
"_journal/2024-11-19.md": "1b74d7911d7ba01b5c3adffaa8c2a0ba",
"_journal/2024-11/2024-11-18.md": "db0e4cdaa7361294c7e8a1f36897e6a6",
"_journal/2024-11-22.md": "51117030e2364dbce3a8d507dead86ae",
"_journal/2024-11/2024-11-21.md": "951b6034d60a40dbd8201c50abf0dbb9",
"_journal/2024-11/2024-11-20.md": "951b6034d60a40dbd8201c50abf0dbb9",
"_journal/2024-11/2024-11-19.md": "d879f57154cb27cb168eb1f1f430e312",
"set/cardinality.md": "ee5c8a4c6db54a18710609f312e582f2",
"set/cardinality.md": "dd5a057609b6e5dcc030c97a700abe58",
"geometry/area.md": "dc362cb5be314b2b9e4ecc53f2289af0",
"_journal/2024-11-23.md": "911f82ab8aede5ecdb96493aef64b0b9",
"_journal/2024-11/2024-11-22.md": "51117030e2364dbce3a8d507dead86ae",
@ -969,13 +975,13 @@
"_journal/2024-11/2024-11-24.md": "894b021e6335d4e6947448c8d362c083",
"_journal/2024-11-26.md": "29bc0b54d23034b9108e567a1d5fa8ac",
"_journal/2024-11/2024-11-25.md": "1ec17a8473fa9c4779090ecbd22d70ef",
"calculus/intervals.md": "664b82400ab58313c099f6f9589c2327",
"calculus/intervals.md": "6a317fb5053b172611e9e7ae6f66f609",
"c17/storage.md": "271d9579dc753ecff11b5c227e029d94",
"c17/functions.md": "6b940a69fd680f8a67684192b59460ce",
"c17/functions.md": "283167c88e447fa4dd6284b8ea1ce93e",
"_journal/2024-11-27.md": "5a58e3a0bd08c689d30600021937495d",
"_journal/2024-11/2024-11-26.md": "af7573eb695b61106e04c9f1aee51cc3",
"_journal/2024-11-28.md": "4321856aec890b179f1b569b908bba60",
"c17/linkage.md": "d155d78a605b32ed591f7a2fd61ab74b",
"c17/linkage.md": "1e4f60f07619b9cbf2f71f11aae9e5f4",
"_journal/2024-11-30.md": "c6040ba2caf1c9ff55faed25d7879e9a",
"_journal/2024-11/2024-11-29.md": "4896d849b6345010669047323521e21a",
"_journal/2024-11/2024-11-28.md": "e9d252bc4bc3d6f70db56c36e1090e86",
@ -987,7 +993,12 @@
"_journal/2024-12-03.md": "54480a38f1e16e48529cbb99c5349c74",
"_journal/2024-12/2024-12-02.md": "beb50f6f3656470f2cb28b759b652994",
"_journal/2024-12-04.md": "66488ad5a0934e6b7666e79723e936e1",
"_journal/2024-12/2024-12-03.md": "54480a38f1e16e48529cbb99c5349c74"
"_journal/2024-12/2024-12-03.md": "54480a38f1e16e48529cbb99c5349c74",
"_journal/2024-12-05.md": "efc79d779a0b0354fc0e8658b074a693",
"_journal/2024-12/2024-12-04.md": "965f6619edf1002d960203e3e12a413b",
"_journal/2024-12-06.md": "8ab4dc393cc7d68012b47e28029fd16d",
"_journal/2024-12/2024-12-05.md": "4f3b1e7a43e01cc97b0eed6fbc6c1f96",
"calculus/integrals.md": "a7ef5031ca474cd9d37c1aea85e96237"
},
"fields_dict": {
"Basic": [

View File

@ -0,0 +1,12 @@
---
title: "2024-12-06"
---
- [x] Anki Flashcards
- [x] KoL
- [x] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* Begin notes on [[integrals]], starting with those of step functions.
* Notes on [[cartesian#Shifting|shifting]] graphs.

View File

@ -0,0 +1,12 @@
---
title: "2024-12-05"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] OGS
- [ ] Sheet Music (10 min.)
- [ ] Korean (Read 1 Story)
* Clarification on C `enum`s and declarators.
* Add notes on [[cardinality#Cardinal Numbers|cardinal numbers]].

View File

@ -11,8 +11,23 @@ tags:
For a large class of modern ISAs, storage for basic C datatypes respect **self-alignment**. This means `char`s can start on any byte address, `short`s on any even address, 4-byte `int`s and `float`s must start on an address divisible by 4, and `double`s must start on an address divisible by 8. Likewise pointers are also self-aligned.
%%ANKI
Basic
What does self-alignment refer to?
Back: The placement of C datatypes on an address divisible by the size of the datatype.
Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed November 4, 2024. [http://www.catb.org/esr/structure-packing/](http://www.catb.org/esr/structure-packing/).
<!--ID: 1730831516929-->
END%%
Wasted space introduced solely for alignment purposes is referred to as **slop**.
%%ANKI
Cloze
With respect to memory alignment, {slop} is {waste space for padding datatypes to their alignment}.
Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed November 4, 2024. [http://www.catb.org/esr/structure-packing/](http://www.catb.org/esr/structure-packing/).
<!--ID: 1730831516944-->
END%%
## Structures
A `struct`'s **stride address** refers to the first address following the `struct` data that has the same alignment as the `struct`. In general the compiler adds various constraints to how a `struct` is layed out:
@ -24,14 +39,6 @@ A `struct`'s **stride address** refers to the first address following the `struc
The `sizeof` operator on a `struct` returns the total space used between its leading address and its stride address.
%%ANKI
Basic
What does self-alignment refer to?
Back: The placement of C datatypes on an address divisible by the size of the datatype.
Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed November 4, 2024. [http://www.catb.org/esr/structure-packing/](http://www.catb.org/esr/structure-packing/).
<!--ID: 1730831516929-->
END%%
%%ANKI
Basic
What addresses can a `char` be stored at?
@ -88,13 +95,6 @@ Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed Nove
<!--ID: 1730831516943-->
END%%
%%ANKI
Cloze
With respect to memory alignment, {slop} is {waste space for padding datatypes to their alignment}.
Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed November 4, 2024. [http://www.catb.org/esr/structure-packing/](http://www.catb.org/esr/structure-packing/).
<!--ID: 1730831516944-->
END%%
%%ANKI
Basic
What value is slop initialized to?

View File

@ -8,106 +8,56 @@ tags:
## Overview
C declarations were designed so that the **declaration** of an object looks like the use of the object. This isn't quite true - keywords like `volatile` and `const` only exist in declarations - but for the most part, this philosophy can be leveraged to read C declarations.
A **declaration** specifies the interpretation and attributes of a set of identifiers. It indicates [[linkage]], [[storage|storage duration]], and part of the type of the entities that the **declarators** denote. For example, the following declaration has two declarators `x` and `y`, both of type `const int`, declared in file scope with static storage duration.
## Declarators
A **declarator** in C is roughly an identifier along with pointers, function brackets, or array indications. Pointers will look like one of:
* `*`
* `* const`
* `* volatile`
* `* const volatile`
* `* volatile const`
whereas **direct declarators** will look like one of:
* `identifier`
* `identifier[size]`
* `identifier(args)`
* `(declarator)`
%%ANKI
Basic
What two qualifiers can be used in a pointer declaration?
Back: `const` and `volatile`.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892098-->
END%%
## Declarations
A **declaration** consists of at least one type-specifier (e.g. `signed short`), storage class (e.g. `static`), and/or type qualifier (e.g. `const`) as well as one or more declarators.
%%ANKI
Basic
How many declarators does a declaration have?
Back: At least one.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892100-->
END%%
%%ANKI
Basic
How many declarations does a declarator have?
Back: N/A.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892101-->
END%%
%%ANKI
Basic
Which part of the following are declarators?
```c
int* a, b;
extern const int x, y;
```
Back: `* a` and `b`.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892102-->
C declarations were designed so that the declaration of an object looks like the use of the object. This isn't always true, but for the most part this philosophy can be leveraged to read them.
%%ANKI
Basic
Consider the following translation unit. What does the declaration refer to?
```c
extern const int x, y;
```
Back: The entire line.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142066-->
END%%
%%ANKI
Basic
Which part of the following are declarations?
What is the type of `y` in the following?
```c
extern const int x, y;
```
Back: `const int`
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142073-->
END%%
%%ANKI
Basic
Consider the following translation unit. What does the declaration refer to?
```c
int* a, b;
```
Back: The entire line is a single declaration.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1722786892103-->
END%%
%%ANKI
Basic
Which part of the following declaration is the declarator?
What is the type of `b` in the following?
```c
const int *const x;
```
Back: `*const x`
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892104-->
END%%
%%ANKI
Basic
Which part of the following declaration is the type specifier?
```c
const int *const x;
int* a, b;
```
Back: `int`
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892105-->
END%%
%%ANKI
Basic
Which part of the following declaration is the type qualifier?
```c
const int *const x;
```
Back: The first `const`.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892106-->
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401427367-->
END%%
%%ANKI
@ -132,6 +82,275 @@ Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Progra
<!--ID: 1722786892108-->
END%%
%%ANKI
Basic
A declaration contains how many declarators?
Back: One or more.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142076-->
END%%
%%ANKI
Basic
A declarator contains how many declarations?
Back: N/A. Declarations contain declarators.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142079-->
END%%
## Declarators
A **declarator** in C is roughly an identifier along with pointers, function brackets, or array indications.
A declarator is said to be **full** if is not part of another declarator. If any part of a full declarator specifies a variable length array type, the declarator is said to be **variably modified**. Types containing variably modified declarators are likewise called **variably modified types** (VMTs).
%%ANKI
Basic
Consider the following declaration. What are its declarators?
```c
int* a, b;
```
Back: `* a` and `b`.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892102-->
END%%
%%ANKI
Basic
Consider the following declaration. What are its declarators?
```c
const int *const x;
```
Back: `*const x`
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892104-->
END%%
%%ANKI
Basic
Consider the following declaration. What is its type specifier?
```c
const int *const x;
```
Back: `int`
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892105-->
END%%
%%ANKI
Basic
Consider the following declaration. What is its type qualifier?
```c
const int *const x;
```
Back: The first `const`.
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
<!--ID: 1722786892106-->
END%%
%%ANKI
Basic
What does it mean for a declarator to be full?
Back: It isn't part of another declarator.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144658-->
END%%
%%ANKI
Basic
What does it mean for a declarator to be variably modified?
Back: It contains a variable length array type.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144664-->
END%%
%%ANKI
Cloze
A {full} declarator is a declarator that {isn't part of another declarator}.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144668-->
END%%
%%ANKI
Basic
What is VMT an acronym form?
Back: **V**ariably **m**odified **t**ype.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144674-->
END%%
%%ANKI
Basic
What are the variably modified declarators of the parameters in the following?
```c
void foo(int n, int M[n][n]);
```
Back: `M[n][n]`
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144680-->
END%%
%%ANKI
Basic
What are the variably modified declarators of the parameters in the following?
```c
void foo(int M[static 1], int *N);
```
Back: `M[static 1]`
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144686-->
END%%
%%ANKI
Basic
Which parameters are variably modified in the following prototype?
```c
void foo(int M, int[*]);
```
Back: The last, unnamed parameter.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144691-->
END%%
%%ANKI
Basic
Which parameters are variably modified in the following prototype?
```c
void foo(int M, int (*fp)(int N[*]));
```
Back: `fp` and `N`.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403144696-->
END%%
## Definitions
A **definition** is a declaration that causes storage to be reserved for the object (for object types) or includes the function body (for function types).
%%ANKI
Basic
A definition contains how many declarators?
Back: One or more.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142082-->
END%%
%%ANKI
Basic
For object types, what distinguishes a declaration from a definition?
Back: A definition causes storage to be reserved.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142085-->
END%%
%%ANKI
Basic
For function types, what distinguishes a declaration from a definition?
Back: A definition includes a function body.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142088-->
END%%
%%ANKI
Basic
What is the relationship between a declaration and a definition?
Back: All definitions are also declarations, but not the other way around.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733401142092-->
END%%
### Initializers
An **initializer** is an expression that gives an object a value at time of declaration. Only variable-length arrays (VLAs) do not allow for an initializer. The default initializer looks like `{0}`.
%%ANKI
Basic
Which part of the following are initializers?
```c
int a = 3;
```
Back: `3`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021580-->
END%%
%%ANKI
Basic
Which part of the following are initializers?
```c
double a = { 7.0 };
```
Back: `{ 7.0 }`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021585-->
END%%
%%ANKI
Basic
Which part of the following are initializers?
```c
double a = { 7.0 };
```
Back: `{ 7.0 }`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
END%%
%%ANKI
Basic
How is the following updated to include initializers `1` and `2` for `a` and `b` respectively?
```c
int a, b;
```
Back:
```c
int a = 1, b = 2;
```
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021590-->
END%%
%%ANKI
Basic
What object types allow initializers?
Back: All but VLAs.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021576-->
END%%
%%ANKI
Basic
What object types do not allow initializers?
Back: Just variable-length arrays.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021596-->
END%%
%%ANKI
Basic
What is the default initializer?
Back: `{0}`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196290195-->
END%%
%%ANKI
Basic
`{0}` is a valid initializer for what object types?
Back: All but VLAs.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196290203-->
END%%
%%ANKI
Basic
`{0}` is not a valid initializer for what object types?
Back: Just variable-length arrays.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196290208-->
END%%
## Precedence Rules
Declarations can be read by complying with the precedence rules outlined below:
1. Find the name of the declaration.
@ -275,96 +494,6 @@ Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Progra
<!--ID: 1722786892125-->
END%%
## Initializers
An **initializer** is an expression that gives an object a value at time of declaration. Only variable-length arrays (VLAs) do not allow for an initializer. The default initializer looks like `{0}`.
%%ANKI
Basic
Which part of the following are initializers?
```c
int a = 3;
```
Back: `3`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021580-->
END%%
%%ANKI
Basic
Which part of the following are initializers?
```c
double a = { 7.0 };
```
Back: `{ 7.0 }`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021585-->
END%%
%%ANKI
Basic
Which part of the following are initializers?
```c
double a = { 7.0 };
```
Back: `{ 7.0 }`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
END%%
%%ANKI
Basic
How is the following updated to include initializers `1` and `2` for `a` and `b` respectively?
```c
int a, b;
```
Back:
```c
int a = 1, b = 2;
```
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021590-->
END%%
%%ANKI
Basic
What object types allow initializers?
Back: All but VLAs.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021576-->
END%%
%%ANKI
Basic
What object types do not allow initializers?
Back: Just variable-length arrays.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196021596-->
END%%
%%ANKI
Basic
What is the default initializer?
Back: `{0}`
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196290195-->
END%%
%%ANKI
Basic
`{0}` is a valid initializer for what object types?
Back: All but VLAs.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196290203-->
END%%
%%ANKI
Basic
`{0}` is not a valid initializer for what object types?
Back: Just variable-length arrays.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1725196290208-->
END%%
## Bibliography
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.

View File

@ -113,14 +113,14 @@ END%%
## Prototypes
A function declaration/definition has two ways of using declarators: **parameter type lists** and **identifier type lists**. To make the distinction clear, consider the following two ways of defining an `add` function:
There exist two ways for a function [[c17/declarations|declaration]] to use declarators: **parameter type lists** and **identifier type lists**. To make the distinction clear, consider the following ways of defining an `add` function:
```c
int f(int x, int y) { return x + y; } // Paramter type list
int f(x, y) int x; int y; { return x + y } // Identifier type list
```
A function **prototype** is a kind of function [[c17/declarations|declaration]] that specifies the function signature. There are three important points to make note of:
A function **prototype** is a function declaration that specifies a function signature. There are three important points to make note of:
* Empty identifier lists are interpreted as "the compiler has not been told what this function's arguments are."
* The standard prohibits declaring functions with a non-empty identifier list.
@ -166,7 +166,7 @@ END%%
%%ANKI
Basic
Which of identifier type lists and/or parameter type lists considered obsolete?
Which of identifier type lists and/or parameter type lists are considered obsolete?
Back: Identifier type lists.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1732031751470-->
@ -275,11 +275,22 @@ END%%
%%ANKI
Basic
Is the following a prototype or a declaration?
Is the following a prototype, declaration, both, or neither?
```c
void f();
```
Back: A declaration.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733492504375-->
END%%
%%ANKI
Basic
Is the following a prototype, declaration, both, or neither?
```c
void f(void);
```
Back: A prototype.
Back: Both.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1732031751509-->
END%%

View File

@ -97,14 +97,6 @@ Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open
<!--ID: 1733010193283-->
END%%
%%ANKI
Basic
When can an identifier have both external and internal linkage?
Back: When specified in two different translation units.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733010193284-->
END%%
%%ANKI
Basic
Within a translation unit, what happens if an identifer has both external and internal linkage?

View File

@ -523,7 +523,7 @@ Is the following an FLA or VLA?
int n = 2;
double a[n] = {0};
```
Back: N/A. This is an invalid assignment.
Back: N/A. Variable-sized objects may not be initialized.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
<!--ID: 1727957576041-->
END%%

View File

@ -1417,32 +1417,40 @@ END%%
%%ANKI
Basic
What name is given to members of an enumeration?
Back: An enumeration constant.
Back: Enumeration constants.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1730902791672-->
END%%
%%ANKI
Basic
What type is given to enumerated-type variables?
Back: N/A. This is compiler dependent.
Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed November 4, 2024. [http://www.catb.org/esr/structure-packing/](http://www.catb.org/esr/structure-packing/).
<!--ID: 1730902856916-->
An enumerated type must be compatible with what three possibilities?
Back: A `char`, a signed integer type, or an unsigned integer type.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403803028-->
END%%
%%ANKI
Basic
What type is *usually* given to enumerated-type variables?
Back: `int`
Reference: Raymond, Eric. “The Lost Art of Structure Packing.” Accessed November 4, 2024. [http://www.catb.org/esr/structure-packing/](http://www.catb.org/esr/structure-packing/).
<!--ID: 1730902856922-->
What is the type given to an enumerated type?
Back: N/A. This is implementation-defined.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403803055-->
END%%
%%ANKI
Basic
What restriction is enforced on the implementation-defined enumerated type?
Back: It must be capable of representing the values of all the members of the `enum`.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1733403803058-->
END%%
%%ANKI
Basic
What kind of integer expressions are enumeration constants limited to?
Back: Integer constant expressions with value representable as an `int`.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1727022810827-->
END%%
@ -1450,23 +1458,23 @@ END%%
Basic
Besides being an ICE, what other condition is expected on enumeration constants?
Back: The ICE evaluates to an integer that fits within an `int`.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1727022810833-->
END%%
%%ANKI
Basic
What mechanism(s) are available for defining constants of type `signed int`?
Back: `enum`s and macros.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
Back: Macros and (possibly) `enum`s.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1727022810839-->
END%%
%%ANKI
Basic
What mechanism(s) are available for defining constants of type `unsigned int`?
Back: Macros.
Reference: Jens Gustedt, _Modern C_ (Shelter Island, NY: Manning Publications Co, 2020).
Back: Macros and (possibly) `enum`s.
Reference: “ISO: Programming Languages - C17,” April 2017, [https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf](https://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf).
<!--ID: 1727022810842-->
END%%

137
notes/calculus/integrals.md Normal file
View File

@ -0,0 +1,137 @@
---
title: Integrals
TARGET DECK: Obsidian::STEM
FILE TAGS: calculus::integrals
tags:
- calculus
- integral
---
## Overview
Let $s$ be a step function defined on [[intervals|interval]] $[a, b]$, and let $P = \{x_0, x_1, \ldots, x_n\}$ be a [[intervals#Partitions|partition]] of $[a, b]$ such that $s$ is constant on the open subintervals of $P$. Denote by $s_k$ the constant value that $s$ takes in the $k$th open subinterval, so that $$s(x) = s_k \quad\text{if}\quad x_{k-1} < x < x_k, \quad k = 1, 2, \ldots, n.$$
The **integral of $s$ from $a$ to $b$**, denoted by the symbol $\int_a^b s(x)\,dx$, is defined by the following formula: $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
%%ANKI
Basic
Apostol first introduces the integral for the ordinate sets of what kind of function?
Back: Step functions.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215060-->
END%%
%%ANKI
Basic
How is the integral of $s$ from $a$ to $b$ denoted?
Back: $\int_a^b s(x) \,dx$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215063-->
END%%
%%ANKI
Basic
Let $s$ be a step function. How is the integral of $s$ from $a$ to $b$ defined?
Back: Given partition $P = \{x_0, x_1, \ldots, x_n\}$ with constant value $s_k$ on the $k$th open subinterval, $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215067-->
END%%
%%ANKI
Basic
What is $\int_a^b s(x) \,dx$ called?
Back: The integral of $s$ from $a$ to $b$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215070-->
END%%
%%ANKI
Basic
Integral $\int_a^b s(x) \,dx$ is assumed to be defined on what interval?
Back: Closed interval $[a, b]$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215074-->
END%%
%%ANKI
Basic
Let $s$ be a step function. $\int_a^b s(x) \,dx$ corresponds to what big operator?
Back: $\sum$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215079-->
END%%
%%ANKI
Basic
Let $s$ be a step function. What does $s_k$ denote in the following definition? $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Back: The value of $s$ on the $k$th open subinterval of $s$'s partition.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215084-->
END%%
%%ANKI
Basic
Let $s$ be a step function. What does $n$ denote in the following definition? $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Back: The number of subintervals in $s$'s partition.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215090-->
END%%
%%ANKI
Basic
Let $s$ be a step function. What does $x_k$ denote in the following definition? $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Back: The right endpoint of the $k$th subinterval of $s$'s partition.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215096-->
END%%
%%ANKI
Basic
Let $s$ be a step function. What does $x_{k-1}$ denote in the following definition? $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Back: The left endpoint of the $k$th subinterval of $s$'s partition.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215100-->
END%%
%%ANKI
Basic
Let $s$ be a step function. What shape is described in the summation body of the following definition? $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Back: A rectangle.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215105-->
END%%
%%ANKI
Basic
Let $s$ be a step function. *Why* don't the values at subdivision points matter in the following definition? $$\int_a^b s(x) \,dx = \sum_{k=1}^n s_k \cdot (x_k - x_{k - 1})$$
Back: The area of a line segment is $0$.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215110-->
END%%
%%ANKI
Basic
Let $s$ be a step function. How does $\int_a^b s(x) \,dx$ relate to refinements of $s$'s partition?
Back: N/A. Its value does not change.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215118-->
END%%
%%ANKI
Basic
Let $s$ be a constant function. What does $\int_a^b s(x) \,dx$ evaluate to?
Back: $c(b - a)$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215126-->
END%%
%%ANKI
Cloze
The {ordinate set} of any step function consists of a finite number of {rectangles}.
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215132-->
END%%
## Bibliography
* Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).

View File

@ -97,6 +97,38 @@ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Int
<!--ID: 1732626063669-->
END%%
%%ANKI
Basic
Let $a, b \in \mathbb{R}$ s.t. $a < b$ and $P = \{x_0, x_1, \ldots, x_n\}$ be a partition of $[a, b]$. What must $x_0$ equal?
Back: $a$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215138-->
END%%
%%ANKI
Basic
Let $a, b \in \mathbb{R}$ s.t. $a < b$ and $P = \{x_0, x_1, \ldots, x_n\}$ be a partition of $[a, b]$. What must $x_n$ equal?
Back: $b$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215144-->
END%%
%%ANKI
Basic
Let $a, b \in \mathbb{R}$ s.t. $a < b$ and $P = \{x_0, x_1, \ldots, x_n\}$ be a partition of $[a, b]$. How many subdivision points does $P$ have?
Back: $n + 1$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215150-->
END%%
%%ANKI
Basic
Let $a, b \in \mathbb{R}$ s.t. $a < b$ and $P = \{x_0, x_1, \ldots, x_n\}$ be a partition of $[a, b]$. How many subintervals does $P$ have?
Back: $n$
Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).
<!--ID: 1733520215156-->
END%%
%%ANKI
Basic
Let $a, b \in \mathbb{R}$ s.t. $a < b$. How is a partition of interval $[a, b]$ denoted?

View File

@ -131,7 +131,152 @@ Reference: Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Int
<!--ID: 1731185808252-->
END%%
## Translations
There are two kinds of translations that we can do to a graph: **shifting** and **scaling**. A **reflection** is a special case of scaling.
%%ANKI
Basic
What are the two kinds of translations that can be done to a graph?
Back: Shifting and scaling.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520214987-->
END%%
%%ANKI
Basic
Which of the two kinds of translations is reflection a special case of?
Back: Scaling.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520269110-->
END%%
### Shifting
A **vertical shift** adds a constant to every $y$-coordinate of a graph, leaving the $x$-coordinate unchanged. A **horizontal shift** adds a constant to every $x$-coordinate of a graph, leaving the $y$-coordinate unchanged.
%%ANKI
Basic
What does it mean for a shift of a graph to be rigid?
Back: A shift does not change the size or shape of the graph.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520214993-->
END%%
%%ANKI
Basic
A {vertical} shift adds a constant to the {$y$}-coordinates of a graph.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520214996-->
END%%
%%ANKI
Cloze
A {horizontal} shift adds a constant to the {$x$}-coordinates of a graph.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215005-->
END%%
%%ANKI
Basic
Let $f(x)$ be a function and $k$ be a constant. What kind of translation is $f(x + k)$?
Back: A horizontal shift.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215013-->
END%%
%%ANKI
Basic
Let $f(x)$ be a function and $k$ be a constant. What kind of translation is $f(x) + k$?
Back: A vertical shift.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215016-->
END%%
%%ANKI
Cloze
Let $f(x)$ be a function and $k$ be a constant. $f(x + k)$ horizontally shifts {left} when {$k > 0$}.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215019-->
END%%
%%ANKI
Cloze
Let $f(x)$ be a function and $k$ be a constant. $f(x) + k$ vertically shifts {down} when {$k < 0$}.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215023-->
END%%
%%ANKI
Cloze
Let $f(x)$ be a function and $k$ be a constant. $f(x) - k$ vertically shifts {up} when {$k > 0$}.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215027-->
END%%
%%ANKI
Cloze
Let $f(x)$ be a function and $k$ be a constant. $f(x + k)$ horizontally shifts {right} when {$k < 0$}.
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215031-->
END%%
%%ANKI
Basic
Consider the graph of $f(x)$ below. What does $f(x)$ equal?
![[abs-right.png]]
Back: $f(x) = \lvert x - 2 \rvert$
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215034-->
END%%
%%ANKI
Basic
Consider the graph of $f(x)$ below. What does $f(x)$ equal?
![[abs-left.png]]
Back: $f(x) = \lvert x + 2 \rvert$
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215040-->
END%%
%%ANKI
Basic
Consider the graph of $f(x)$ below. What does $f(x)$ equal?
![[abs-up.png]]
Back: $f(x) = \lvert x \rvert + 2$
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215046-->
END%%
%%ANKI
Basic
Consider the graph of $f(x)$ below. What does $f(x)$ equal?
![[abs-down.png]]
Back: $f(x) = \lvert x \rvert - 2$
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215049-->
END%%
%%ANKI
Basic
Consider the graph of $f(x)$ below. What does $f(x)$ equal?
![[abs-right-down.png]]
Back: $f(x) = \lvert x - 2 \rvert - 2$
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215053-->
END%%
%%ANKI
Basic
Consider the graph of $f(x)$ below. What does $f(x)$ equal?
![[abs-left-down.png]]
Back: $f(x) = \lvert x + 2 \rvert - 2$
Reference: James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
<!--ID: 1733520215056-->
END%%
## Bibliography
* “Cartesian Coordinate System,” in _Wikipedia_, October 21, 2024, [https://en.wikipedia.org/w/index.php?title=Cartesian_coordinate_system](https://en.wikipedia.org/w/index.php?title=Cartesian_coordinate_system&oldid=1252434514).
* “James Jones, “Shifting, Reflecting, and Stretching Graphs,” accessed December 6, 2024, [https://people.richland.edu/james/lecture/m116/functions/translations.html](https://people.richland.edu/james/lecture/m116/functions/translations.html).
* Tom M. Apostol, _Calculus, Vol. 1: One-Variable Calculus, with an Introduction to Linear Algebra_, 2nd ed. (New York: Wiley, 1980).

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -194,7 +194,7 @@ END%%
%%ANKI
Basic
What is the theoretical maximum load factor in closed addressing?
Back: N/A
Back: N/A. There is no maximum.
Reference: “Hash Tables: Open vs Closed Addressing | Programming.Guide,” accessed June 12, 2024, [https://programming.guide/hash-tables-open-vs-closed-addressing.html](https://programming.guide/hash-tables-open-vs-closed-addressing.html).
<!--ID: 1718759188231-->
END%%

View File

@ -189,7 +189,7 @@ END%%
## Finiteness
A set is **finite** if and only if it is equinumerous to some [[natural-numbers|natural number]]. Otherwise it is **infinite**.
A set is **finite** if and only if it is equinumerous to a [[natural-numbers|natural number]]. Otherwise it is **infinite**.
%%ANKI
Basic
@ -243,6 +243,8 @@ END%%
No natural number is equinumerous to a proper subset of itself. More generally, no finite set is equinumerous to a proper subset of itself.
Likewise, any set equinumerous to a proper subset of itself must be infinite.
%%ANKI
Basic
How does Enderton state the pigeonhole principle for $\omega$?
@ -331,6 +333,108 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
<!--ID: 1732545231412-->
END%%
%%ANKI
Basic
What does the contrapositive of the pigeonhole principle state?
Back: Any set equinumerous to a proper subset of itself is infinite.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760079-->
END%%
%%ANKI
Basic
What general strategy is used to prove $\omega$ is an infinite set?
Back: Prove $\omega$ is equinumerous to a proper subset of itself.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760085-->
END%%
## Cardinal Numbers
A **cardinal number** is a set that is $\mathop{\text{card}} A$ for some set $A$. The set $\mathop{\text{card}} A$ is defined such that
* For any sets $A$ and $B$, $\mathop{\text{card}}A = \mathop{\text{card}}B$ iff $A \approx B$.
* For a finite set $A$, $\mathop{\text{card}}A$ is the natural number $n$ for which $A \approx n$.
%%ANKI
Basic
How is the cardinal number of set $A$ denoted?
Back: As $\mathop{\text{card}} A$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760088-->
END%%
%%ANKI
Basic
Suppose $A$ is finite. What does $\mathop{\text{card}} A$ evaluate to?
Back: The unique $n \in \omega$ such that $A \approx n$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760091-->
END%%
%%ANKI
Basic
Consider $n \in \omega$. What does $\mathop{\text{card}} n$ evaluate to?
Back: $n$
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760094-->
END%%
%%ANKI
Basic
Suppose $a$, $b$, and $c$ are distinct objects. What does $\mathop{\text{card}} \{a, b, c\}$ evaluate to?
Back: $3$
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760097-->
END%%
%%ANKI
Basic
What does Enderton refer to by the "process called 'counting'"?
Back: Choosing a one-to-one correspondence between two sets.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760099-->
END%%
%%ANKI
Cloze
A {cardinal number} is a set that is {$\mathop{\text{card}} A$} for some set $A$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760102-->
END%%
%%ANKI
Basic
How do cardinal numbers relate to equinumerosity?
Back: For any sets $A$ and $B$, $\mathop{\text{card}} A = \mathop{\text{card}} B$ iff $A \approx B$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760105-->
END%%
%%ANKI
Basic
According to Enderton, what is the "essential demand" for defining numbers?
Back: Defining cardinal numbers such that for any sets $A$ and $B$, $\mathop{\text{card}} A = \mathop{\text{card}} B$ iff $A \approx B$.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760108-->
END%%
%%ANKI
Basic
What name is given to $\mathop{\text{card}} \omega$?
Back: $\aleph_0$
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760110-->
END%%
%%ANKI
Basic
Who is attributed the assignment $\mathop{\text{card}} \omega = \aleph_0$?
Back: Georg Cantor.
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
<!--ID: 1733407760113-->
END%%
## Bibliography
* Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).

View File

@ -78,7 +78,7 @@ What return address is pushed onto the stack after `call` is run?
2: callq .L1
3: ...
```
Back: `3`
Back: The address corresponding to line `3`.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1728558288177-->
END%%