pattern-matching's questions - English 1answer

858 pattern-matching questions.

I'm having problems setting an upvalue for a symbol that is supposed to ignore Inactive:IgnoringInactive[f[g[x]]] ^:= match;...

I have to set the first and last rows and columns to zero rows and columns. I tried with the first column: ...

I have had a look through the documentation and I cannot find a ProbabilityDistributionQ function. How can I return True if the ...

I am finding the minima of a 2D cubic periodic function by "brute force", i.e. looking for the (x,y) positions where the both the x and y derivatives are 0. This returns a list of points, in this ...

I need to make a GeoGraphics[] object then save it to disk, move it to another computer where I need to load in the object then add some more ...

I have the following simple code:z = {a, b, c} {{1, 2, 3}, {1, 3, 2}, {3, 2, 1}} /. {a_Integer, b_Integer, c_Integer} /; OrderedQ[z] -> 1which returns ...

This is a slight variation of: How to generate all possible orderless partitions of a list according to another list? Consider each set following a partition a "box" and each element a "ball". What ...

This is a very simple question. I have an unnamed pattern and a test function should determine whether to perform replacement on it. How to make the following piece of code to work: ...

I have a list of reals and I want to check if for every element $i$ there is another element $j$ such that $\lvert{i-j}\rvert \leq x$ where $x$ is some arbitrary value. Each element can only be "...

I would like a pattern which takes as an argument a set with $n$ elements, and an integer $k$ which is less than $n$ and greater than 1, and which matches against any $k$ distinct elements of the set, ...

In my Mathematica 11.3.MatchQ[-3*i[1], -x_*i[1]]returns False. ButMatchQ[-3*i[1], x_*i[1]]returns True. I don't ...

I'd like a pattern which matches an expansion of a vector in a given basis, so mathematically any expression of the form $\mathbf{v} = \sum_{i = 1}^n v_n \mathbf{a}_n$. The basis is defined by a ...

Suppose, I have an expression like so:In[68]:= expr = 2 + 5*q + q^2 + 8 q^3 + 19 q^7 Out[68]= 2 + 5 q + q^2 + 8 q^3 + 19 q^7Now I want to take all powers of q ...

Bug introduced in 10.4.0 and persisting through 11.3.0 CASE:3824590 [...] Developers are discussing this behavior. [...] I will let you know when I have definite information on this. [...] ...

I am struggling to write the correct pattern to match all ArrowBox objects with the relevant graphic directives in following snippet ...

First I present the specific programming question, and then I provide further background details. Given an expression in Mathematica, say f=3x+7y, there are two ...

The task is to separate a leading separator from subsequent text into a list. Why does StringReplace wrap StringExpression ...

Consider the following definitions for two symbols:foo[a] /; True := b foo[a] := a foo[a] (* a *) foo2[a_] /; True := b foo2[a_] := a foo2[a] (* b *)(The ...

An integer is prime-palindromic if both orientations are prime (i.e. 941 <--> 149) Write a function to test if an integer, n, is prime-palindromic. Which numbers in 1 I took the approach; ...

I have a List that looks as follows: ...

I have this problem: Produce a list of those of the first 100 primes which are of the form 8k + 1 for an integer k. So far I know how to create a list of the first 100 Primes, simply using; ...

A Mersenne prime is a prime number of the form $2^n−1$. Produce a list of those n, which are at most 1,000, for which $2^n − 1$ is prime I am able to find the list of prime numbers: ...

I would like to write a generalized function to create a checkerboard pattern of any size (width of each square and frequency of repetition). How can I do so? Edit 1 This is what I tried. ...

I have defined several symbolic function f[x],g[x,y],h[x,y,z] etc... And I have a list made of elements which are product of these functions with different ...

I want to simplify a sum of terms that look like so: ...

Given a symbol t and an expression expr, how can I determine whether or not the symbol t ...

Note: I added the entire code I wrote below to generate the initial configuration and have explained step by step what each part of the code does Kindly bear with the code and the explanation. Since ...

I would like, as an example, to build a Times-like function. Take the following example ...

Consider a list (list) aslist = {{0, 0, 0, 1, 2}, {1, 1, 0, 1, 1}, {2, 2, 1, 0, 0}, {1, 1, 0, 2, 0}, {0, 0, 1, 0, 1}};...

Cases, Select,Pick and Position each have different ...

after looking for a long time manually words in Spanish that have the five vowels in any order, for example Republicano, murcielago, superiora, etc; I'm bored and without success. I thought that ...

In the chapter 7 of the Power Programming with Mathematica, there is a paragraph discussing the behavior of Set- functions: (page 205. (pdf version p. 224)) ...

I'm trying to create a function that builds a replacement rule from a given pattern and I have trouble understanding what's going wrong. After having written most of the question, I see that it got ...

I want a function f that takes a word (like those listed in WordList[]) and returns a pattern best described by examples like these: f[“book”]=abbc; f[“settings”]=abccdefa; and f[“moving”]=abcdef. ...

I am trying to draw some Feynman diagram style picture corresponding to some expressions, which take the following general form: $z\times \hbar^m \times \exp[G j^2/2] \times \prod\limits_{i=1}^{n}(...

I know this question has been asked multiple times before but unfortunately it seems like I'm too dumb to understand what is really going on and how to solve this. Anyway, I want to resubstitute ...

Bug introduced in 10.4 and fixed in 11.3.0 I create two associations, that are supposed to be exactly the same. And then I want to count the elements at the second level. And I get different results: ...

Given the examplary expression expr = (x1 + x17 y2 )/Sqrt[y1 + xx3]I want to apply a rule for every symbol-name starting with "x". My solution ...

I want to define a function such thatf[18/17 h[y][z]] = 18/17 zfor any function h[y][z]. I first tried with ...

Suppose I have two systems of coordinates:{x1,x2} and {y1,y2}. I want to transform an expression containing $\frac{\partial yi}{\partial xj}$'s to those in terms of $\frac{\partial xj}{\partial yi}$'s....

Suppose I start with a differential operator in two variables x1 and x2 as follows: ...

The standard usage of the pattern _. seems usually used in the parameter, for example, f_[a_,n_.]. I wonder if such pattern can ...

I'm now practicing pattern matching by implementing a self-defined differentiation operator. ...

When working with finite fields, I often want to apply some transformation rules to the integers that appear either as coefficients in expressions. This becomes a problem when the transformation also ...

I have an XML file like this: ...

Writing: ...

I would like to write some rules that distinguish between the Times and Dot functions, but I get the following behavior, ...

I'm about to report this as a bug but wondered what you would make of it. Works as expected in version 7. ...

I tried to plot integer points that fall into a 2D region that's dynamically changed. So I resort to Cases and Select, but ...

let's say I have a list of lists that looks like abc={{1,{{1},{2}}},{2,{{3},{4},{5}}},{3,{{2}}}}//TableForm, where the first entry in every row, the one ...

Related tags

Hot questions

Language

Popular Tags