A journey of a software engineer and computer science enthusiast
Search This Blog
Math fundamentals and Katex
It was really tough for me to understand many articles about data science due to the requirements of understanding mathematics (especially linear algebra). I’ve started to gain some basic knowledges about Math by reading a book first.
The great tool Typora and stackedit with supporting Katex syntax simply helps me to display Math-related symbols.
Let’s start!
The fundamental ideas of mathematics: “doing math” with numbers and functions. Linear algebra: “doing math” with vectors and linear transformations.
1. Solving equations
Solving equations means finding the value of the unknown in the equation. To find the solution, we must break the problem down into simpler steps. E.g:
x2−4x2−4+4x2x∣x∣x=7=45=45+4=49=49=7 or x=−7
2. Numbers
Definitions
Mathematicians like to classify the different kinds of number-like objects into sets:
The natural numbers: N = {0,1,2,3,4,5,6,7, … }
The integer: Z = { … , −3,−2,−1,0,1,2,3, … }
The rational numbers: Q = {35, 722, 1.5,0.125,−7, … }
The real numbers: R = {−1,0,1,2,e,π,4.94..., … }
The complex numbers: C = {−1,0,1,i,1+i,2+3i, … }
Operations on numbers
Addition is commutative and associative. That means: a+b=b+a a+b+c=(a+b)+c=a+(b+c)
Subtraction is the inverse operation of addition.
Multiplication is also commutative and associative. ab=b timesa+a+a+...+a=a timesb+b+b+...+b ab=ba abc=(ab)c=a(bc)
Division is the inverse operation of multiplication. You cannot divide by 0.
Exponentiation is multiplying a number by itself many times. ab=b timesaaa...a a−b=ab1 na≡an1
The symbol “≡” stands for “is equivalent to” and is used when two mathematical object are identical.
3. Variables
Variables are placeholder names for any number or unknown. Variable substitution: we can often change variables and replace one unknown variable with another to simplify an equation. For example:
5−x6=xu=x5−u6=u
4. Functions and their inverses
The inverse functionf−1 performs the opposite action of the function f so together the two functions cancel each other out. For example:
f(x)=c
f−1(f(x))=x=f−1(c)
x=f−1(c)
Common functions and their inverses: functionf(x)x+22xx22x3x+5axexp(x)≡exsin(x)cos(x)⇔inversef−1(x)⇔x−2⇔21x⇔±x⇔log2(x)⇔31(x−5)⇔loga(x)⇔ln(x)≡loge(x)⇔sin−1(x)≡arcsin(x)⇔cos−1(x)≡arccos(x)
The principle of “digging” (Bruce Lee-style) toward the unknown by applying inverse functions is the key for solving all these types of equations, so be sure to practice using it.
5. Basic rules of algebra
Given any three numbers a, b, and c we can apply the following algebraic properties:
Associative property: a+b+c=(a+b)+c=a+(b+c) and abc=(ab)c=a(bc)
Commutative property: a+b=b+a and ab=ba
Distributive property: a(b+c) = ab+ac
Some algebraic tricks are useful when solving equations
Expanding brackets: (x+3)(x+2)=x2+5x+6
Factoring: 2x2y+2x+4x=2x(xy+1+2)=2x(xy+3)
Quadratic factoring: x2−5x+6=(x−2)(x−3)
Completing the square: Ax2+Bx+C=A(x−h)2+k e.g: x2+4x+1=(x+2)2−3
6. Solving quadratic equations
The solutions to the equation ax2+bx+c=0 are x1=2a−b+b2−4acandx2=2a−b−b2−4ac
Actually, we can use the technique completing the square to explain this formula.
7. The Cartesian plane
Vectors and points
Point: P=(Px,Py). To find this point, start from the origin and move a distance Px on the x-axis, then move a distance Py on the y-axis.
Vector: v=(vx,vy). Unlike points, we don’t necessarily start from the plane’s origin when mapping vectors.
Graphs of functions
The Cartesian plane is great for visualizing functions, f:R→R
A function as a set of input-output pairs (x,y)=(x,f(x))
8. Functions
We use functions to describe the relationship between variables.
To “know” a function, you must be able to understand and connect several of its aspects including definition, graph, values and relations.
Definition: f:A→B. Function is a mapping from numbers to numbers.
Function composition: fog(x)≡f(g(x))=z
Inverse function: f−1(f(x))≡f−1of(x)=x
Table of values: {(x1,f(x1)),(x2,f(x2)),...}
Function graph: using the Cartesian plane
Relations: e.g: sin2x+cos2x=1
9. Function references
- Line
The equation of a line: f(x)=mx+b and f−1(x)=m1(x−b)
The general equation: Ax+By=C
I searched from somewhere and found that a lot of people says a basic concept for implementing this feature looks like below: HTML code: <div id="parent"> <div id="child"> </div> </div> And, CSS: #parent{ position: relative; overflow:hidden; } #child{ position: absolute; top: -1; right: -1px; } However, I had a lot of grand-parents in my case and the above code didn't work. Therefore, I needed an alternative. I presumed that my app uses Boostrap and AngularJs, maybe some CSS from them affects mine. I didn't know exactly the problem, but I believed when all CSS is loaded into my browser, I could completely handle it. www.tom-collinson.com I tried to create an example to investigated this problem by Fiddle . Accidentally, I just changed: position: parent; to position: static; for one of parents -> the problem is solved. Look at my code: <div class="modal-body dn-placeholder-parent-position&quo
I was using Meteor for my messenger project. I was so curious about the real time connection. I wanted to know how exactly this mechanism works. In this post, I will go through the DDP Specification, an overview of WebSocket, and a simple demo about how to subscribe a publication of Rocket.Chat (containing a DDP server) from an external webpage. At a glance, I knew that Meteor invented a protocol called DDP which uses for handling real time connection. So then, what is DDP? "DDP (Distributed Data Protocol) is the stateful WebSocket protocol that Meteor uses to communicate between the client and the server." [1] All right! Why does DDP matter? "DDP is a standard way to solve the biggest problem facing client-side JavaScript developers: querying a server-side database, sending the results down to the client, and then pushing changes to the client whenever anything changes in the database" . [2] In order to understand deeply the protocol, I decided
Motivator It's important for a team to have an agreement on how the changes of source code should be applied. According to projects and teams size, we will define a workflow or select one from recommended workflows ; the "Feature Branch Workflow" is a candidate. What is it? - One branch "master" for main codebase - Several separated branches for features development Why should we care? - Be super simple and allow each developer works on a particular feature. - A stable codebase (master) benefits for continuous integration (CI) environment - Leverage "Pull request" for Code review How it works? A lifecyle of a feature branch (usually created by a story) 1. Creator creates a new branch from a story. For example: "ABC-1-setup-projects" 2. Creator checkouts the created branch and works on the branch (commits, pushes) 3. Creator has done the feature, he uses "pull request" to merge his branch into branch "master
Pascal is my first programing language when I have studied in high school. It was really exciting for me. :) The Pascal programming language was created by Niklaus Wirth in 1970. It was named after Blaise Pascal, a famous French Mathematician. It was made as a language to teach programming and to be reliable and efficient. Pascal has since become more than just an academic language and is now used commercially . I tried to make a simple music program by using Lazarus IDE on MS Window 7, 64-bit. It frustrated me a few times how difficulty to use Sound command to make a sound. Sound did not work on my compiler and my platform anymore. So far, I just could use beep(freq, duration) from window unit to implement my work. Here is my code. ;) program mysong; uses Windows, crt; const C: Integer = 512; { x = A * EXP(LN(2)/12)} C_: Integer = 542; D: Integer = 574; D_: Integer = 608; E: Integer = 644; F: Integer = 682; F_: Integer = 723; G: Integer = 766; G_
Comments
Post a Comment