Questions tagged [pattern-matching]

For questions about pattern matching in computer science, which is the act of checking a given sequence of tokens for the presence of the constituents of some pattern.

Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

Pattern identification in real (conically deformed) images

I'm trying to solve the following problem: I'm in an analysis process of some photographs (as taken by a camera, thus they are conically deformed). I'm already able to automatically identify some ...
3 votes
2 answers
66 views

An analogue to OEIS for graphs and ordered pairs?

Does anyone know if such a thing exists already? I was able to find a number of seemingly very comprehensive encyclopedia-like reference pages on many species of graphs, but it seemed that the use ...
  • 5,504
4 votes
1 answer
103 views

Find the $n$'th integer composition with a fixed number of components in lexicographical order

lets there is a number (N) and partitions (p), I have all the possible combinations, each combination sums to N. I want to calculate the nth term of these sequences/ combinations given N and p. N = 7, ...
1 vote
2 answers
210 views

Why do we use $...$ with irrational numbers?

That $...$ in title means the $...$ used at the end of example in question body. So my question is you must have numbers/patterns like $$ W={1,2,3 ...} $$ Here $ .. $ makes sense. Also $$ \frac{1}{3}=...
user avatar
1 vote
1 answer
34 views

Identifying specific pattern in a noisy dataset

I am working on a project where I have the following forward model. There are multiple point sources sparsely distributed in 3D space with coordinate $[x_0,y_0,z_0]$ for each of them. The detected ...
user avatar
0 votes
2 answers
75 views

How do you solve a question like [closed]

Suppose that a, b, and c are real numbers, and $P(x) = ax^2 + bx + c$. If $P(x + 2) + P(x + 1) − P(x) = 2x^2 + 15x + 20$, what is the value of $P(10)$? This is a grade 8 Canadian Math Challenger's ...
  • 69
0 votes
0 answers
89 views

Probability of corners and the postage stamp patterns is bingo game.

I am very new to this bingo game and want to know how to calculate probability of a particular pattern in bingo game. Here each column has number in range of 1-15, 16-30, 31-45, 46-60 ,and 61-75. ...
1 vote
0 answers
60 views

How can I enumerate the transformation rules on lists of lists?

This is a question about pattern matching and list transformation rules. (I may have the notation a bit wrong). Basically I'm thinking of rules which transform a set of balls with a letter on them, ...
  • 4,181
2 votes
1 answer
397 views

How do we find the number of sub-intervals whose intersection with the subset of the entire interval is non-empty?

Suppose we have set $A=\left\{\frac{1}{k}:k\in\mathbb{N}\right\}$ and we divide interval $[0,1]$ into $n$ sub-intervals of equal length. How do we find the exact forumula (or approximation) of the ...
  • 1
2 votes
1 answer
107 views

Distributing Series/Patterns

I'm going to do my best to explain this question, but it's complicated. Please bear with me. I'm trying to solve a practical problem and I know that the answer involves some math, but I can't for the ...
1 vote
1 answer
589 views

Matchsticks Problem : Finding Maximum Squares Formed by $n$ Sticks

Given $n$ sticks, what is the formula for how many squares that can form with the sticks, where the square's sides each one matchstick? No breaking the matchsticks or allowing them to intersect. ...
2 votes
2 answers
133 views

Pattern in Sequence of Polynomials

