Graph - DiGraph
1. Concepts
Definition. A directed graph
or digraph
is a set of nodes and a
collection of directed edges
. Each directed edge connects an ordered
pair of nodes.
Definition. A directed path
is a path in a digraph is a sequence of nodes in which there is a directed edge pointing from each node in the sequence to its successor in the sequence. A directed cycle
is a directed path with at least one edge whose first and last nodes are the same. A simple cycle
is a cycle with no repeated edges or nodes. The length
of a path is its number of edges.
With above, we can define that a node a is reachable from node b if there is a directed path from a to b.
2. Data Structure
Graph Algorithms - Search
When working with graph, search is an important topic. For example, search for connectivity, search for shortest path. There are two basic strategies to do search in graph: Depth-first(DFS) and Breadth-first(BFS). Note that in this blog, all the discussions are based on undirected graph. But the strategy can be used to all kind of graphs given they share similar data structures.
What kind of problems we are solving?
The basic idea of search in general is to walk through the data structure and collection information we need. In terms of Graph, only two elements matters: nodes (vertices) and edges. Walking through a graph, really means iterating the nodes in a way.
Data Structure
The next questions to ask is that how can I solve a question by looping through the least nodes? Well to answer this question, we need to decide a data structure to represent graph.
Graph basics - 1 Concepts
Graph is a mathematical object to model pairwise connections between objects. There are a lot of applications:
Systematic Trading
为Hexo拓展功能
Z-backtest
Intro
Why? bother to create another backtest framework, if we already have plenty of them?
- I can not find even one backtest framework to backtest option (or deriveritive) based strategy properly. (Mix of option and delta one product is a Bigger NO!)
- Debug/Reconcile backtest is painful, because of bad state management
- Logic components are hard to re-use
- And thanks to point 3, strategy code to strategy logic is not easy
- Not easy to do strategy of strategies
How? to solve above problems?
- Use unified interface for derivertive and delta-one Node (And Event a Strategy!)
- Use explicit state management, things like Redux
- Use Algo stacks to express logics
- Thanks to point 3, this is solved
- Use Tree structure to describe strategy (Check point 1)
Audio Signal Processing for Music Applications
Audio Signal Processing for Music Applications
Perhaps most importantly, from the point of view of computer music research, is that the human ear is a kind of spectrum analyzer. That is, the cochlea of the inner ear physically splits sound into its (quasi) sinusoidal components. This is accomplished by the basilar membrane in the inner ear: a sound wave injected at the oval window (which is connected via the bones of the middle ear to the ear drum), travels along the basilar membrane inside the coiled cochlea. The membrane starts out thick and stiff, and gradually becomes thinner and more compliant toward its apex (the helicotrema). A stiff membrane has a high resonance frequency while a thin, compliant membrane has a low resonance frequency (assuming comparable mass per unit length, or at least less of a difference in mass than in compliance). Thus, as the sound wave travels, each frequency in the sound resonates at a particular place along the basilar membrane. The highest audible frequencies resonate right at the entrance, while the lowest frequencies travel the farthest and resonate near the helicotrema. The membrane resonance effectively
shorts out'' the signal energy at the resonant frequency, and it travels no further. Along the basilar membrane there are hair cells which
feel’’ the resonant vibration and transmit an increased firing rate along the auditory nerve to the brain. Thus, the ear is very literally a Fourier analyzer for sound, albeit nonlinear and using ``analysis’’ parameters that are difficult to match exactly. Nevertheless, by looking at spectra (which display the amount of each sinusoidal frequency present in a sound), we are looking at a representation much more like what the brain receives when we hear.
配和弦的方法
配和弦的基本规则
- 选择含有旋律音的调内和弦
- 多种选择的时候,考虑上下文以及和弦功能
- 下一个和弦用什么?增加一些变化
- 功能和弦:比如G7是属和弦,会制造紧张,回归C
- 其他附属和弦,比如Dm,F等等
- 多久换一个和弦?
- 递归上面的过程
和弦有什么功能
分类1:
- 主和弦,Tonic,I
- 属和弦,dominant, V。G7,三全音产生更加不稳定的感觉
- 下属和弦,桥梁,去G 或者 G7
- 附属和弦,你要接的下一个和弦的上面5度音的属7和弦,比如下一个是Em,可以用B7过度到他
分类2:
- 家:C, I
- 外面:G7,Bdim. V,vii
- 桥:Dm,F,他们很喜欢去外面。ii, iv
- 暂时的家,或者家的延伸:Em,Am. iii, vi