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.

37 questions
42 views

Formula for: 29, 33, 37, 41, 46, 50, 55 (example from an RPG game) link to question [closed]

link to old question I apologize for spam but I need an answer.
19 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'(...
133 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 ...
116 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. ...
36 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...
37 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 ...
40 views

what is fuzzy svm?

I have to solve this question for my homework but I don't get how to formulate svm to FSVM. can someone please guide me? What is your idea to have a model of SVM classifier in which instances can ...
32 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 ...
12 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) ...
40 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 ...
24 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. ...
271 views

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 ...
138 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$ ...
51 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 ...
33 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$. ...
52 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 ...
16 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 ...
62 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 ...
51 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 ...
97 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})$$ ...
68 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 ...
137 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 ...
40 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 ...
75 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 ...
122 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 ...
81 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 ...
92 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 ...
411 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: ...
20 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 ...
139 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 ...
55 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 ...
588 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. ...
72 views

What is the Right Context of a Word in Formal Langauge Theory?

I am reading this paper and am unable to understand this notation in section 2.2 - The right context of a word $u$ according to a language $W$ is the language {$u^{-1}w$ | $w \in W$}. The ...
49 views

Max number of patterns when extending unique vector?

I'm not sure how to explain this correctly, so I hope the example at the end helps. I have unique vectors of different lengths, and I want to find the maximum number of variations possible of keeping ...
146 views

Sum of Odd Numbers make Squares

Look at this: 1 (+3) 4 (+5) 9 (+7) 16 (+9) 25 (+11) 36 (+13) 49 And so forth, you get the idea. Why do they make up this pattern? And is there any special name for this ...
I have a sequence of $N$ real numbers $X_i$ that are deemed to be equally spaced. $N$ is small (say $10$ to $20$). Two problems can arise: the spacing isn't perfectly uniform, it can vary in a ...