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

learn more… | top users | synonyms (5)

0
votes
2answers
43 views

Nested lists replacing of elements

I have a list of the form SpecialCycle12={{{1, 2, 0, 0, 0, 0, 0}}, {{3, 2, 1, 0, 0, 0, 0}}}` And the list ...
1
vote
2answers
52 views

Dividing a list into more, smaller, lists [on hold]

If I have the list {3,5,4,2}, is there a way to divide this list into smaller lists of the form {3},{5},{4},{2}?
7
votes
4answers
147 views
0
votes
2answers
41 views

Can you unpack a list of values into variables in a With expression?

For instance, if I am trying to draw a graph with 5 vertices labeled a through e, and I want to draw edges connecting a and b, a and c, a and d, a and e, b and c, b and d, and c and e, I would run the ...
0
votes
0answers
50 views

How to take a list and build sets of 2 elements without duplicates?

I am new to Mathematica so the answer to this question is probably easy. I have a list of 2D-points in the form {{x1, y1}, {x2, y2}, ...} Then I have a function that will take two points and test ...
6
votes
4answers
167 views

Efficient way to compute a complement while respecting multiplicities [duplicate]

Suppose I have list2 which is a subset of list1. I want to get a res by deleting an element ...
3
votes
0answers
59 views

ArrayPad with vectors

I would like to pad a nested list like M = {{{a, b}, {c, d}}, {{e, f}, {g, h}}} with some constant "vector", e.g. {0, 0}. ...
17
votes
2answers
458 views

Mysterious behaviour of Pick

As everyone knows, Pick can do amazing things, The most facinating phenomenon is that it can pick though all sorts of lists: The basic & pattern matching: <...
2
votes
1answer
78 views

Double Sorting a Matrix

Say I have two matrices {{0, 1, 2, 2}, {2, 1, 0, 2}} and {{2, 1, 0, 2}, {2, 1, 2, 0}} I then sort by the first row ...
3
votes
2answers
88 views

Inverse action of Thread

I cannot find the original post now, but I'm quite sure that there's an amazing post teaching us how to do Thread on ragged lists. but my problem is how to inverse ...
4
votes
2answers
104 views

Strange Manipulate behavior

Running the following code and pressing the play button under b will input -2147483648 in b. ...
1
vote
1answer
53 views

Creating a Dynamic Time Index Slider for List Animate Plot

I am trying to create an animation using ListPlot, which has worked, but I want to be able to see how time is changing (i.e. its dynamic value) as the animation runs. Here is my normal List Plot ...
3
votes
1answer
78 views

How to define the following matrix

How to define the following matrix in Mathematica? $$A(n) = \begin{pmatrix} B_{1} & B_{2} & \cdots & B_{n} & 1 \\ B_{n} & B_{1} & \cdots & B_{n-1} &1 \\ \...
1
vote
2answers
80 views

Interpolating initial conditions of orbits

I have a data file containing the $(x,y,p_x,p_y)$ initial conditions of two-dimensional orbits. Let's plot them on the $(x,y)$ plane. ...
0
votes
1answer
47 views

Color a list of 2D points continuously

I have a list of 3-tuples. First 2 positions are coordinates in $R^2$, the third specifies concentration of a chemical at that point, which I want to render in color. Here's what the list looks like: ...
1
vote
1answer
68 views

Predicting the initial conditions of orbits inside a closed curve

I have a data file containing the four orbital element $(x,y,p_x,p_y)$ of a two-dimensional closed loop orbit. Note that the exact implicit equation of the orbit is not known. The plot of the 2D ...
1
vote
2answers
51 views

Passing each element of a list as an argument to a single parameter function [on hold]

Consider a single parameter function: g[w_] := w^2 +1; Consider a list: slist= Range[0, 100, 1]; Now when I apply function ...
3
votes
5answers
209 views
5
votes
3answers
64 views
1
vote
1answer
80 views

Creating sublists [duplicate]

I got this example in Mathematica references. v = ToExpression["a" <> ToString[#]] & /@ Range[1,44] Could someone explain to me the function of the ...
1
vote
0answers
31 views

Arrange of several files

I am struggling to import my data. There are 400 files in CSV format with names organised by date like: Table1_20111003_YYYY_MM_DD_0000.dat. In each file over 20 colums and 86400 rows (seconds of ...
4
votes
5answers
201 views

Transforming a list of the form {{{x, y}, z}, … } into the form {{x, y, z}, … } [duplicate]

This should be a fairly simple question, but I can't figure out how to do it. I have a list of points of the following form: ...
8
votes
9answers
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. ...
1
vote
2answers
54 views

Not able to apply Scan in place of For loop [closed]

I have been advised to avoid procedural loops and use other functions like Scan,NestList, FoldList, NestWhileList, Inner and Outer. My worry is that if I have a need in which certain critical ...
1
vote
1answer
59 views

Create a table indexed form a list giving a the index specifications

I need to create a table indexed form a list. e.g.: list={{i, 3}, {j, 4}}; would give the table Table[..., {i,3}, {j,4}]; ...
1
vote
2answers
92 views

Group matrix values by column [closed]

Original Question: I have a list {{a, 1}, {b, 3}, {c, 1}, {d, 2}, {e, 3}}. I want to be able to group the the first number in each pair that has the same second ...
3
votes
2answers
193 views

Selection of points based on position

I have a series of points, for example: points = {{0, 0}, {1, 3}, {2.5, 2.5}, {4, 4}, {6, 6}}; I want to join all points successively unless, for example, the y-...
-2
votes
0answers
79 views

Animating Differential Equations [closed]

I was tasked with creating a 3D animation in Mathematica, which aims to describe the movement of a football through space as it's kicked. There are several differential equations regarding this matter ...
0
votes
0answers
44 views

Rotating the nested lists of a list [closed]

I have a nested list of the form List1 = {{1},{2},{3},{4},{5},{6}} I want to apply RotateRight to each of the elements in ...
1
vote
0answers
50 views

Putting the elements of a list inside another list

I have the list list1 = {1, 3, 4, 5, 6} and want to put the elements of this list inside a list of 0's, ...
1
vote
2answers
102 views

Changing the order of elements in a list

I have a list of the form list1 = {1, 3, 4, 2, 5, 6} and I would like to replace each of the elements in the position of represented by the previous number in the ...
1
vote
1answer
53 views

Convolution with modified indices

I want to perform convolution for a sequence but instead of having the indices cycle from the ends periodically, I want to apply a function, specifically Abs, to ...
0
votes
2answers
150 views

Selecting points inside a closed curve

Let's create a rather dense grid of initial conditions ...
0
votes
1answer
43 views

Mapping AssociationThread over list with repeating keys [closed]

I have two lists. One with the same repeating four keys and the other with unique values. Both are the same length. I want to Associate the first list with the second list. So if that if the 5th ...
2
votes
0answers
27 views

Splitting a list into sublists with different sizes [duplicate]

I have the list {7, 8, 9, 10, 11, 12, 13, 14} and would like to split it into a list of size 2, a list of size 3, and covert the remaining element into singleton ...
3
votes
3answers
145 views

Question about Nearest [duplicate]

In the following example Nearest finds the nearest values between list1 and list2 and ...
10
votes
3answers
755 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
103 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
72 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
39 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
157 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
240 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
192 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 ...
0
votes
1answer
62 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? ...
3
votes
2answers
100 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 ...