From 40d4819691fe0ea62aa7c0a63c6f6a029d29bad1 Mon Sep 17 00:00:00 2001 From: mnerv <24420859+mnerv@users.noreply.github.com> Date: Tue, 19 Mar 2024 02:29:39 +0100 Subject: [PATCH] Python environment Include instruction on how to use python environment. Update analys b. --- .gitignore | 5 +- README.md | 20 ++++++ "analys_b/20231027/4b-kurvl\303\244ngd.tex" | 9 ++- compile.sh | 23 +++---- deploy.sh | 32 +++++----- misc/doit.tex | 71 +++++++++++++++++++++ misc/pdm.py | 26 ++++++++ requirements.txt | 15 +++++ 8 files changed, 172 insertions(+), 29 deletions(-) create mode 100644 misc/doit.tex create mode 100644 misc/pdm.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index ee5cf43..7682014 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ dist-ssr node_modules public/*.tar.gz public/pdf +test.png + +# Environments +.venv # Editor directories and files !.vscode/extensions.json @@ -57,4 +61,3 @@ yarn-error.log* # Xcode *.xcworkspace *.xcodeproj - diff --git a/README.md b/README.md index f9445e5..d35316b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,26 @@ Start latex docker image. docker run -it --rm -v "$(pwd):/home/porter/app" --hostname latex --name maths latex ``` +## Python Environment + +Use python environment for generating graph and experiments. Requires `venv`. + +```sh +python3 -m venv .venv +``` + +Activate it by using the script inside the .venv `directory`. + +```sh +.venv/Script/activate.sh +``` + +Install packages from the `requirements.txt` + +```sh +pip install -r ./requirements.txt +``` + ## Resources - Inner product space - diff --git "a/analys_b/20231027/4b-kurvl\303\244ngd.tex" "b/analys_b/20231027/4b-kurvl\303\244ngd.tex" index 1f52ac8..56f2e95 100644 --- "a/analys_b/20231027/4b-kurvl\303\244ngd.tex" +++ "b/analys_b/20231027/4b-kurvl\303\244ngd.tex" @@ -51,8 +51,13 @@ \int_0^2 \sqrt{x'(t)^2 + y'(t)^2} dt &= \int_0^2 \sqrt{\left(e^t - e^{-t}\right)^2 + 2^2} dt \\ \int_0^2 \sqrt{e^{2t} + e^{-2t} + 2} dt &= \left[\begin{aligned} u &= e^{2t} + e^{-2t} + 2\\ - \frac{du}{dt} &= 2e^{2t} - 2e^{-2t} \Leftrightarrow \frac{du}{2} = e^{2t} - e^{-2t}dt - \end{aligned}\right] + \frac{du}{dt} &= 2e^{2t} - 2e^{-2t} \Leftrightarrow du = 2e^{2t} - 2e^{-2t}dt\\ + a &= e^(2 \cdot 0) + e^{-2 \cdot 0} + 2 = 4\\ + b &= e^{2 \cdot 2} + e^{-2 \cdot 2} + 2 = e^4 + e^{-4} + 2 + \end{aligned}\right]\\ + &= \int_a^b \sqrt{u} du = \left[\frac{2}{3}u^{\frac{3}{2}}\right]_a^b\\ + &= \frac{2}{3}\left[u^{\frac{3}{2}}\right]_2^{e^4 + e^{-4}} \\ + &= \frac{2}{3}\left(\left(e^4 + e^{-4}\right)^{\frac{3}{2}} - \left(2\right)^{\frac{3}{2}}\right) \end{align} \end{document} diff --git a/compile.sh b/compile.sh index 6778508..92ed979 100755 --- a/compile.sh +++ b/compile.sh @@ -30,17 +30,18 @@ abs_pdf_dir="" file_deps="" help() { - printf "usage: $arg0 [options] \n" - printf "\n" - printf "options:\n" - printf " -h, --help Show this menu.\n" - printf " --dry-run Dry run the commands.\n" - printf " --build-dir= Specify build directory.\n" - printf " --skip-bibtex Skip generating bibtex.\n" - printf " --no-cache This action skips the cache check.\n" - # printf " --no-spin Disable spin status for compile steps.\n" - printf " --clean Clean before build. This will remove\n" - printf " output pdf and the build intermediate steps.\n" + cat << EOF +usage: $arg0 [options] + +options: + -h, --help Show this menu. + --dry-run Dry run the commands. + --build-dir= Specify build directory. + --skip-bibtex Skip generating bibtex. + --no-cache This action skips the cache check. + --clean Clean before build. This will remove + output pdf and the build intermediate steps. +EOF } parse_args() { diff --git a/deploy.sh b/deploy.sh index c38c3c2..f2c3a56 100755 --- a/deploy.sh +++ b/deploy.sh @@ -19,21 +19,23 @@ is_production=false is_skip_load_cache=false help() { - printf "usage: $arg0 [options]\n" - printf "\n" - printf "options:\n" - printf " -h, --help Show this menu.\n" - printf " --dry-run Dry run the commands.\n" - printf " --clean Clean the output directories build and pdfs\n" - printf " before compiling.\n" - printf " --parallel Use parallel to run the compile scripts.\n" - printf " --production Create pdf in distribution directory.\n" - printf " --build-dir Specify build directory,\n" - printf " example: --build-dir=\"build\". Default: build.\n" - printf " --dist-dir Specify dist directory,\n" - printf " example: --dist-dir=\"dist\". Default: dist.\n" - printf " --cache-uri Set cache uri to download.\n" - printf " --skip-load-cache Skip loading cache.\n" + cat << EOF +usage: $arg0 [options] + +options: + -h, --help Show this menu. + --dry-run Dry run the commands. + --clean Clean the output directories build and pdfs + before compiling. + --parallel Use parallel to run the compile scripts. + --production Create pdf in distribution directory. + --build-dir Specify build directory, + example: --build-dir=\"build\". Default: build. + --dist-dir Specify dist directory, + example: --dist-dir=\"dist\". Default: dist. + --cache-uri Set cache uri to download. + --skip-load-cache Skip loading cache. +EOF } generate_file_index() { diff --git a/misc/doit.tex b/misc/doit.tex new file mode 100644 index 0000000..d2913dd --- /dev/null +++ b/misc/doit.tex @@ -0,0 +1,71 @@ +\documentclass[11pt]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} % Fix weird character +\usepackage{geometry} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{gensymb} +\usepackage{spalign} +\usepackage{xfrac} +\usepackage{parskip} +\usepackage{float} % figure[H] +\usepackage[style=ieee,backend=biber]{biblatex} +\usepackage[breaklinks=true,bookmarks=true,hidelinks]{hyperref} +\usepackage{tikz} +\usepackage{pgfplots} +\pgfplotsset{compat=newest,compat/show suggested version=false} + +\geometry{ + a4paper, + hmargin=2.54cm, + tmargin=1.27cm, + bmargin=1.27cm, + includeheadfoot +} +\setcounter{secnumdepth}{0} % Disable section numbering + +\begin{document} +\section{Dator- och internetteknik} + +\subsection{Computer Architectures} + +\subsubsection{General Architecture} + +Memory + +ALU + +Control Unit + +Registers + +Intterupts + +Cache Memory + +Pipelining + +CISC/RISC + +Bus + +\subsubsection{Different Type of Systems} + +Von-Neumann Model + +General Purpose System + +Parallel Processing + +Flynn's Classification of Computers + +\subsubsection{Instructions} + +Single Instruction and Single Data Stream + +Single Instruction and Multiple Data Stream + +Multiple Instruction and Single Data Stream + +\end{document} + diff --git a/misc/pdm.py b/misc/pdm.py new file mode 100644 index 0000000..6dec2cb --- /dev/null +++ b/misc/pdm.py @@ -0,0 +1,26 @@ +# %% Imports +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +from scipy import signal +from matplotlib.ticker import EngFormatter + +# %% Analytics +# Data for plotting +fs = 10.0 +Ts = 1/fs +f = 5.0 +t = np.arange(0.0, 2.0, Ts) +s = 1 + np.sin(2 * np.pi * f * t * Ts ) + +fig, ax = plt.subplots() +ax.plot(t, s) +# ax.stem(t, s) +ax.set(xlabel='time (s)', ylabel='voltage (mV)', title='Sinewave') +ax.grid(linewidth=1, color='lightgray', alpha=0.5) +ax.grid(which='minor', linestyle=':', linewidth=1, color='lightgray', alpha=0.25) + +# plt.savefig("test.png", dpi=512) +plt.show() + +# %% diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b6158da --- /dev/null +++ b/requirements.txt @@ -0,0 +1,15 @@ +contourpy==1.2.0 +cycler==0.12.1 +fonttools==4.50.0 +kiwisolver==1.4.5 +matplotlib==3.8.3 +numpy==1.26.4 +packaging==24.0 +pandas==2.2.1 +pillow==10.2.0 +pyparsing==3.1.2 +python-dateutil==2.9.0.post0 +pytz==2024.1 +scipy==1.12.0 +six==1.16.0 +tzdata==2024.1