instruction stringlengths 0 29.8k ⌀ |
|---|
Negotiating a connection between two devices that can't transmit and receive simultaneously |
|algorithms|communication-protocols| |
I've got a bit of a puzzle here that sits at the intersection of mathematics and technology. Hopefully this doesn't fall into brainteaser territory - I'm not sure a neat solution is possible!
I have two devices. Each one has a short token they would like to share. I am happy for either device to get the other's toke... |
null |
Basically hardware is reliable because it has to. It's not possible to fix a chip, and it's either impossible or not economical to fix a circuit board after it has left the factory. If a company sells buggy hardware, they can expect customers to ask for a refund.
In addition, hardware and especially chips have huge... |
null |
null |
Computer *hardware* almost always does exactly what software tells it to do.
It's useful to distinguish software bugs from unreliable hardware.
----
Cosmic rays can randomly flip a bit in memory, though; that's why servers often use [ECC (Error Correction Code) memory](https://en.wikipedia.org/wiki/ECC_memory... |
null |
Let **Q** be a symmetric transition probability matrix on states 1 , . . . , n; that is $q_{i,j} = q_{j,i}$ for all *i* , *j*.
Consider a markov chain defined as follows. Whenever the chain is in state *i*, the value of a random variable $X_i$ with probability mass function $P(X_i = j)= q_{i,j}$ is generated; if $X... |
Time reversible Markov chains question |
|matrices|markov-chains| |
LZ-type algorithms are useful for data for which context is predictive, like text consisting of lexemes and following some grammar. That is not so for the output of the BWT (nor of the MTF transform which is performed after BWT). |
Computer *hardware* almost always does exactly what software tells it to do.
It's useful to distinguish software bugs from unreliable hardware.
----
Cosmic rays can randomly flip a bit in memory, though; that's why servers often use [ECC (Error Correction Code) memory](https://en.wikipedia.org/wiki/ECC_memory... |
For this chain, the transition probabilities for $j \ne i$ are are
$$p_{ij}=q_{ij}\,\frac{b_j}{b_i+b_j}\,.$$
Thus $\pi_i=b_i/Z$ satisfy
$$\pi_i p_{ij}=\frac{b_ib_j}{Z(b_i+b_j)}=\pi_j p_{ji}\,,$$
which is the equation defining reversibility. |
If the digraph is not strongly connected, then the cover time is infinite, so let's assume the digraph is strongly connected. Here is an example:
Consider $n>2$ vertices $v_1,\ldots,v_n$, with a directed edge from $v_i$ to $v_{i+1}$ for $i=1,\ldots,n-1$ and a directed edge from $v_j$ to $v_1$ for $j=2,\ldots,n$.
Sta... |
Why do rely on computers in critical fields? |
If the digraph is not strongly connected, then the cover time is infinite, so let's assume the digraph is strongly connected. Here is an example:
Consider $n>2$ vertices $v_1,\ldots,v_n$, with a directed edge from $v_i$ to $v_{i+1}$ for $i=1,\ldots,n-1$ and a directed edge from $v_j$ to $v_1$ for $j=2,\ldots,n$.
Sta... |
null |
There is a list of 3-dimensional points $(x_1,y_1,z_1),\ldots,(x_m, y_m,z_m)$, where all coordinates are non-zero integers.
I would like to decide whether there exist positive real weights $w_x, w_y, w_z$ such that, for all $i$ in $1,\ldots,m$,
$$
(*) ~~~~~~~~~~~~~~ w_x x_i + w_y y_i + w_z z_i \geq 0.
$$
---... |
Can this algorithm for 2-dimensional points be generalized to 3 dimensions? |
|algorithms|computational-geometry| |
The alternative is to *not* rely on computers. While there are some instances where humans clearly outperform computers (looking at you, Tesla Autopilot), in the vast majority of cases where computers do something safety-critical, they also outperform humans by a significant margin (c.f., anti-lock brakes, traction con... |
Yes. This is an instance of linear programming, in 3 unknowns. Linear programming can be solved in [polynomial time](https://cstheory.stackexchange.com/a/16532/5038) when the dimension is fixed. |
Why do we rely on computers in critical fields? |
null |
null |
null |
It can be solved in time polynomial in the length of the input. This is an instance of linear programming, in 3 unknowns. Linear programming can be solved in [polynomial time](https://cstheory.stackexchange.com/a/16532/5038) when the dimension is fixed. This doesn't answer whether or not it can be solved in O(poly(m... |
null |
null |
null |
null |
Suppose I have the following code and I'd like to compute running time as function of $\ n$:
sum = 0
i = n
while i >= 1:
y = 1
while y < i:
y = y * 2
i = i-1
I think the y loop is running from $\ 1 $ to $\ \lceil \log_2(i) \rceil +1 $ and the outsider loop... |
Loops running time as function of n |
|algorithm-analysis|runtime-analysis| |
null |
Big hint based on Yuvals Hint: Consider the language $\{\langle S, f \rangle | S \text{ is a SAT formula and } f\text{ a satisfying assingment}\} \in P$ |
null |
null |
null |
If we add backspace to the output alphabet, are all the languages produced still context-free? (if not then what are they?)
the word (a, b, c, Backspace, Backspace) for example gets interpreted as a. |
what are the languages produced by Context free Grammars with backspace? |
|context-free|formal-grammars| |
null |
While I'm not sure about "closest" this sounds a lot like [arithmetic encoding](https://en.wikipedia.org/wiki/Arithmetic_coding) using a uniform distribution for the $n-i$ "characters" at position i (using 0-based indexing for the positions). To simplify the decoding one should encode the indexes and reorder the charac... |
null |
I think the inner loop executes $\lceil\log_2(i)\rceil$ times because it iterates as long as `y < i`. Hence you have $T(n) = \sum_{i=1}^n \lceil\log_2(i)\rceil$. Note that $ \lceil\log_2(i)\rceil \le \log_2(i) + 1$, therefore:
$T(n) = \sum_{i=1}^n \lceil\log_2(i)\rceil \le \sum_{i=1}^n \left( \log_2\left(i\right) +... |
The most straightforward approach for representing an algebraic expression is a parse tree. However, its big drawback is that it is difficult to reason about. That $xyz = zyx$ and $(xy)^2 = x^2y^2$ is not easy to infer using a normal parse tree. Instead, I suggest using this data structure:
$$
node \leftarrow sum |... |
The most straightforward approach for representing an algebraic expression is a parse tree. However, its big drawback is that it is difficult to reason about. That $xyz = zyx$ and $(xy)^2 = x^2y^2$ is not easy to infer using a normal parse tree. Instead, I suggest using this data structure:
$$
node \leftarrow sum |... |
By definition, a substitution in first-order logic consists in simultanously replacing variables for their mapped terms, whereas the composition is the result of applying the substitutions in the order they are given (https://en.wikipedia.org/wiki/Substitution_(logic)#First-order_logic).
Hence, when applying a compo... |
In fact Yuval's hint is all the solution you need: consider instance $I$ of any $\mathsf{NP}$-complete problem (e.g. 3SAT) and its proof $c$, let the proof appear in the second half of the constructed language $L$. Then if we can decide whether $I \in \operatorname{LP}(L)$ in poly time, this also means we can decide wh... |
In fact Yuval's hint is all the solution you need: consider instance $I$ of any $\mathsf{NP}$-complete problem (e.g. 3SAT) and its proof $c$, let the proof appear in the second half of the constructed language $L$. Then if we can decide whether $I \in \operatorname{LP}(L)$ in poly time, this also means we can decide wh... |
In fact Yuval's hint is all the solution you need: consider instance $I$ of any $\mathsf{NP}$-complete problem (e.g. 3SAT) and its proof $c$, let the proof appear in the second half of the constructed language $L$. Then if we can decide whether $I \in \operatorname{LP}(L)$ in poly time, this also means we can decide wh... |
Sure, the language of a finite alphabet matched with backspaces is a Dyck language (i.e. it's equivalent to balanced parenthetic expressions); it has the productions $L\to a_iL \text{<BKSP>}$ for every $a_i\in \Sigma$, as well as $L\to\epsilon$ and $L\to LL$.
So you can take any context-free grammar and transform it... |
Basically hardware is reliable because it has to. It's not possible to fix a chip, and it's either impossible or not economical to fix a circuit board after it has left the factory. If a company sells buggy hardware, they can expect customers to ask for a refund.
In addition, hardware and especially chips have huge... |
Because there's no practical alternative. Modern life is too complex for ordinary humans to keep track of all the details. And critical systems often require reaction times far quicker than humans or mechanical systems are capable of.
Consider a spacecraft. It likely has thousands of components that have to be monit... |
Because there's no practical alternative. Modern life is too complex for ordinary humans to keep track of all the details. And critical systems often require reaction times far quicker than humans or mechanical systems are capable of.
Consider a spacecraft. It likely has thousands of components that have to be monit... |
null |
Toposort also work as a visited array and prevent from getting into a cycle where every time your distance increase
0 ---> 2 ---> 0
Now, you are thinking why don't we use a visited array instead of toposort so you can't use a visited array because you don't know when your distance will increase but usi... |
Sure, the language of a finite alphabet matched with backspaces is a Dyck language (i.e. it's equivalent to balanced parenthetic expressions); it has the productions $L\to a_iL \text{<BKSP>}$ for every $a_i\in \Sigma$, as well as $L\to\epsilon$ and $L\to LL$.
So you can take any context-free grammar and transform it... |
Because there's no practical alternative. Modern life is too complex for ordinary humans to keep track of all the details. And critical systems often require reaction times far quicker than humans or mechanical systems are capable of.
Consider a spacecraft. It likely has thousands of components that have to be monit... |
The language of a finite alphabet matched with backspaces is a Dyck language (i.e. it's equivalent to balanced parenthetic expressions); one grammar for it has the productions $L\to a_iL \text{<BKSP>}$ for every $a_i\in \Sigma$, as well as $L\to\epsilon$ and $L\to LL$.
So you can take any context-free grammar and tr... |
If we add backspace to the output alphabet, are all the languages produced still context-free? (If not, then what are they?)
The word (a, b, c, Backspace, Backspace), for example, gets interpreted as a. |
What are the languages produced by context free-grammars with backspace? |
null |
null |
null |
Computers aren't the source of the failure. Programming isn't the source of the failure.
Algorithms thought of by humans are the source of the failures.
If we get a human to do steps to "login" or "provide receipts", they will **make as many, or more, errors than the program that replaces them**.
In fact, whe... |
> If computers really make many errors (as I assumed earlier)...
Your assumption is wrong. Firstly, computers do not (except in extreme cases) "make many errors", humans do. Computers simply do what they are told to, very quickly and very well. Extraordinarily well, all things considered.
Secondly, what you're pe... |
I have been wanting to learn more about how computers work. Getting way ahead of myself, but as in would it be possible to build a computer from scratch by myself? I mean build the individual parts and everything that goes into it. I understand that this question is more on the side of computer engineering but I though... |
Resources to learn about the fundamentals of computers? |
|computer-architecture| |
null |
> If computers really make many errors (as I assumed earlier)...
Your assumption is wrong. Firstly, computers do not (except in extreme cases) "make many errors", humans do. Computers simply do what they are told to, very quickly and very well. Extraordinarily well, all things considered.
Secondly, what you're pe... |
null |
null |
{"OriginalQuestionIds":[126818],"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
null |
null |
An exact solution is possible.
Assuming that $n=2^m$, an exact power of $2$, the number of executions of the inner loop equals
$$0+1+2+2+3+3+3+3+\cdots \underbrace{m+m+\cdots m}_{2^{m-1}}$$
or
$$T:=\sum_{i=0}^mi\,2^{i-1}.$$
Now
$$2T:=2\sum_{i=0}^mi\,2^{i-1}=2\sum_{i=1}^{m+1}(i-1)2^{i-2}=\sum_{i=1}^{m+1... |
The short answer is that we _don't_ rely on them being error-free to any greater degree than we rely on anything else in a critical system to be error-free. Just as an individual computer hardware component can fail (and _will_ fail in certain circumstances), any other non-computer component (mechanical, human or other... |
You get the wrong impression if you look at stack overflow for questions how to fix bugs. These bugs are 99% of the time not in shipping software! If an inexperienced developer creates a bug, either they detect immediately that their software doesn't work and fix it, or some more experienced developer checks it and it ... |
I can assure you that safety-critical software is produced in a way which ensures a high level of "software integrity".
- The vast majority of commonly encountered programming errors are **not made** at all because the safety rules demand specifically educated and certified personnel, demand using best practices, obs... |
I can assure you that safety-critical software is produced in a way which ensures a high level of "software integrity".
- The vast majority of commonly encountered programming errors are **not made** at all because the safety rules demand specifically educated and certified personnel, demand using best practices, obs... |
null |
Think of all the possible combinations you can make which are not aba:
* Whenever we get "ab" we must either end the string or add a "b" by force: **a<sup>+</sup>bb**
* If we are starting from **b** then we can append as many a's as we want at the end: **b<sup>+</sup>(null + a<sup>+</sup>)**
* Joining both tog... |
Think of all the possible combinations you can make which are not aba:
* Whenever we get "ab" we must either end the string or add a "b" by force: **a<sup>+</sup>b(null + b)**
* If we are starting from **b** then we can append as many a's as we want at the end: **b<sup>+</sup>(null + a<sup>+</sup>)**
* Joining... |
Think of all the possible combinations you can make which are not aba:
* Whenever we get "ab" we must either end the string or add a "b" by force: **a<sup>+</sup>(b + bb)**
* If we are starting from **b** then we can append as many a's as we want at the end: **b<sup>+</sup>a<sup>*</sup>**
* Joining both togeth... |
Think of all the possible combinations you can make which are not aba:
* Whenever we get "ab" we must either end the string or add a "b" by force: **a<sup>+</sup>bb**
* If we are starting from **b** then we can append as many a's as we want at the end: **b<sup>+</sup>a<sup>*</sup>**
* Joining both together: **... |
It will depend on the algorithm. Some algorithms can be split between processors, some can't. For example to find the maximum of N numbers, you can split into m groups, find the maximum of each group in O (N / m) assuming m cores, and the result is the maximum in your m numbers, taking another O (m) for a total of O (N... |
null |
Suppose we have a 6 vertices graph. We also have 6 gates. Each gate is attributed a path.
For example,
Gate 'A' will have to go to 'B'- 'C' - 'D' and 'E'
Gate 'B' will have to go to 'D'
Gate 'C' will have to go to 'A' and 'B'
Gate 'D' will have to go to 'E' - 'A' and 'B'
Gate 'E' will have to go to '... |
Graph algorithm regarding optimal distribution |
|algorithms|graphs| |
An exact solution is possible.
Assuming that $n=2^m$, an exact power of $2$, the number of executions of the inner loop equals
$$0+1+2+2+3+3+3+3+\cdots \underbrace{m+m+\cdots m}_{2^{m-1}}$$
or
$$T:=\sum_{i=0}^mi\,2^{i-1}.$$
Now
$$2T:=2\sum_{i=0}^mi\,2^{i-1}=2\sum_{i=1}^{m+1}(i-1)2^{i-2}=\sum_{i=1}^{m+1... |
An exact solution is possible.
Assuming that $n=2^m$, an exact power of $2$, the number of executions of the inner loop equals
$$0+1+2+2+3+3+3+3+\cdots \underbrace{m+m+\cdots m}_{2^{m-1}}$$
or
$$T:=\sum_{i=0}^mi\,2^{i-1}.$$
Now
$$2T:=2\sum_{i=0}^mi\,2^{i-1}=2\sum_{i=1}^{m+1}(i-1)2^{i-2}=\sum_{i=1}^{m+1... |
Think of all the possible combinations you can make which are not aba:
* Whenever we get "ab" we must either end the string or add a "b" by force: **a<sup>+</sup>bb**
* If we are starting from **b** then we can append as many a's as we want at the end: **b<sup>+</sup>a<sup>*</sup>bb**
* Joining both together: ... |
null |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.