import numpy as np
import matplotlib.pyplot as plt
xs = np.linspace(0,10)
plt.title("y = 2x")
plt.xlabel("x")
plt.ylabel("y")
plt.plot(xs,2 * xs)Scientific Computing
Heading
Subheading
This is a complete sentence, as in a paragraph.
- List of items
- Some item
- Some other item
Code block
- Graph
- Table
import pandas as pd
df = pd.DataFrame(np.array([xs, 2*xs]).transpose())
df.columns = ['x','y']
df| x | y | |
|---|---|---|
| 0 | 0.000000 | 0.000000 |
| 1 | 0.204082 | 0.408163 |
| 2 | 0.408163 | 0.816327 |
| 3 | 0.612245 | 1.224490 |
| 4 | 0.816327 | 1.632653 |
| 5 | 1.020408 | 2.040816 |
| 6 | 1.224490 | 2.448980 |
| 7 | 1.428571 | 2.857143 |
| 8 | 1.632653 | 3.265306 |
| 9 | 1.836735 | 3.673469 |
| 10 | 2.040816 | 4.081633 |
| 11 | 2.244898 | 4.489796 |
| 12 | 2.448980 | 4.897959 |
| 13 | 2.653061 | 5.306122 |
| 14 | 2.857143 | 5.714286 |
| 15 | 3.061224 | 6.122449 |
| 16 | 3.265306 | 6.530612 |
| 17 | 3.469388 | 6.938776 |
| 18 | 3.673469 | 7.346939 |
| 19 | 3.877551 | 7.755102 |
| 20 | 4.081633 | 8.163265 |
| 21 | 4.285714 | 8.571429 |
| 22 | 4.489796 | 8.979592 |
| 23 | 4.693878 | 9.387755 |
| 24 | 4.897959 | 9.795918 |
| 25 | 5.102041 | 10.204082 |
| 26 | 5.306122 | 10.612245 |
| 27 | 5.510204 | 11.020408 |
| 28 | 5.714286 | 11.428571 |
| 29 | 5.918367 | 11.836735 |
| 30 | 6.122449 | 12.244898 |
| 31 | 6.326531 | 12.653061 |
| 32 | 6.530612 | 13.061224 |
| 33 | 6.734694 | 13.469388 |
| 34 | 6.938776 | 13.877551 |
| 35 | 7.142857 | 14.285714 |
| 36 | 7.346939 | 14.693878 |
| 37 | 7.551020 | 15.102041 |
| 38 | 7.755102 | 15.510204 |
| 39 | 7.959184 | 15.918367 |
| 40 | 8.163265 | 16.326531 |
| 41 | 8.367347 | 16.734694 |
| 42 | 8.571429 | 17.142857 |
| 43 | 8.775510 | 17.551020 |
| 44 | 8.979592 | 17.959184 |
| 45 | 9.183673 | 18.367347 |
| 46 | 9.387755 | 18.775510 |
| 47 | 9.591837 | 19.183673 |
| 48 | 9.795918 | 19.591837 |
| 49 | 10.000000 | 20.000000 |
- Equation
- The following is sufficient for the \(\LaTeX\) requirement
import sympy
x, y = sympy.symbols("x y")
sympy.Eq(y, 2*x)\(\displaystyle y = 2 x\)
Wordcount
You are not required to include this in your final, though it may be helpful to do so, perhaps with some commentary to the effect of “I found it easy to talk about \(x\) or hard to talk about \(y\) or I learned \(z\) while writing”.
- It is not the easiest thing in the world to have a file calculate its own wordcount.
- The following does so.
- It uses
subprocesswhich replacesosbut is a bit more confusing.
import subprocess # instead of os
print(subprocess.getoutput("wc index.qmd")) 67 193 1274 index.qmd