-
Notifications
You must be signed in to change notification settings - Fork 956
homework-template:0.1.0 #4281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dhayer200
wants to merge
1
commit into
typst:main
Choose a base branch
from
dhayer200:add-homework-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
homework-template:0.1.0 #4281
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 dhayer200 | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # homework-template | ||
|
|
||
| A minimal Typst package for math homework with styled boxes for questions, parts, answers, proofs, definitions, and theorems. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```typst | ||
| #import "@preview/homework-template:0.1.0": * | ||
|
|
||
| #header( | ||
| name: "Your Name", | ||
| course: "Math 110 — Linear Algebra", | ||
| hw: "3", | ||
| date: "March 4, 2026", | ||
| professor: "Prof. Smith", // optional | ||
| ) | ||
|
|
||
| #qs(title: [Prove that the additive identity is unique.])[ | ||
| #pt(title: [Uniqueness of zero])[ | ||
| #prf[ | ||
| Suppose $0$ and $0'$ are both identities. Then $0 = 0 + 0' = 0'$. | ||
| ] | ||
| ] | ||
| ] | ||
| ``` | ||
|
|
||
| See [`example.typ`](example.typ) for a full working document. | ||
|
|
||
| ## Functions | ||
|
|
||
| | Function | Description | | ||
| |----------|-------------| | ||
| | `header(name, course, hw, date, professor?, topic?)` | Page header with rule | | ||
| | `qs(title?)[ ]` | Numbered question box | | ||
| | `pt(title?)[ ]` | Lettered part (a., b., …); nests to i., ii., … | | ||
| | `ans[ ]` | Answer/solution block | | ||
| | `prf[ ]` | Proof block with flush-right QED mark | | ||
| | `defn(title?)[ ]` | Definition box | | ||
| | `thm(title?)[ ]` | Theorem box | | ||
| | `eg(title?)[ ]` | Example box | | ||
| | `notn(title?)[ ]` | Notation box | | ||
| | `note[ ]` | Left-ruled remark | | ||
| | `vc(sym)` | Vector arrow shorthand: `vc(v)` → $\vec{v}$ | | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| #import "@local/homework-template:0.1.0": * | ||
|
Check warning on line 1 in packages/preview/homework-template/0.1.0/example.typ
|
||
|
|
||
| #header( | ||
| name: "Deep Hayer", | ||
| course: "Math 110 — Linear Algebra", | ||
| hw: "3", | ||
| date: "March 4, 2026", | ||
| professor: "Prof. Sheldon Axler", | ||
| ) | ||
|
|
||
| // ───────────────────────────────────────────────────────────────────────────── | ||
| // Background definitions the homework builds on | ||
| // ───────────────────────────────────────────────────────────────────────────── | ||
|
|
||
| #defn(title: [vector space])[ | ||
| A _vector space_ over $FF$ is a set $V$ together with addition and scalar | ||
| multiplication satisfying commutativity, associativity, additive identity, | ||
| additive inverses, multiplicative identity, and distributive properties. | ||
| ] | ||
|
|
||
| #notn(title: [$FF^n$])[ | ||
| $FF^n$ denotes the set of all lists of length $n$ with entries in $FF$ | ||
| (either $RR$ or $CC$). | ||
| ] | ||
|
|
||
| // ───────────────────────────────────────────────────────────────────────────── | ||
| // Questions | ||
| // ───────────────────────────────────────────────────────────────────────────── | ||
|
|
||
| #qs(title: [Let $V$ be a vector space over $FF$. Prove each of the following.])[ | ||
| #pt(title: [The additive identity $0 in V$ is unique.])[ | ||
| #prf[ | ||
| Suppose $0$ and $0'$ are both additive identities in $V$. Then | ||
| $ 0 = 0 + 0' = 0', $ | ||
| where the first equality uses the fact that $0'$ is an identity and | ||
| the second uses the fact that $0$ is an identity. Hence $0 = 0'$. | ||
| ] | ||
| ] | ||
|
|
||
| #pt(title: [Every element of $V$ has a unique additive inverse.])[ | ||
| #prf[ | ||
| Let $v in V$ and suppose $w, w'$ are both additive inverses of $v$. Then | ||
| $ w = w + 0 = w + (v + w') = (w + v) + w' = 0 + w' = w'. $ | ||
| Hence the additive inverse is unique. | ||
| ] | ||
| ] | ||
|
|
||
| #pt(title: [$0 v = 0$ for every $v in V$, where the left $0$ is the scalar and the right $0$ is the zero vector.])[ | ||
| #prf[ | ||
| For any $v in V$, | ||
| $ 0 v = (0 + 0) v = 0 v + 0 v. $ | ||
| Adding $-(0 v)$ to both sides gives $0 = 0 v$. | ||
| ] | ||
| ] | ||
| ] | ||
| #v(10em) | ||
| #qs(title: [Let $U = {(x_1, x_2, x_3, x_4) in FF^4 : x_1 + 2 x_2 = 0 "and" x_3 = 5 x_4}$.])[ | ||
| #pt(title: [Show that $U$ is a subspace of $FF^4$.])[ | ||
| #ans[ | ||
| We verify the three subspace conditions. | ||
|
|
||
| #pt(title: [Additive identity])[ | ||
| $(0,0,0,0)$ satisfies $0 + 2(0) = 0$ and $0 = 5(0)$, so $0 in U$. | ||
| ] | ||
|
|
||
| #pt(title: [Closed under addition])[ | ||
| Let $(x_1,x_2,x_3,x_4),(y_1,y_2,y_3,y_4) in U$. Then | ||
| $ (x_1+y_1) + 2(x_2+y_2) = (x_1+2x_2) + (y_1+2y_2) = 0+0 = 0, $ | ||
| and $x_3+y_3 = 5x_4+5y_4 = 5(x_4+y_4)$. So the sum is in $U$. | ||
| ] | ||
|
|
||
| #pt(title: [Closed under scalar multiplication])[ | ||
| Let $lambda in FF$ and $(x_1,x_2,x_3,x_4) in U$. Then | ||
| $ lambda x_1 + 2(lambda x_2) = lambda(x_1 + 2x_2) = 0, $ | ||
| and $lambda x_3 = lambda(5 x_4) = 5(lambda x_4)$. So $lambda (x_1,dots,x_4) in U$. | ||
| ] | ||
|
|
||
| Hence $U$ is a subspace of $FF^4$. | ||
| ] | ||
| ] | ||
|
|
||
| #pt(title: [Find a basis for $U$ and state $dim U$.])[ | ||
| #ans[ | ||
| The constraints $x_1 = -2x_2$ and $x_3 = 5x_4$ leave $x_2$ and $x_4$ | ||
| as free variables. Setting $(x_2, x_4) = (1,0)$ and $(0,1)$ gives | ||
| $ | ||
| e_1 = (-2, 1, 0, 0), quad e_2 = (0, 0, 5, 1). | ||
| $ | ||
| These two vectors span $U$ and are linearly independent, so | ||
| ${e_1, e_2}$ is a basis and $dim U = 2$. | ||
| ] | ||
| ] | ||
| ] | ||
| #v(17em) | ||
| #qs(title: [Suppose $T : V -> W$ is a linear map. Using the theorem below, answer the following.])[ | ||
| #thm(title: [fundamental theorem of linear maps])[ | ||
| $ dim V = dim "null" T + dim "range" T. $ | ||
| ] | ||
|
|
||
| #pt(title: [If $dim V = 7$ and $dim W = 3$, what are the possible values of $dim "null" T$?])[ | ||
| #ans[ | ||
| Since $dim "range" T <= dim W = 3$, we have $dim "range" T in {0,1,2,3}$. | ||
| By the fundamental theorem, | ||
| $ dim "null" T = 7 - dim "range" T in {4, 5, 6, 7}. $ | ||
| ] | ||
| ] | ||
|
|
||
| #pt(title: [Can $T$ be injective if $dim V > dim W$?])[ | ||
| #ans[ | ||
| No. If $T$ is injective then $dim "null" T = 0$, so $dim "range" T = dim V > dim W$, | ||
| contradicting $dim "range" T <= dim W$. | ||
| ] | ||
| ] | ||
| ] | ||
| #qs(title: [Let $v_1, dots, v_m in V$ and define the linear map $T : FF^m -> V$ by $T(c_1, dots, c_m) = c_1 v_1 + dots.c + c_m v_m$.])[ | ||
| #eg(title: [span as range])[ | ||
| The range of $T$ is exactly $"span"(v_1, dots, v_m)$. For instance, if | ||
| $v_1 = (1,0)$ and $v_2 = (0,1)$ in $FF^2$, then $T : FF^2 -> FF^2$ is | ||
| the identity and $"range" T = FF^2$. | ||
| ] | ||
|
|
||
| #pt(title: [Show that $v_1, dots, v_m$ spans $V$ if and only if $T$ is surjective.])[ | ||
| #ans[ | ||
| $T$ is surjective $<==>$ $"range" T = V$ $<==>$ every $v in V$ is a linear | ||
| combination of $v_1, dots, v_m$ $<==>$ $"span"(v_1, dots, v_m) = V$. | ||
| ] | ||
| ] | ||
|
|
||
| #pt(title: [Show that $v_1, dots, v_m$ is linearly independent if and only if $T$ is injective.])[ | ||
| #ans[ | ||
| $T$ is injective $<==>$ $"null" T = {0}$ $<==>$ the only solution to | ||
| $c_1 v_1 + dots.c + c_m v_m = 0$ is $c_1 = dots.c = c_m = 0$ | ||
| $<==>$ $v_1, dots, v_m$ is linearly independent. | ||
| ] | ||
| ] | ||
| ] | ||
|
|
||
| #qs(title: [Let $vc(u) = (1, 2, -1)$ and $vc(v) = (3, 0, 2)$ in $RR^3$. Compute $vc(u) + 2 vc(v)$ and verify it lies in $"span"{vc(u), vc(v)}$.])[ | ||
| #note[ | ||
| The notation $vc(w)$ denotes a vector $w$ with an arrow, used here to | ||
| distinguish vectors from scalars. | ||
| ] | ||
|
|
||
| #ans[ | ||
| $ | ||
| vc(u) + 2 vc(v) = (1,2,-1) + (6,0,4) = (7, 2, 3). | ||
| $ | ||
| Since $(7,2,3) = 1 dot vc(u) + 2 dot vc(v)$, it is a linear combination | ||
| of $vc(u)$ and $vc(v)$, so it lies in $"span"{vc(u), vc(v)}$. | ||
| ] | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the import to use
@previewplease?