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

learn more… | top users | synonyms (5)

10
votes
3answers
770 views

Using Partition to allow sublists of different lengths

As a minimal example, suppose I have a list of the integers from 1 to 25. Suppose I want to use Partition to partition the list into sublists of length 10 but ...
8
votes
1answer
125 views

Calculating density of states from lists of momentum/energy data

I am trying to calculate the density of states for a 2D system given certain band structure data organized in a specific format. Below is an example of my procedure: Beginning with a simple 2 x 2 ...
2
votes
1answer
82 views

How to split a SymmetricGroup into some PermutationGroup with smaller GroupOrder

Background I want to get a permutation list, so I use the SymmetricGroup(or use Permutations) to produce it when the ...
0
votes
1answer
40 views

ListPlot[Transpose[{xx,yy}]] returns blank plot [duplicate]

This is complete mystery for me, but I am unable to plot the following data... I have two lists, that I want to ListPlot. The data is created in the following way (I edited the code for more clarity): ...
3
votes
2answers
158 views

Operation with lists

I have created this code and was wondering if you could suggest a less convoluted way of solving the problem. I have two lists: ...
4
votes
3answers
246 views

How to double elements of a list given by their positions

Given that I have a list $\{P_0,P_1,P_2,\cdots,P_7\}$, where, $P_i$ is a real number or a list like {x,y}/{x,y,z}. Now I would like to double some elements ...
19
votes
6answers
1k views

Looking for a way to insert multiple elements into multiple positions simultaneously in a list

I would like to take the following data: insertValues = {r, x}; insertPositions = {{1}, {5}}; originalList = {a, b, c, d, e, f, g}; and generate output that ...
2
votes
5answers
194 views

Finding the most common n-tuples of a list of lists where order does not matter

I am still learning to use Mathematica and I need some help. How could I get the most common pair, and generally the most common n-tuple of a list (row vector) given a list of lists of ...
3
votes
2answers
102 views

Hovering over specific coordinates on a picture

I'm working on a small function which can be used so that when the user hovers over certain coordinates in a LocatorPane, these coordinates can be checked against a separate list of coordinates, and ...
5
votes
4answers
159 views

Picking element from continnuous segment of list according to criteria

From list like: {1, 2, 3, 4, 5, 6, 20, 21, 22, 23, 24, 25, 26, 27, 28, 100, 101, 102, 103, 104} I need to pick position of number that is greatest in continuous ...
2
votes
0answers
35 views

How to create a function similar to MorphologicalComponents?

As everyone knows, MorphologicalComponents can create a list that shows only the difference between morphological clusters. But sometimes we need to find out the ...
6
votes
4answers
614 views

Are there more readable and terse method can get this list

I have a list like following list = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}}; I want get this list by a more better method: I ...
1
vote
1answer
71 views

How to import multiple .m files at once?

For example, I import several files with the following lines: ...
1
vote
1answer
69 views

Keeping determine digits in Append to process

The end of my code is written as below. Ignoring the inefficient role of Append, I want to have very simple set of values as for example: ...
1
vote
4answers
167 views

For loop over a list for pairwise distance implementation in Mathematica

I am new to Mathematica and want to implement the following functionality in Mathematica. Suppose I have the following list data4 = {{1, 2}, {2, 3}, {1, 3}}; I ...
3
votes
4answers
159 views

Filling between two listplots

I have two lists which are plotted by below simple command ...
2
votes
1answer
62 views

Need help with making an interactive 3D plot

My main problem is to generate a manipulatable 3D plot, combining three functions and two of those functions depend on another variable Theta (which shall be the manipulateable variable). To explain ...
1
vote
1answer
64 views

Combining the entries of two lists [closed]

I have two lists {a, b, c, d, e} and {1, 2, 3, 4, 5}. I want to creat a new list of tuples as follows ...
1
vote
1answer
70 views

Counting the rows of a list where the order of numbers in the row doesn't matter

I am trying to make a computation with a large set of rows. As a sample, suppose I have a list of numbers with rows and columns like such: ...
0
votes
1answer
55 views

How to generate a random matrix and its average value is a specified value

I want to generate a random matrix whose average value is a specified value,such as 5.5. I found these function here.But I don't know how to use it to do this.I think ...
1
vote
1answer
45 views

Successive differences of elements in a list with step s apart

I have a list of elements list = {a, b, c, d, e, f, g, h, i, j, k, l, ...} I am trying to get successive differences with step s apart. For example, for $s=3$, I ...
2
votes
1answer
82 views

Updating a nested list using elements from another nested list of the same shape

I am new to Mathematica. A quick question: Given a = {{1,0,0,2},{2,0,1,0}} aR = {{1,0,1,0},{0,1,0,1}} if element in a is ...
0
votes
1answer
63 views

How to merge a ListLogPlot including a discrete set of data points with a LogPlot including some analytical functions?

