Questions tagged [list-manipulation]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
33 views

Second Attempt at Explaining Average and Checking it using Code

I'm unable to load my original post. The editor stated, "Code is not properly formatted" so I used screenshots. Here is a link which could have been used. It gave an approach to a previous ...
5
votes
3answers
55 views

Conditional matches in sets of 3-tuples

Suppose that the data is a collection of 3-tuples: ...
0
votes
1answer
25 views

How to compile a function that takes a list of arguments using InlineExternalDefinitions?

I can do this right now, but I'd love to make the argument a list. (I have a compiled implementation of Linear Solve from here https://mathematica.stackexchange.com/a/91881/73342). ...
2
votes
3answers
86 views

Create a list that always ends with two 1's but starts with a variable amount of 0's

I want to create a variable list like this: {0, 0, ..., 0, 0, 1, 1} This list would grow list this, starting with no 0's, but then gaining more 0's to the left the ...
0
votes
1answer
32 views

Generalizing previous question: Partition $[a,b]$ into $m$ sub-intervals and count number of sub-interval intersecting $A_1\subseteq[a,b]$?

In my previous question, How to partition $[a,b]$ into $m$ equal sub-intervals and count the number of sub-intervals that intersect with a subset of $[a,b]$?, I was given an answer to my specific ...
1
vote
2answers
45 views

Swap two numbers - but only in a particular context

I have a list of terms such as {2*s[1,2]^2, 3*s[3,5]^4, ...} and I would like to have a replacement that swaps $2 \leftrightarrow 4, 3 \leftrightarrow 1$, but only ...
1
vote
1answer
32 views

Get discrete data points from ListLinePlot or Interpolation

If I have the following data: ...
-1
votes
1answer
35 views

Using coding to calculate my average for functions defined on countable sets?

