instruction
stringlengths
0
29.8k
⌀
To the other answers' references for mathematical notation and symbols, I would like to add a reference for mathematical use of English words. The book, [A Handbook of Mathematical Discourse](https://www.maa.org/press/maa-reviews/a-handbook-of-mathematical-discourse) is a dictionary of words and phrases used in semi...
You won't find all of your requirements in one place. As to: > it would be also at times a "style manual" for different nuances > in how to present mathematical writing. Check out: ***Mathematical Writing***, Issue 14 of MAA notes, *Donald Ervin Knuth, Tracy Larrabee, Paul M. Roberts* Publisher Mathemati...
null
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
What is good algorithm to decode morse code strings?
|algorithms|
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
**Is it possible to create a some programming language tool that will perform the composition of primitive functions so that the output code can be the minimum possible number and cost of operations?** In fact, the maximum possible optimization in the context of function composition. In this case, primitive mea...
Programming language tool that will perform the composition of primitive functions with optimization
|programming-languages|program-optimization|
IIUC, category theory only applies to immutable objects, and mutability is modelled within that using e.g. functors, monads. Is that true? If so, why doesn't category theory include immutability? Has no-one got round to adding that, or is it impossible?
Does category theory only deal with immutable objects? If so, why?
|functional-programming|category-theory|
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
``` moorse_string[] = {".-", // 0 = A ('A' = ASCII code 65; 'a' = ASCII code 97) "-...", // 1 = B "-.-.", // 2 = C "-..", // 3 = D ".", // 4 = E "..-.", // 5 = F ...
What you suggest is already a good method. It is what I would recommend. It is simple and easy to implement. That is a good thing. Generally, those qualities mean that it takes less time for the programmer, and is less likely to have subtle bugs. Normally, as first starting point, we want to optimize for reducing ...
**Is it possible to create a some programming language compiler that will perform the composition of primitive functions with optimization?** In fact, the maximum possible optimization in the context of function composition. In this case, primitive means that the code consists only of while, if, break, continue...
Programming language compiler that will perform the composition of primitive functions with optimization
|programming-languages|compilers|program-optimization|
**Is it possible to create a some programming language compiler that will perform the composition of primitive functions with optimization?** In fact, the maximum possible optimization in the context of function composition. In this case, primitive means that the code consists only of while, if, break, continue...
**Is it possible to create a some programming language compiler that will perform the composition of primitive functions with optimization?** In fact, the maximum possible optimization in the context of function composition. In this case, primitive means that the code consists only of while, if, break, continue...
**Is it possible to create a some programming language compiler that will perform the composition of primitive functions with optimization?** In fact, the maximum possible optimization in the context of function composition. In this case, primitive means that the code consists only of while, if, break, continue...
I'm working on this task: > Prove that the following problem can be solved in time $2^{k} \cdot \Vert \varphi \Vert^{\mathcal{O}(1)}$: given a boolean formula $\Vert \varphi \Vert$ in CNF, decide whether there exists an assignment that satisfies at most $k$ clauses of $\varphi$. but with very little success so fa...
CNF – satisfy at most a fixed number of clauses
|algorithms|np-hard|satisfiability|parameterized-complexity|
I'm working on this task: > Prove that the following problem can be solved in time $2^{k} \cdot \Vert \varphi \Vert^{\mathcal{O}(1)}$: given a boolean formula $\Vert \varphi \Vert$ in CNF, decide whether there exists an assignment that satisfies at most $k$ clauses of $\varphi$. but with very little success so fa...
I'm working on this task: > Prove that the following problem can be solved in time $2^{k} \cdot \Vert \varphi \Vert^{\mathcal{O}(1)}$: given a boolean formula $\Vert \varphi \Vert$ in CNF, decide whether there exists an assignment that satisfies at most $k$ clauses of $\varphi$. but with very little success so fa...
It is not true. The [state monad](https://wiki.haskell.org/State_Monad) expresses mutable state that can be used in a computation.
I'm trying to come up with a context free grammar for the following language: ${0^i1^j0^k1^l0^m | i, j, k, l, m ≤ 0, i ≤ k, or j = m (or both)}$ I'm able to come up with rules for the i ≤ k case and I think the j = m case but the both case is killing me
context free grammar for ${0^i1^j0^k1^l0^m | i, j, k, l, m ≤ 0, i ≤ k or j = m (or both)}$
|context-free|formal-grammars|
I'm trying to come up with a context free grammar for the following language: $${\{0^i1^j0^k1^l0^m | i, j, k, l, m \ge 0, i \le k \text{ or } j = m \text{ (or both)}\}}$$ I'm able to come up with rules for the $i ≤ k$ case and I think the $j = m$ case but the both case is killing me.
context free grammar for ${\{0^i1^j0^k1^l0^m \mid i, j, k, l, m \ge 0, i \le k\text{ or }j = m\text{ (or both)}\}}$
What you suggest is already a good method. It is what I would recommend. It is simple and easy to implement. That is a good thing. Generally, those qualities mean that it takes less time for the programmer to implement, and is less likely to have subtle bugs. Normally, as a first starting point, we want to optimiz...
This is a very broad topic. You are basically asking about [program optimization](https://en.wikipedia.org/wiki/Program_optimization), which is an entire subfield/topic area within compilers. There are dozens of books and research conferences dedicated to the subject. It is a hard problem. Most solutions are focuse...
null
You could build a tree where each terminal node has a name and two children ("Dot" and "Dash"). For `--.`, you'd: - Look at the Dash child of the tree's root node. - Go to its Dash child. - Then go to that node's Dot child. - Then take the name of the node "G". For `--.-`, you'd do the same thing, but i...
An approach that is fast and seems to work well for me, and does not involve any fancy stuff, is to use the correlation of pixels over time as an indicator of motion: 0. Make your video greyscale (lets call it `video` $\in \mathbb R^{T\times H\times W}$) 1. Spatially Highpass filter video to make `video_shp` 2. ...
I recently had the idea that it would be neat if it were possible to make a SAT solver play combinatorial games. To start, I'm trying a relatively simple case of solving single-stack Misère Nim through integer programming: there's a fixed limit $L$ with a set of moves $N$, where a move is added to the state each turn. ...
Possible to solve a combinatorial game with integer programming?
|satisfiability|integer-programming|game-theory|optimal-strategy|
I believe you can't, for many/most combinatorial games. In particular, I believe optimal play for two-player combinatorial games is often a PSPACE-complete problem (sometimes a EXP-complete problem), while a SAT solver can only express NP problems (and a polynomial-time algorithm equipped with ability to call a SAT so...
It suffices to describe how to evaluate $P(\omega^u,\omega^v)$ at the roots of unity. Suppose $P(X,Y)=\sum_{i,j} a_{i,j} X^i Y^j$. Let $$F_{b,c}(X,Y) = \sum_{i,j} a_{2i+b,2j+c} X^i Y^j$$ where the sum is over all $i,j$ with $i\le n/2, j \le n/2$. Then $$P(X,Y) = F_{0,0}(X^2, Y^2) + Y F_{0,1}(X^2, Y^2) + X F...
Every context-sensitive language can be expressed using an essentially non-contracting grammar. With just one non-terminal symbol, we can't express all context-sensitive languages. I was wondering if there is a $k$, such as all context-sensitive languages can be expressed.
minimum number of non-terminals so that for all context-sensitive languages there is a non-contracting grammar
|formal-languages|formal-grammars|context-sensitive|
I'm currently learning about Data Structures and Abstractions and one particular problem has been very confusing to me, and that is the concept of Circular ArrayDeque. In particular, how can we add or remove elements at the first and last of a circular Arraydeque? I've learnt a few things so far and listed them...
Can anyone explain how a circular buffer array works?
|java|
Every context-sensitive language $\subseteq \{a,b\}^*$ can be expressed using an essentially non-contracting grammar. With just one non-terminal symbol, we can't express all context-sensitive languages. I was wondering if there is a $k$, such as all context-sensitive languages can be expressed. I would also be i...
I have an async process that receives a message then post the content to another service and acknowledges the message. To improve on the efficiency I want to batch the messages together, but can't request more than 1 message at a time from the external service. Therefore I want to create a buffer in code to batch u...
Name for a synchronous process that can buffer async tasks and then release
|terminology|
You could build a tree where each node has a name and two children ("Dot" and "Dash"). For `--.`, you'd: - Look at the Dash child of the tree's root node. - Go to its Dash child. - Then go to that node's Dot child. - Then take the name of the node "G". For `--.-`, you'd do the same thing, but instead of...
|data-structures|queues|
null
Define the following function to be the count of integers not greater than $L$ that are coprime to $n$:$$C(n,L)=\sum_{k=1 \atop {GCD(n,k)=1}}^L1$$ Then I am interested in the following sum: $$S(x)=\sum_{d=1}^xd\cdot C(d,\Big\lfloor\frac xd \Big\rfloor)$$ $C$ can be calculated relatively fast given the prime fact...
Sum of coprime divisors
|algorithms|time-complexity|optimization|combinatorics|discrete-mathematics|
With dependent types, types can be statements that are true or false and constructing a value with that type constitutes a proof of that statement. This proof/value construction is itself a program that can be run (which I think encapsulates the Curry-Howard Equivalence idea), but often these programs are not very "use...
What are some examples of proofs that are also themselves "useful" programs?
|dependent-types|curry-howard|
null
I'm scheduling a large invitational tournament with the following conditions 1. The event takes place over 8 weeks 2. Teams arrive and depart on different dates/times, so each day of the event will have a different number of teams available to play 3. Teams will play only once per day 4. Teams have specific c...
Algorithm/heuristic for large tournament matchup pairings
|algorithms|scheduling|heuristics|
Regular expressions are a powerful practical tool for string processing. But there are simple examples of useful string processing tasks (like, say, removing brackets from an expression `(E) -> E` when `E` might itself contain brackets) which cannot be represented by a convenient regular expression. Is there a langu...
Regular expressions cannot be used to express context free grammars. Is there a similar notation that can?
|context-free|regular-expressions|
null
Most domain-specific languages for context-free grammars are some variant of [Backus-Naur form](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form) (BNF). A number of popular programming languages have BNF modules, like python's `pyparsing` module. They are also a first-class entity in the Raku programming language...
null
so I know that this language is not regular, however, can you still define the language using BNF? This is the problem: {a^n b^n |n>0}
How to use BNF for {a^n b^n | n>0}
|regular-languages|
A systematic approach is to start with Brute Force and then Keep thinking what is unnecessary or repeated, try to eliminate those steps... many times it's not so obvious and which is why it is considered a difficult process unless you have solved like hundreds of algorithmic problems ... which is when you clearly see w...
This is a classic example of a context-free language. See https://cs.stackexchange.com/q/18524/755 for how to find the corresponding context-free grammar. Then once you have a context-free grammar, you can write it down in [BNF](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form).
Define the following function to be the count of integers not greater than $L$ that are coprime to $n$:$$C(n,L)=\sum_{k=1 \atop {GCD(n,k)=1}}^L1$$ Then I am interested in the following sum: $$S(x)=\sum_{d=1}^xd\cdot C(d,\Big\lfloor\frac xd \Big\rfloor)$$ $C$ can be calculated relatively fast given the prime fact...
null
A good approach is to use integer linear programming (ILP). This is basically an operations research problem, and ILP is a powerful tool for problems like this. You can introduce zero-or-one integer variables $x_{i,j,d}$, with the intended meaning that $x_{i,j,d}=1$ means that teams $i,j$ play each other on day $d$...
Every context-sensitive language $\subseteq \Sigma^* = \{a,b\}^*$ can be expressed using an essentially non-contracting grammar. With just one non-terminal symbol, we can't express all context-sensitive languages. I was wondering if there is a minimum $k$, such as all context-sensitive languages can be expressed as...
Every context-sensitive language $\subseteq \Sigma^* = \{a,b\}^*$ can be expressed using an essentially non-contracting grammar. With just one non-terminal symbol, we can't express all context-sensitive languages. Does there exist a minimum $k$, such that all context-sensitive languages can be expressed as a non-co...
null
null
null
Following this latest and very exciting research object I can't find till now a usable computer. By computer I understand a definitive switchable Hardware. I would like to call actual "quantum computing" by the topic **"researching of quantum elements for computing"**. Till now I found only expensive and complex qua...
null
null
So I recently came across a question in my Algorithms class. Given a binary matrix of **N X N**. we can do following operation any number of times to cover all 1's of matrix we can take a square of size M X M (1 <= M <= N) and convert all 1's to 0's in this submatrix this operation costs M coins we ha...
Binary Matrix covered with squares to cover all 1's in min cost
|np-complete|dynamic-programming|matrices|
So I recently came across a question in my Algorithms class. Given a binary matrix of **N X N**. we can do following operation any number of times we can take a square of size M X M (1 <= M <= N) and convert all 1's to 0's in this submatrix this operation costs M coins we have to convert all 1's to 0'...
To deal with the issue cogently requires first some background. These issues can be dealt with, entirely, within an algebraic framework. Algebraically, a grammar is a system of fixed-point inequations over a certain type of partially ordered algebra, with the item represented by the grammar given in terms of the least ...
null
IIUC, category theory only applies to immutable objects, and mutability is modelled within that using e.g. functors, monads. Is that true? If so, why doesn't category theory include immutability? Has no-one got round to adding that, or is it impossible? I'm asking because I've never seen category theory applied to, ...
I am struggling to find a good loop invariant for the following function, which returns a^b where a is a real number and b is a natural number: power <- function(a, b){ c <- 1 while(b > 0){ if(y %% 2 == 1){ c <- c * a } b <- flo...
Struggling to find loop invariant in power function