I have an analytical 1d-function of a variable called $M$ and I have plotted that function using the following code: ...
13
votes
2answers
245 views

Unexpected behavior of Sequence — using Sequence to delete parts of an expression

I thought that assigning Sequence[] to the part of an expression was an effective way to remove it. For example, the following code yields {2,3,4,5}: ...
0
votes
1answer
58 views
5
votes
3answers
186 views

Delete all strings that are prefixes of another string

I have a long list of strings and I'm trying to find a more efficient way of removing those elements that are prefixes of another: ...
0
votes
0answers
31 views

Using DatePlus with a list of dates and list of times to add

I have a list of dates such as t2 = {"2016-06-08 05:00:00", "2016-06-08 05:00:00", "2016-06-08 05:00:01"} and a list of offsets (in seconds), such as ...
1
vote
0answers
48 views

List within a Do loop, I can't get any values [duplicate]

I am having the following problem. I am trying to get some values from solving an equation and apply them into a list but in the output I get nothing but the symbol of the variable... The code is as ...
0
votes
2answers
46 views
0
votes
1answer
34 views

List RGB Values from DominantColors [duplicate]

I have taken an screenshot using the GUIScreenShot function from GUIKit and then evaluated the dominant colours in the image. I ...
3
votes
1answer
93 views

remove unevaluated cells from table

I have created a table Tv where each row is of the form {x, y, Iv[x,y]} where Iv is some complicated numerical integral and <...
0
votes
0answers
31 views

Use “FindFit” for Multi-variable Polynomial Fit

I'm interested in defining three input vectors: $L=\{L_{1}, \ldots, L_{N} \}$ $W=\{W_{1}, \ldots, W_{N} \}$ $Q=\{Q_{1}, \ldots, Q_{N} \}$ and I'm hoping to be able to input a number for each of ...
9
votes
1answer
136 views

How to FoldList over Dataset column without destroying/rebuilding Dataset?

I have a Dataset in the following form but with many more rows and a few other columns. ...
1
vote
1answer
99 views

How to read a part of huge matrix saved in a TXT file as single expression?

I saved a huge matrix of numbers with dimensions {400, 4001, 2} using Put and got a TXT file formatted in the following way: <...
1
vote
1answer
69 views

generating random algebraic matrix using elementary operations

I generate several algebraic matrices of 12x12 where each element is a combination no repeat of the variables x, y, z and operations +, -, *, /, power, establishment (square root), any of them or any ...
1
vote
3answers
106 views

Generation of sublists through a single list

I have a list with 25 numbers: list = Range[1, 25] What would be a simple code that could generate 44 new lists with 15 numbers each one of them? Also need to ...
0
votes
3answers
122 views

How to initialize downvalues from a list?

The For expression below initializes downvalues of a variable a from the values in a list ...
3
votes
2answers
79 views

Creating a constant-valued matrix having the same dimensions as previously defined matrix

I have the dimensions of a matrix A. I would like to create a matrix B (say, of only 0's) of the same size as A. But A's dimensions are variable. Is there an efficient way using ...
4
votes
2answers
99 views

How to add some element in a incomplete list

I have two list to process.Their first of each 2D part increasing monotonically and without repetition. ...
3
votes
1answer
75 views

Implementing the Cimmino method [closed]

What am I doing wrong? I am trying to implement the Cimmino method, an iterative method for the solution of linear algebraic systems. The final output should be a vector. Here is a description of the ...
1
vote
1answer
99 views

Fourier transformation of multidimensional list [closed]

x is a list containing 7 trajectories (Dimensions[x] = {2726, 7}) of which I want to calculate the FFT. ...
5
votes
3answers
121 views

ListPlot of data with small differences [duplicate]

This following is a similar question as plot data with small differences, but I am not able to solve my problem with the proposed solutions. ...
5
votes
1answer
82 views

Mapping (Query) a function at multiple locations in nested data via All, Span

For this data: dt = <|"a"-> <|"x"-> 1|>,"b"-> <|"y"-> 2|>,"c"-> <|"z"->3|>|> It’s awkward when mapping the same ...
0
votes
1answer
43 views

Manipulate required to manage 3 parameters one which is a function

Let f(x)=ax(1-x) and I=[0,1]. Then f(I) is contained in I for 0≤α≤4. Take any *x*0 in I and study the iterations *x*1=f(*x*0) etc. Convergence or otherwise around the one or two fixed points (...
5
votes
4answers
238 views

Plotting multiple lists together with their avarages in a single plot

I have as example multiple lists of x data (in mm) http://pastebin.com/7xwgGDsd which I want to plot against time (in sec). ...
3
votes
2answers
165 views

How to Convert a Matrix into an Association?

I have a matrix like this one: test = {{1, "a"}, {3, "b"}} and I want to convert it into an association like this ...
6
votes
5answers
682 views

How to replace a space by a comma

in this expression = "{1 2 3 4 5 6 7 8}", I want to replace each space by a comma , to get ...