I generate these polynomials from a counting experiment. There are some obvious patterns i.e the order of $f(n)$ is $n(n+1)/2$. Also, each $f(n)$ has repeated binomial coefficeints corresponding to ${(...
  • 1,697
-1 votes
1 answer
37 views

Set up a rule from a pattern [closed]

I have to set up a recursive formula for a sequence that gives the number of ways to take out and arrange lego bricks to a wall with the length of 2n knobs. Some lego bricks have 6-knobs and some ...
  • 35
0 votes
0 answers
157 views

How to recognize pattern in a sequence (array)

How do I recognize a know pattern in a sequence of numbers? I have two known pattern like this: 1, 2, 3 and 1, 3, 2 I have a ...
  • 136
0 votes
1 answer
398 views

What is the term of the concept to find the minimum vertex cover which covers all of the vertices (not edges) of an undirected graph only once?

I am actually looking for a term, I have googled for like past couple of hours and I had no luck so far. So there exists a thing called, minimum vertex cover which implies " a set of vertices such ...
  • 103
1 vote
1 answer
50 views

Average number of moves to have a specific 3-bit pattern

I would like to know how to have the average number of moves to have a specific 3-bit pattern. It is a random test where the chance of having 0 or 1 is the same: 0.5 (like having a coin toss). We drag ...
1 vote
0 answers
162 views

Matching individual points in two different sets of coordinates

I have to match some 2d sets of points to an another 2d set of points (as ground truth) and find the outliers. In other word I have to match each single point to (maximum) one of the points in the ...
  • 111
1 vote
3 answers
47 views

Finding the equation pattern of a known set

I have the numbers 1 - 100, when they are put into a box (an abstracted code function I do not know the details of), they come out as ...
1 vote
3 answers
116 views

Ceiling and Floor Formula for Sequence of Numbers

I am trying to find a formula for a sequence of the following numbers: $$4,5,8,9,12,13,16,17,\dots$$ Can anyone help me or give me a hint on how to derive a formula?
-1 votes
2 answers
44 views

Formula for sequence of numbers

I am trying to find a somewhat nice general formula for the following sequence. $2,2,6,6,10,10,14,14,\dots$ I found one on wolfram alpha, however I am not sure how to derive it; I am also wondering ...
0 votes
0 answers
27 views

Encryption and Decryption of Alpahabets to Integers

I'll explain my case with an example. Say, I've 2 words, FOOTBALL FOOD Let f(FOOTBALL) = 845614, f(FOOD) = 74312 and f(FO) = 132 Is there any method to get f'(845614, 2) = 132 and f'(...
0 votes
0 answers
202 views

How can I find the sequence of moves which will end the chess-game(only consisting of pawns)? [closed]

The value of (N) for this problem is between [1,100]. There is a chessboard with N rows (numbered 1 through N) and N columns (numbered 1 through N) . Let's denote a cell in row r and column c of the ...
3 votes
2 answers
212 views

Finding a pattern, I'm stuck

I have a friend who knows how much I love math, (I imagine new problems just to do the math behind them and to see if I can expand my understanding) and so he brings me the stuff that stumps him. ...
-1 votes
2 answers
40 views

Find the number pattern [closed]

Goal: find 1 equation to generate -4,2,10,6,3 on looping Output -4 on 1st iteration Output 2...
2 votes
1 answer
63 views

Number of possible unique patterns of $5$ points on an $8\times 8$ grid.

I'm after a specific answer and workings/formula for the number of possible unique patterns that $5$ points can have on an $8\times 8$ grid. The pattern must be unique and not match another pattern ...
  • 21
1 vote
0 answers
244 views

Cross correlation coefficient for 2 matrices (two 2d arrays)

I'm trying to manually calculate cross correlation coefficient for 2 matrices. But I'm not sure how to apply the formula and how it works. Here are my example matrices: Matrix 1 Matrix 2 Any help ...
0 votes
0 answers
20 views

Determining the importance of items across sets?

There's a better term for it. Let's say i have a suite of sets - A, B, C, D. Each set contains any number, in a non-important order, of items - 1,2,3,4,5,6 The items may occur any number (0 or more) ...
  • 321
1 vote
2 answers
59 views

Split a list of 24 items into four parts, so you need three out of the four parts to recover the entire list

Imagine you have an ordered list of 24 words, and you want to split the list of words into four parts. You want to set it up so that three out of the four parts are needed in order to recover the ...
  • 113
0 votes
0 answers
28 views

What will be the logic of the answer?

I have this reasoning question (image) So, what I did is I found the number of dots in this, which came out to be: 2 5 11 7 13 19 5 ? 17 And I can't really find what's the pattern in this. ...
3 votes
1 answer
980 views

NON-martingale approach to ABRACADABRA problem

The well-known ABRACADABRA problem states (see D. Williams, "Probability with martingales", for example): a monkey is typing letters A-Z randomly and independently of each other, each letter ...
  • 3,525
8 votes
1 answer
396 views

Avoiding exactly one permutation pattern

Let $n \geq k$. We say that a permutation $\sigma \in S_n$ contains a permutation (or "pattern") $\tau \in S_k$ if there is a substring of $k$ (not necessarily consecutive) elements of $\sigma$ ...
2 votes
1 answer
77 views

Getting a specific element of a non-recursive sequence

I have a sequence, starting with $1$. You store the current sequence as a list, then duplicate it. In this copy, you invert it, turning $1$s into $0$s, and $0$s into $1$s. Then, you join it on to the ...
2 votes
0 answers
43 views

Probability of matrix equality under modulo (pattern matching)

Probabilistic pattern matching with matrices works like this: For two given strings, $x,y$ where $x\in\{0,1\}^n$ and $y\in\{0,1\}^m$ and $n\ge m$, we want to find the occurrences of $y$ in $x$. ...
  • 937
1 vote
1 answer
202 views

Placing letters in three mailboxes

A mailman has 7 letters that are all the same. He can put them in three mailboxes in any order he wants. How many ways are there to put the letters in the mailboxes? Something different about this ...
0 votes
0 answers
24 views

Building an equation (inverse combinatorics?), then identifying the optimal pattern

I have identified an equation, but now I am wanting to know if there is a means of identifying the most efficient pattern to provide the numbers that meet the requirements. Here is the problem: A ...
0 votes
0 answers
70 views

Completing sequence pattern

My kid is class 5 He has got a question of patterns The pattern goes on as 13 15 27 42 ..... and have to find the next number with the rule pattern I am unable to decode, thought question is ...
  • 105
1 vote
1 answer
186 views

Distance between patterns of points

I was thinking of the following problem: Imagine I am given two lists of points on a 2D plane. These lists have the same size, i.e. both lists have the same number of points. Now, I want to be able ...
  • 4,685
4 votes
4 answers
119 views

Special palindromic pattern of $(\frac{10^n-1}{9})^2$

I noticed a repetitive, palindromic pattern when I've performed exponentiation with $10$. That is: $$(\frac{10^n-1}{9})^2 \text{ has a palindromic pattern, }\forall\:n\in [1;9]\:(n\in \mathbb{N})$$ We ...
  • 1,133
0 votes
1 answer
187 views

How can I create an equation for a pattern?

How can I generally create an equation from a pattern? Take for example this pattern: {X = 15, Y = 0}, {X = 16, Y = 1}, {X = 16, Y = 2}, {X = 17, Y = 3}, {X = 17, Y = 4} This pattern could be ...
  • 103
2 votes
0 answers
229 views

Matching the position of points in 2D space

Considering there is a 2-dimensional array $A$ consisting of point coordinates in two dimension space (as shown in image). There is another array 2-dimension array $B$ also representing the position ...
1 vote
1 answer
44 views

Can I Compare Symbol to String

I'm a student majoring in computer science. I'm not sure if I can use the equality sign (=) for a string value. (I can definitely do that in computer code...) So please check the mathematical ...
1 vote
2 answers
83 views

How to explain the difference between the following time series?

I am conducting an empirical study for understanding the behavior of different people in a collaborative environment. There are two types of events in my study: A and B. Let's assume A means ...
1 vote
1 answer
242 views

Is haskell style pattern matching allowed in conventional mathematics and if not, how do you work out the numerator of an arbitrary rational number?

Is it possible to define a function "Numerator" in the following way? $$N(a/b) = a$$ Or likewise is it possible to define a function "Denominator" like this? $$D(a/b) = b$$ These functions take a ...
0 votes
1 answer
162 views

28 dominoes lying in one direction what is the last one? [duplicate]

Peter with a standard double six set lays 28 dominoes in one direction - what will be the last number on the end on then of the last domino? Suppose he plays in both directions and discovers that he ...
  • 1
3 votes
1 answer
443 views

Quantify the similarity between two patterns formed by two sets of spatial locations

Suppose I have two sets of spatial locations $X$ and $Y$ on the plane, each with $n$ locations. The coordinates are $X=\{(x_1, y_1), \dots, (x_n, y_n)\}$ and $Y=\{(u_1, v_1), \dots, (u_n, v_n)\}$. I ...
  • 3,563
0 votes
2 answers
1k views

How to compute the distance between two vector with different sizes?

I think it's better to start with an example. I have the following vectors: ...
  • 255
1 vote
0 answers
21 views

Count of matching lines in compared patterns - distribution and significance?

Imagine a number of lines of varying thickness, perpendicular to, and distributed over, a fixed distance, d (in many ways similar to those of a standard barcode). Imagine that one such pattern (lets ...
1 vote
0 answers
212 views

Matching vertices between two graphs

I have a situation where I have two graphs that are supposed to represent the same underlying topology but represent the underlying topology at different resolutions. My goal is to match vertices ...
  • 111
0 votes
1 answer
197 views

How to find a pattern

I have a list of objects. Each object has $3$ values that will have a value from $0$ to $100$. I want to know how iI be able to find the pattern that is most common in that list. Object 1: 1-2-3 ...
0 votes
1 answer
735 views

Pattern finding algorithms

I am working on a server that will update a list each day. The list will look like the following example. ...