# Tagged Questions

Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

72 views

### How to efficiently implement k-FN (k-Furthest Neighbors)?

I'd like to pick k points from a set of points in n-dimensions that are approximately "maximally apart" (sum of pairwise distances is almost maxed). What is the simplest efficient way to do this? For ...
116 views

### Build nested function

By running the following code: ...
62 views

### How to combine Nest and list Part

I have a list $L$ of Length $n\geq6$ and a function $f$ that, when applied to $L$, generates $n-5$ lists $\mathscr{L}_i$ of Length $n-1$ (at the outermost level). I ...
47 views

### Merging Two Lists - Loops

I have 2 lists. For example, list1 = {{a,b}, {c, d}, {e, f}, {g, h}} list2 = {{1}, {2}, {3}, {4}} I want to merge them such that I get the result: ...
70 views

### Among several lists how to identify a pair of numbers together in a same list?

I have some lists: ...
40 views

### How to delete sublist in a list?, with DeleteCase or similar

I like to delete the sublist that have the second element "" (or any other you can set as "-1" or "A") In the next example, I would like to erase the first and third sublist. How can I do this with <...
290 views

### Average dataset with many repetitions?

I have a dataset where each item is of the form: <|"p1" -> x1, "p2" -> x2, "r1" -> y1, "r2" -> y2|> The interpretation is this: ...
35 views

### Part command in a matrixform [duplicate]

I do have a MatrixForm a table which I would like to pick just a part of it. Is it possible to somehow command part[[]] for a <...
26 views

### How to list all binary expression trees with given leaves

If i have a list of leaf nodes and nonleaf nodes with specified arities, how can I effieciently enumerate the possible trees? For example: ...
130 views

### Table with condition

I have 2 lists of numbers A = Range[16, 65] and B = Range[10, 16]. I want to form all possible combinations $(a,b)$ of the ...
38 views

### Sorting Ordered List of Words by First Letter

I am trying to sort an ordered list of the most common Arabic words. I want to create sublists of words according to their first letter while maintaining the order of the original list. Here's an ...
37 views

### 3D listplot, for a given table

I have a table of 4 data, my first problem is how can I choose one region in which just one of these variables is constant and the listplot3D the other 3 variables? I need to do this for at several ...
4k views

### Best way to create symmetric matrices

From time to time I need to generate symmetric matrices with relatively expensive cost of element evaluation. Most frequently these are Gram matrices where elements are $L_2$ dot products. Here are ...
25 views

### Get rid of infinty in matrix elements (by seperately defination of diagonal and off-diagonal elements)

I want to generate a matrix in which the elements have the below rule to be generated: ...
89 views

### Better use of pattern matching in replacing elements of a list

I have a list of reals and I'm replacing those which are contained in a given interval with two different values depending on wheter the selected reals are positive or negative. I came up with this ...
337 views

### Lists in Mathematica

I have a list of the form: { {0.185794, {α -> 5.8794, χ -> 3.14159}} ,{0.206365, {α -> 6.07943, χ -> 3.14159}} } How can I transform this list such ...
202 views

### Approximation of definite integral by parabolas

This question is related to Trapezoid approximation to definite integral. As promised, I am now asking about how to draw an approximation of integrals by parabolas. I tried to modify MarcoB's code, ...
179 views

### Bad interaction between Join and ListPlot (or Plot)

When you write this code: tab = {{1, 1}}; tab = Join[tab, {{2,2}}]; you expect to get the following table: {{1, 1}, {2, 2}} ...
144 views

### Trapezoid approximation to definite integral

This question is related to Graphically approximating the area under a curve as a sum of rectangular regions. I now was trying to adapt the code by MarcoB to get the approximation of the integral by ...
119 views

### Delete elements from a list

I have two lists, for example s={{1,3,2},{1,3,2},{2,3,1},{3,1},{2,3,1}}; c={{3},{1,2},{3}}; First element of c means that ...
51 views

### Evaluating a list of randomly sampled triplets with a function of three variables

I'm new to Mathematica. I need to generate a list of 1000 triplets of random numbers {r, p, t}, so that 0 < r < 1, ...
286 views

### Speed up Select on large list

I am running this on a very large list, it is important to notice that some times the dates in v occure several times, and I want the selected list to show the same amount. This produces the right ...
313 views

### Apply multiple functions to parts of a nested list [duplicate]

data = {{1, a, x, "one"}, {2, b, y, "two"}, {3, c, z, "three"}} I want to apply a list of four functions {f, g, h, m} one ...
68 views

### Generating a very large list of integers not divisible by a set of primes

