Paragraphs in Markdown are just one or more lines of consecutive text followed by one or more blank lines.
You can create a heading by adding one or more # symbols before your heading text. The number of # you use will determine the size of the heading.
1 2 3 4
# The largest heading (an <h1> tag) ## The second largest heading (an <h2> tag) … ###### The 6th largest heading (an <h6> tag)
Block-quotes
You can indicate block-quotes with a >
1 2 3
In the words of Abraham Lincoln:
> Pardon my French
Styling text
1 2
*This text will be italic* **This text will be bold**
Both bold and italic can use either a * or an _ around the text for styling. This allows you to combine both bold and italic if needed.
1
**Everyone _must_ attend the meeting at 5 o'clock today.**
Lists
Unordered lists
You can make an unordered list by preceding list items with either a * or a -.
1 2 3 4 5
* Item * Item
- Item - Item
Ordered lists
You can make an ordered list by preceding list items with a number.
1 2
1. Item 1 2. Item 2
Nested lists
You can create nested lists by indenting list items by two spaces.
1 2 3 4 5
1. Item 1 1. A corollary to the above item. 2. Item 2 * A corollary that does not need to be ordered. * This is indented four spaces.
Code syntax highlighting
In-line formats
Use single back-ticks (`) to format text in a special mono-space format. Everything within the back-ticks appear as-is, with no other special formatting.
1
Here's an idea: why don't we take `SuperiorProject` and turn it into `**Reasonable**Project`.
Multiple lines
You can use triple back-ticks (```) to format text as its own distinct block.
1 2 3 4
``` x = 0 x = 2 + 2 ```
Syntax highlighting
In fenced block, add an optional language identifier for syntax highlighting. For example, to syntax highlight Ruby code:
You can create an in-line link by wrapping link text in brackets ( [ ] ), and then wrapping the link in parentheses ( ( ) ).
For example, to create a hyper-link to www.github.com, with a link text that says, Visit GitHub!, you’d write this in Markdown: [Visit GitHub!](https://www.github.com).
Image
In-line image:
1
![Alt Msg](URL)
Block image:
1
![Alt Msg][URL]
GitHub Flavored Markdown
underscores in words
Where Markdown transforms underscores (_) into italics, GFM ignores underscores in words. To emphasize a portion of a word, use asterisks (*).
URL auto-linking
GFM will auto-link standard URLs, so if you want to link to a URL (instead of setting link text), you can simply enter the URL and it will be turned into a link to that URL.
GFM adds syntax to create strike-through text, which is missing from standard Markdown.
1
~~Mistaken text.~~
becomes: Mistaken text.
Tables
You can create tables by assembling a list of words and dividing them with hyphens - (for the first row), and then separating each column with a pipe |:
1 2 3 4
First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell
| Name | Description | | ------------- | ----------- | | Help | Display the help window.| | Close | Closes a window |
Finally, by including colons : within the header row, you can define text to be left-aligned, right-aligned, or center-aligned:
1 2 3 4 5
| Left-Aligned | Center Aligned | Right Aligned | | :------------ |:---------------:| -----:| | col 3 is | some wordy text | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 |
A colon on the left-most side indicates a left-aligned column; a colon on the right-most side indicates a right-aligned column; a colon on both sides indicates a center-aligned column.
A matrix has 3 rows and 2 columns, so it is a 3x2 matrix.
refers to the element in the th row and th column of matrix A
refers to the element in the th row of the vector.
In general, all our vectors and matrices will be 1-indexed.
Matrices are usually denoted by uppercase names while vectors are lowercase.
“Scalar” means that an object is a single value, not a vector or matrix.
refers to the set of scalar real numbers.
refers to the set of n-dimensioned vectors of real numbers
Addition
Matrix dimensions must agree Plussing is just add each coordinate numbers together.(Minus as well)
Multiplication
Matrix * number
Plussing is just add each coordinate numbers together.(Minus as well)
Matrix * vector
$ ([mn][n1] = [m1]) $
Matrix * matrix
Warnings
Two properties of matrix multiple:
Not commutative.
Associative.
Inverse & transpose
Inverse
The inverse of a matrix is denoted . Multiplying by the inverse results in the identity matrix. A non square matrix does not have an inverse matrix. We can compute inverses of matrices in octave with the pinv(A) function.
for x= [initVal:step:endVal or valArray] % body end
Basic Calculation
Inequity Note, not “!=”
1 ~= 2 % true
Variable assignment:
a = 3; % semicolon suppresses output
Displaying them:
1 2 3 4 5 6 7 8
a = pi disp(a) disp(sprintf('2 decimals: %0.2f', a)) disp(sprintf('6 decimals: %0.6f', a)) format long a format short a
Matrix Calculation
1. To create a matrix:
1 2 3 4 5
A = [12; 34; 56]
B = [12; 34; 56]
Or using a built-in function
1 2 3 4 5
ones(row, col) % same as C = [2 2 2; 2 2 2] zeros(row, col) rand(row, col) % from a uniform distribution (range [0, 1]) randn(row, col) % from a normal distribution (mean=0, var=1) eye(row) % 4x4 identity matrix
2. Get informations from matrix
1 2 3 4
size(M) % return a 1x2 matrix: [(number of rows) (number of columns)] size(M,1) % number of rows size(M,2) % number of cols length(M) % size of longest dimension
3. Manipulating matrix
1 2 3 4 5 6 7 8 9 10 11 12 13
%% indexing A(3,2) % indexing is (row,col) A(2,:) % ":" means every element along that dimension A([13],:) % print all the elements of rows 1 and 3
A(:,2) = [10; 11; 12] % change second column A = [A, [100; 101; 102]]; % append column vec A(:) % Select all elements as a column vector.
% Putting data together % (A & B are matrics posessing same dims) C = [A B] or [A,B] % concatenating A and B matrices side by side C = [A; B] % Concatenating A and B top and bottom
Plotting
1 2 3
w = -6 + sqrt(10)*(randn(1,10000)) % (mean = -6, var = 10) hist(w) % plot histogram using 10 bins (default) hist(w,50) % plot histogram using 50 bins