template/book/syntax_exercises/009.md
2025-03-31 22:12:12 +02:00

70 lines
2.5 KiB
Markdown

# Exercise 9: Use equations
In this exercise, you will learn how to write and format mathematical equations in your TeachBook, both inline and as standalone blocks.
::::::{topic} Exercise objective
Can you format and reference equations correctly in your book?
::::::
```{tip}
Using properly formatted equations makes mathematical expressions clearer and more professional. More details can be found in the [JupyterBook documentation](https://jupyterbook.org/en/stable/content/math.html).
```
## Writing equations
1. Open a new or existing Markdown file where you want to include an equation.
2. Start with a simple block equation using double dollar signs. Try adding the following equation in your Markdown file:
```md
$$ F_{res} = m \cdot a $$
```
3. Now, add an inline equation by enclosing the equation with single dollar signs. Try this example:
```md
The displacement can be found using the equation $s = v \cdot t$.
```
## Formatting mathematical symbols
4. In this step we will experiment with different LaTeX symbols. Use the following table and test each example in your Markdown file:
| Name | Script |
|---|---|
| Square root | `\sqrt{4}` |
| Power | `^{2x}` |
| Fraction | `\frac{2}{3}` |
| Subscript | `_{gem}` |
| Superscript | `^{N}` |
| Multiplication | `\cdot` |
5. Extend this exercise by trying more advanced mathematical expressions:
| Name | Script |
|---|---|
| Derivative | `\frac{\Delta f}{\Delta t}` |
| Integral | `\int_a^b dx` |
| Sine function | `\sin(x)` |
6. Test your understanding by adding a new equation of your choice, ideally one that requires many LaTex symbols!
7. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button.
8. Add a commit message.
9. To see your changes, go to {octicon}`play;1em` `Actions` - The most recent workflow run `overview.md / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root` (getting bored of waiting? There'll be exercising on doing this locally which prevents you from waiting).
10. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.
```{admonition} Check your understanding
:class: note
Before moving on to the next exercise, make sure you understand the following:
- What is the difference between inline and block equations?
- How do you use LaTeX formatting for different mathematical symbols?
```