Latex + Matlab + Jupyter Notebook + Google Colab + Markdown
Latex
- Where to edit — Can be accessed online through the “Overleaf” website.
- File format —
.tex\documentclass[]{article} --> Use \documentclass{...} to choose class \begin{document} use exam or beemer (for slides) instead of article ..... \end{document} use [] for Optional arguments -> eg- font size: [12pt] For title -> use \title{title_name} and Close title using \maketitle
- Packages — load them right after
\documentclass:\usepackage{amsmath}— for equations\usepackage{graphicx}— to insert figures
- Equations & figures
- Use
\begin{equation} ... \end{equation}inside body - Figure skeleton:
\begin{figure} \centering \includegraphics[width=\textwidth]{image_name} \caption{...} \end{figure}
- Use
- Paragraphs — start new paragraph by leaving an empty line
- Graphic adjustments
\includegraphics[width=\textwidth]{image_name}— scale to text width\includegraphics[scale=1.2, angle=45]{image_name}— scale and rotate (45° anticlockwise)\caption{...}— figure caption\hspace{1cm}— horizontal space;\vspace{...}— vertical space
- #1, #2 placeholders — in custom macros:
#1is the first argument passed to the function,#2the second, etc. - Text formatting commands:
\textbf{...}— bold\textit{...}— italic - & in tables — used to separate columns (left from right).
- Common font-size chart (smallest → biggest):
\tiny→\scriptsize→\footnotesize→\small→\normalsize→\large→\Large
→\LARGE→\huge→\Huge
Matlab (Matrix Laboratory)
If use ; at end --> does not print output Commands in terminal -> clc - clear console clear all - clears everything disp(...) ---> to display output Use % for comment Use elseif (without space in between) Use ~= for unequal to (just like != in c++)
- To take input with prompt (Prompt must be given)
n = input('Enter a number'); -> Prompt is "Enter a number" n = input('...', 's') -> for string input MUST give 's' as additional argument -> accepts string as input without requiring quotes- To create function -
function [sum, sub] = Sum(x,y) sum = x+y; sub = x-y; end ---> make function call as [a, b] = Sum(2,3)- File name must be same as function name (Sum)
Can use this function in any other file (except Function file) - square = @(x) x.^2; ---> inline fxn created without any separate file
B = arrayfun(func, A1) ---> apply func to each element of multiple arrays - Eg - A = [1 2 3]; B = [4 5 6];
C = arrayfun(@(x,y) x*y, A, B) ---> C = [4 10 18]
D = arrayfun(@(x) x^2, A) ---> D = [1 4 9] - A = [1 2 3; 4 5 6] ---> 2x3 matrix ---> to access => A(2, 3) [1-based indexing]
B = 0:2:20 ---> array from 0 to 20 in increments of 2
rand, zeros, ones, size, eye, linspace ---> same as python for matrices - Matrix multiplication --> use * => C = A*B
A.*B --> element-wise multiplication of A and B
Transpose ---> use ' => C = A'
Jupyter Notebook
- Runs locally + manually install any libraries + No free GPU + needs manual setup
- If type variable in last line → print it using display() [by default, present in Jupyter]
- renders dataframe and plots in visually more appealing format (better than print)
- When add new file → jupyter may not recognize it → better to restart whole thing
from google.colab import files -> files.upload() and files.download('file_path')- pip install pandas → runs directly within Python environment (like script/shell)
!pip install pandas → ! tells environment to run it as shell command
***********************************************************************************
Google Colab
- Cloud-based + pre-installed libraries + Free GPU/TPU + save notebooks to G-Drive
- Can switch to GPU/TPU from "change runtime type"
- GPU (Graphics Processing Unit) - speeds computing jobs for ML, scientific computing, and 3D visualization → better on smaller batches
- TPUs (Tensor Processing Unit) - accelerate operations on Tensorflow Graph
- optimized for large batch size + has highest training throughput
from google.colab import files -> files.upload() and files.download('file_path')
***********************************************************************************
Markdown
It is a way to write content for web (with .md or .markdown extension)Use * => 1 time - italic, 2 times - bold, 3 times - bold + italic For links use [text for link](link) but if don't want to change name => use <link> Extended markdown only valid in selected platforms Use ~ => 1 time for subscript like H₂O and 2 times for strikethrough can use <mark> to highlight </mark> <sup> for superscript like x² </sup> <sub> for subscript like H₂O </sub> For table at least 3 dash are must If press enter => hard break if use double space => soft break (like shift + enter in blog)


Comments
Post a Comment