I have read (58520), but the solutions there do not work when using a large maximum value because they rely on Range. For example, ...
1k views

### Riffle but not quite

Given the two lists below, is there an in-built command or otherwise neat way of accomplishing the desired output. ...
76 views

### Getting directly a packed array of repeated packed arrays

Consider this code: Needs["Developer"]; N@Range[5]; PackedArrayQ@% Table[%%, 5]; PackedArrayQ@% which prints True, ...
40 views

### Mean brightness and the standard deviation of columns in a gray scale image

I want to calculate the mean brightness and the standard deviation of columns in a gray scale image (8bit). Can the following calculation code be made faster or/and shorter: ...
83 views

### Duties of Threads accompanied by # or a Rule ->`

I was willing to understand the Coolwater's solution of the presented problem here. He proposed the below solution ...
36 views

### Imported thumbnails from Flickr don't all show up as images? [closed]

I imported thumbnails from flickr like this: ...
3k views

### What is a Mathematica packed array?

A simple sounding question with a few sub questions: What is the difference between unpacked vs packed array? Are packed arrays more space efficent, how much so? Are packed arrays more time ...
42 views

### How do I extract religion fractions data from CountryData?

In this code: data = CountryData["UnitedStates", "ReligionsFractions"] I need to extract all of the names of the various religions as a variable and the fraction ...
98 views

### Query or MapAt ragged associations or ignoring Missing values

Related to this question, can functions be mapped to named Keys in ragged lists of Associations? ...
971 views

### Are there guidelines for avoiding the unpacking of a packed array?

Packed arrays are very useful because they save memory and generally allow speedier and more efficient calculation times. If a list of data currently stored as a packed array is unpacked, it can slow ...
1k views

### Map-Thread-Through-Apply a list of functions onto a list of (lists of) values

I have a list of functions: fns = {f, g, h} and a list of triples: ...
79 views

### Sorting matrices by their norms

I have a matrices A and their Norms(Matrices B). I want to rank Matrices A based on their Norms. From smallest to highest Norm
860 views

### Using Transpose with a list as the second argument

I'm having difficulty understanding the Transpose function. I know what the transpose of a matrix is, not a problem, and I see that applying the ...
3k views

### Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
285 views

### How can I make a lists of pairs out of two lists of triples?

I want to use this expression for my computation: FoldList[vt[#2[[1]], #1, #2[[2]], b] &, v0, Transpose[Join[{ea, cm}]]] My problem now is that ...
86 views

### Problem with FoldList: Use Foldlist with more than one List/Use FoldList with multidimensional array

I have the following function: vt[ea_, v0_, cm_, b_] := ea + (v0 - cm)*b ea is a set of lists and ...
381 views

### Implementation of tensor product formula

For the Bézier surface, which owns the following matrix definition: \begin{align*} \mathbf S(u,v)&=\sum_{i=0}^m \sum_{j=0}^n \mathbf P_{i,j} B_{m,i}(u) B_{n,j}(v)\\ &=\small \begin{pmatrix}...
57 views

### How I can calculate product of series matrices

How I can calculate product of series matrices: A= Im...In. In-1 ...I1 which In = {{n,7n-2,3,2n-1},{3,4,n,6n-1},{9,3,n,n-3},{n-2,1,8,7n/3}} thanks!
99 views

### How to extract info from Association? [duplicate]

How can one extract a list of keys and a list of values from the association? e.g. as = <|a->1, b->2, c->3, d->4|> ...
34 views

### A list of bound variables

I have been given a set of (bound) variables and inequalities, and then I want to use Exists[...,...] to get an quantified formula. But when I tried, trouble will ...
858 views

### Typoglycemia text manipulation

I was just reading the Wikipedia page on Typoglycemia: ... readers can understand the meaning of words in a sentence even when the interior letters of each word are scrambled ... and wanted to ...
41 views

### Splitting Logical Expression in list of expressions

I have long results of a Reduce statement in the form of {(expr1) || (expr2) || (expr3) || ...} I am looking for a way to split ...
69 views

...
48 views

### Replacing Non-Constant Elements from List with Pattern [closed]

I have a list list = {0, 0}, 0, {0, 0}, 0, 1}, {{0, 0}, 0, {0, 0}, 0, 2}, {{7,7}, 20, {7, 7}, 3}, {{8,8}, 30, {8, 9}, 4}} And I want to remove all elements which ...
53 views

### Deleting duplicate cells from notebook

I need to delete all duplicate cells in my notebook, keeping just one occurrence of each pair (or tuple). No need to choose which to keep. Is there a (simple) way to do it?