Suppose we have a function $f:A\to\mathbb{R}$ where $A\subseteq[a,b]$, $a,b\in\mathbb{R}$ and $S\subseteq A$. Now suppose $f$ is $$f(x)=\begin{cases} x^2+1 & x\in S_1\\ x & x\in S_2\\ \end{...
5
votes
1answer
47 views

Applying function on specific element of a list of list

I have the following list (3D data) and would like to apply the RootMeanSquare function on the fourth elements of each sublist. In fact, I am looking for ...
3
votes
1answer
41 views

How to use a list inside Compile—it says it should be a machine-size real number?

Super simple question, but I'm lost here. f = Compile[{{a, _Real}, {b, _Real}, {c, _Real}}, x /. NSolve[a x^2 + b x + c == 0, {x}]] f[1., -4., -5.] gives the ...
0
votes
1answer
30 views

How to add a removed element to the associated sublist after manipulating a list

I have the attached point list and use the following script to cluster the points. The clustering should just be applied to the first three-member of each sublist so I removed the fourth element from ...
4
votes
1answer
56 views

Generate a list of rules from two rules

I have two lists: a = {a1,a2,a3} b = {b1,b2,b3} and I want to generate a list of replacement rules ...
7
votes
1answer
309 views

Why are more highly nested lists often not more memory and time-intensive?

I would expect more highly nested lists, being deeper and more complex than flatter lists, to take up more space (bytecount) and take more time and memory to operate on in general. Consider the ...
1
vote
1answer
75 views

How to partition $[a,b]$ into $m$ equal sub-intervals and count the number of sub-intervals that intersect with a subset of $[a,b]$?

Suppose we have a subset of $[a,b]$, where $a=0$ and $b=1$, such as $$A_1=\left\{\frac{1}{2^x}+\frac{1}{2^y}+\frac{1}{2^z}:x,y,z\in\mathbb{Z}\right\}\cap[0,1]$$ Which is a subset of $[0,1]$ If we ...
3
votes
2answers
33 views

How to use ReplaceAll iteratively over a list of lists?

I want to build a matrix J for each of the solutions of an equation. And each solution is also a set of 3 variables (x,y,z). In ...
5
votes
5answers
382 views

How to apply a function to one part while keeping the rest

I have a list and want to apply a function just on the second Part and keep the rest. t1 = Table[{k, 2^k + 1}, {k, 2, 7}] ...
7
votes
7answers
415 views

Creating a list with Thread

I have a list like this one: aaah= {{11, 21, 31}, {12, 22, 32}, {13, 23, 33}} and I finally want to get a list which looks like this one: ...
0
votes
2answers
48 views

How to get a list of exponentially distributed points sampled in a range

I want to get 256 points exponentially sampled in a range, and then get its histogram. If I plot PDF, I get the following: ...
2
votes
2answers
66 views

Counting the number of occurrences of specific values in a list in specific intervals

If the variable "digits" contains 10,000 digits from 0 to 9. How can the number of occurrences of 1s and 2s be counted in every 1000 digit intervals, that is to say the number of 1s and 2s ...
9
votes
2answers
222 views

Use Cases with empty cells in the list

I work with a complex dataset. The most simple form of this list looks like: dat1 = {{a, b, c, {}}, {d, e, f, {1}}, {h, i, j, {2}}} I want to select the nested {} ...
4
votes
2answers
82 views

Building a matrix from the columns of others

A is a n x m matrix, B is a matrix p x m, I wish to build C from appending the ith column of A and ith column of B, for all i ...
3
votes
1answer
96 views

Using DateListPlot without connecting dots [closed]

I have a list of values like this: When I plot this data using DateListPlot[data] I get a plot connecting the individual points such as: My question are: How can ...
3
votes
3answers
108 views

Find rules for the similar “Conway's Game of Life”, and initial input on an 11x11 torus board. Descripted on the “Puzzel Chalenge IBM May”2020"

I solved on May 2020 this using mma . I am aware of this command - Cellular automata. But I can't use it on this challenge, because there's no concept of "Torus" in the CellularAutomaton . ...
1
vote
0answers
26 views

Thread::tdlen: Objects of unequal length in {{a,b,e},{c,d,f}} {x,y,z} cannot be combined

When I do the Times operation among list like this {{a, b, e}, {c, d, f}}*{x, y, z}, the error message is given as Thread::tdlen: Objects of unequal length in ...
2
votes
1answer
62 views

Finding points located in a specific locations of a 3D objects

I have the following list of points in 3D and would like to find the points which are located on the lower edge of the object and on (or closest distance to) the X-Y or Y-Z plane of the symmetry. (...
4
votes
3answers
160 views

How to select radicand

Given t1 = {1, Sqrt[2], Sqrt[3], 2, Sqrt[5], Sqrt[6], Sqrt[7], 2 Sqrt[31], 3, Sqrt[10], Sqrt[11], 2 Sqrt[17]}; I just want to get all radicands, which would yield <...
1
vote
1answer
31 views

Exporting Nodal Surfaces/Minimal Surfaces as any 3D source (obj,stl,mb…)

I have been trying to export the surfaces that I gathered in the Wolfram Mathematica application, So is there any way to export surface this to Maya,Cinema 4D, Rhino , or any 3D environment for 3D ...
0
votes
0answers
56 views

Find a sublist with closest X and Y to a specific point in 3D

I have the following list of points and would like to know how I can find the sublist (i.e. point) which has a closest X and Y value to the X and Y value of a specific point (e.g here b1 ={{-20.6105, -...
1
vote
1answer
53 views

How to manipulate solution outputs that appear in a list? [closed]

I have a list {E, {p, ϕ}}, and I need values E, p, and ϕ ...
0
votes
1answer
41 views

How to change a list of values into variables? [closed]

I have a list {E, {p, ϕ}}, and I need values E, p, and ϕ ...
2
votes
1answer
98 views

Finding lower boundary of a 3D object in list format

I have the following point list and would like to find the points located in the lower boundary of the 3D object (It is part of a body torso). https://pastebin.com/L12n0Gfr I am using the following ...
0
votes
1answer
60 views

Plot 2D into discrete 3D [closed]

I want to do a 3D plot of this functiony[x_, r_] = -Tan[r] x where I get a set of lines evenly distributed on the r axis, with a discrete distribution. This is what ...
1
vote
1answer
31 views

Replacing a submatrix of a matrix

Minding the fact that In[102]:= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}[[1 ;; 2, 1 ;; 2]] Out[102]= {{1, 2}, {4, 5}} is the upper left submatrix. I would like to do the ...
1
vote
2answers
43 views

Substituting values from an association thread into a table of expressions

I have asked a question here. Yet I am trying to do the same procedure with AssociationThread Suppose I have the following function which is a normal distribution: <...
5
votes
1answer
46 views

Substituting elements of lists into an expression

Suppose I have the following lists, as = {1, 2, 3, 4}; bs = {10, 20, 30, 40}; and the following expression: ...
3
votes
2answers
297 views

How to drop points that don't lie in a line

I have some data like: ...
6
votes
5answers
300 views

Select lists where last elements are identical

Given the following list t1 = {{5, 5, 50}, {6, 1, 37}, {6, 2, 40}, {6, 3, 45}, {7, 4, 65}, {7, 6, 85}, {8, 1, 65}, {6, 6, 72}, {7, 1, 50}}; I want to find those ...
1
vote
1answer
87 views

How to use Quartiles to work the same as TI-83 calculator? [closed]

The statistics book I am using defines quartiles the same as Method 1 explained in wikipedia. Use the median to divide the ordered data set into two-halves. If there is an odd number of data points ...
4
votes
1answer
78 views

Thread and RandomReal

I am trying to use Thread to apply a function involving RandomReal but it does not work as I expected. If I have the function <...
5
votes
1answer
84 views

How do you take position “x” in multiple sublists to make a new list?

this is a rather rudimentary question, but I was wondering if there are more efficient ways to do the following: dd = {{{12, 3, 5}, {14, 10, 11}}, {{15, 76, 65}}} ...
4
votes
3answers
88 views

How do you reorder a sublist of strings, within a list?

I have a list that looks like this: ...
1
vote
1answer
36 views

Precisión of the numbers inside a list

I'm trying to become a List like this list={1.34,2.64,5.098,6.432} in a list where the numbers have precision of one digit, like this ...
0
votes
1answer
59 views

How do we list all points in the Middle $3/7$-th Cantor Set?

Suppose we were to list all points in the $3/7$th Middle Cantor set where we first remove $3/7$th of $[0,1]$: $$[0,1/7]\cup[2/7,3/7]\cup[4/7,5/7]\cup[6/7,1]$$ then $3/7$th of remaining intervals, $3/7$...
5
votes
3answers
354 views

How to classify an ordered ascending {0, 5, 5, 10, 19, 22, 23} into several classes {{0,9},{10,19}, …}?

I attempted to classify an increasingly ordered list into several classes to make frequency distribution table. I am faced with a difficulty to nest two pure functions: one for ...
2
votes
2answers
109 views

How to program a situation like the following in mathematics and generalize the process to other configurations?

Distribute the numbers from 1 to 10(view image) so that the sum of each row and each column is the same and a) the maximum possible b) the minimum possible (I put it from 1 to 10 for ease) I know it ...
3
votes
4answers
161 views

Operation on the first element of list only

If I have the following list: ...
4
votes
4answers
326 views

How to find the smallest position of an element of an ascending list {1,4,10,12,20} such that the element is not less than 11?

Assume I have an ordered, ascending list {1,4,10,12,20}. I want to find the smallest position of an element of the list such that the element is not less than 11? ...
4
votes
2answers
83 views

Selecting elements of a list based on specific elements of their sublist

I have the following list ...
3
votes
1answer
65 views

How can I iteratively add elements to a list

Basically I want to make a histogram with a list of dates by using DateHistogram[]. However I have the data of the dates in nested list format, with elements like ...

1
2 3 4 5
129