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

learn more… | top users | synonyms (5)

0
votes
0answers
17 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: ...
2
votes
3answers
122 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 ...
0
votes
0answers
36 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 ...
0
votes
0answers
35 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 ...
21
votes
6answers
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 ...
0
votes
0answers
24 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: ...
4
votes
1answer
84 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 ...
4
votes
4answers
329 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 ...
2
votes
3answers
201 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, ...
11
votes
1answer
138 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}} ...
0
votes
1answer
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 ...
3
votes
2answers
113 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 ...
3
votes
1answer
50 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, ...
3
votes
2answers
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 ...
14
votes
5answers
311 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 ...
1
vote
1answer
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, ...
9
votes
11answers
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. ...
2
votes
3answers
75 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, ...
0
votes
1answer
39 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: ...
2
votes
1answer
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 ...
73
votes
3answers
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 ...
1
vote
1answer
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 ...
6
votes
2answers
97 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? ...
41
votes
3answers
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 ...
25
votes
6answers
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: ...
0
votes
1answer
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
24
votes
1answer
859 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 ...
77
votes
3answers
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 ...
5
votes
5answers
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 ...
0
votes
1answer
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 ...
9
votes
3answers
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}...
0
votes
2answers
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!
2
votes
1answer
97 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|> ...
0
votes
0answers
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 ...
0
votes
0answers
35 views

How to convert from Dataset Object to List? [closed]

I have a Dataset of coordinates and I want to eventually plot them. How do I go from to {GeoPosition[{37.33,119.6}], GeoPosition[{37.33,119.6}] .....}?
22
votes
3answers
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 ...
1
vote
1answer
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 ...
0
votes
1answer
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 ...
1
vote
1answer
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?
1
vote
1answer
38 views

Replace empty list elements with pattern

I have a list which sometimes looks like: list = {{},{}} I need to catch these occurrences and replace them with {{0,0},0}. The following hasn't worked So, ...
1
vote
1answer
51 views

Local Max/Min from the list with fluctuation

I am trying to find the local minimum of the list of data with some noise. Here is how the data looks like below image, and I want to extract the three points. From an question by giacomo (link), I ...
12
votes
6answers
529 views

how to permute list of number{1,2,3,…,n},while preserve the order of first m terms as well as the last n-m terms?

For example, starting from {1,2,3,4}, I want to generate all permutations like {1,3,2,4},{1,3,4,2},{3,4,1,2} which preserve the ...
0
votes
2answers
75 views

How to plot the mean of a 2d list with some empty elements

How can I plot the mean of such a list: http://pastebin.com/dNjeR4WC which contains an alternating number of elements in the sublists and some sublists that are empty and should not be considered in ...
34
votes
7answers
3k views

How to apply or map a list of functions to a list of data?

Say I have a group of functions: f1[a_] := a * -1; f2[a_] := a * 100; f3[a_] := a / 10.0; and some data in a list: ...
0
votes
1answer
82 views

Mapping a simple 2 variable function

Quick Question: What is the best way to map this function so it performs seperately for 102 different values of x? ...
5
votes
1answer
179 views

Find positions where two matrices differ

I have two matrices A and B of identical dimensions. What's the simplest (shortest) way to find the indices of differing ...
10
votes
3answers
341 views

How to extract the list of all matrices from a Block Diagonal Matrix?

I am working on a function to do the opposite operation of How to form a block-diagonal Matrix from a list of matrices? Here is my current algorithm: For i ...
2
votes
3answers
78 views