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
0
votes
0answers
11 views

Assigning a Part[;;,x] function to a symbol resets said symbol's assignments

My function takes a 128x128 list which contains some values in every entry, maps on it a Cartesian coordinate sytem which assigns every entry x-y-coordinates and afterwards also gives every entry the ...
1
vote
3answers
81 views

Make uniform grid around a specific point

I have a point (0.128531, 0.0765588) on xy plane where the range of x is {-0.678525, 0.678525} and the range of y is {0, 0.678525}. I want to make a uniform grid including the point in its center (let’...
0
votes
0answers
37 views

How to replace x in an expression by array of numerical data?

I have an expression which looks something like this (except a lot more complicated) y = c0 h0[x] + c1 h0'[x] + ... + c4 h0'[x]. It is up to fourth derivative of <...
2
votes
1answer
35 views

Export to Excel with empty cells as dilimiters

I would like to combine some pieces of data and export the data to Excel, but I need to insert some empty cells between pieces of data as the delimiter. For example, I have two lists ...
1
vote
0answers
21 views

Holding and dragging mouse to select multiple buttons/cells

Is it possible to create a TogglerBar-type object in which several buttons can be selected/deselected simply by holding the mouse's left-click button and dragging ...
2
votes
1answer
79 views

Selecting Edges and Corners in a Mesh

Consider the following VoronoiMesh obtained after a few iterations of Lloyd's relaxation algorithm ...
8
votes
1answer
315 views

Apply a List of Arguments to a List of Functions

Happy new year, everyone! I hope this is a good one. The title doesn't really express well what I want to do, however, please see further explenation below. Say, I have a list of functions ...
5
votes
2answers
89 views

Specifying range in RandomReal

Is it possible to define the specific range of a RandomReal array for each coordinate? For example, the code ...
0
votes
0answers
39 views

How to get Zero in SequenceCases [closed]

SequenceCases[{a, b, b, a, b, b, b}, {p : Repeated[b]} :> Length[{p}]] gives you {2, 3} How do I get a Zero output for <...
5
votes
2answers
436 views

Is there an idiomatic way to “merge by index” lists of the same length?

Consider listMerge[list1_, list2_] := Thread[({#1, #2}) &[list1, list2]] listMerge[{1,2,3}, {4,5,6}] (* {{1,4}, {2,5}, {3,6}} *) Is there a built-in function ...
1
vote
1answer
66 views

Automate Poisson Football Scores Prediction

I would like to automate a simple poisson football scores predictions process. I started by importing and cleaning home and away England League team tables data to work on it with Poisson ...
3
votes
1answer
35 views

Manipulate ListPlot a matrix [closed]

i am tring to plot a propagating wave function, but the instead of function i have points. so i have a n*n matrix (TTpsi) that i want to plot each row separately. The wave is "propagating" when the ...
5
votes
2answers
82 views

joining adjacent elements by rule

I have a list of strings: lis = {"a","1","c","ef","g","2"} and would like to join all adjacent non-numeric characters to produce: ...
1
vote
1answer
74 views

converting a raw string into a Mathematica list

I have a set of data consisting of daily measurements of two parameters. The data is available as a list of strings. Different parameters are measured each day. In the sample below, on January 1, a ...
4
votes
1answer
110 views
+100

How to combine a lists of two lists with a list of two lists of lists of varying length?

This is probably asked before but I don't know how to begin searching for it. Some context: I'm using TemporalData objects that share a number of common features ...
15
votes
3answers
575 views

VoronoiMesh as a TogglerBar

Is it possible to use a VoronoiMesh to define a TogglerBar or SetterBar type ...
3
votes
2answers
128 views

Switching from AppendTo to Speed up

I'm trying to speed up my Code, but I'm facing problems with changing the AppendTo section in my code with something "Faster". I've read through some other ...
1
vote
2answers
58 views

Keep important eigenvectors according to the important eigenvalues except one unimportant eigenvalue

I have an iteration whose steps extract a matrix with any possible dimension for example 3*3, 6*6, ...
5
votes
2answers
364 views

Using Table Recursively

I wonder if it's possible to create a list with Table from entries of the list itself. That is, as I'm creating the list, I append a new element as a function of ...
1
vote
1answer
29 views

Preserving the headings when exporting a table

I have the following SparseArray: ...
0
votes
1answer
17 views

Error messages generated in a table calculation prevent “good” elements of that table being accessed

If I make a batch fitting routine, something like: ...
16
votes
4answers
568 views

Avoiding zeros in ArrayReshape

Consider the list list={1,2,3,4,5,6,7,8} and imagine I wanted to change it to {{1,2,3},{4,5,6},{7,8}}. How can I do this? Using ...
0
votes
3answers
64 views

Converting local degree of freedom to global degree of freedom (Manipulating a list) [closed]

I want to convert the local connectivity matrix to the global one as follows. Consider two quad elements with connectivity {{1,2,3,4},{2,5,6,3}} Now let's say ...
3
votes
2answers
52 views

Deleting a Rule according to the first element [duplicate]

I have a list of rules. Among them, I want to delete those rules which have first elements already shown up earlier. Following is a working example. ...
0
votes
1answer
36 views

Sorting a list according to the position of elements

I have a list of elements, which I want to sort according to the even/odd numbered positions of elements. Basically creating two lists out of one, respectively having elements placed at even/odd ...
5
votes
2answers
112 views

How to find the all positions of first element and get the elements at once from the nested list?

I have two questions. Let's think the following expression. expr = {plus, {minus, 2, 3}, {times, 1, 2}} Q1 I want to get something like ...
9
votes
6answers
417 views

Reversing Grouped Lists

I apologise in advance if this is a duplicate. I have looked at this question, yet have been unable to figure out how to use it when it's not nested: Link. I have a grouped list of random words <...
0
votes
1answer
64 views

How to evaluate this sum inside a function [closed]

I have a function Vp[θ_list, d_] := -M g Lcm (Sum[Cos[θ[[i]]], {i, 1, Length[θ]}]) + Sum[H[i, j, θ, d], {j, 1, Length[θ]}, {i, 1, j - 1}]; where H is properly ...
8
votes
1answer
224 views

Determining moving ratios over a list

To know how fast values in a list approach 1 I tried #[[1]]/#[[2]] & /@ Partition[{5040, 1460, 280, 76, 16, 2, 1}, 2, 1] This works, but I seek a better ...
11
votes
4answers
274 views

What is the optimal way to create a recombined version of two lists?

I would like to randomly recombine two lists of the following form: l1 = {a,b,c,d,e,f} l2 = {1,2,3,4,5,6} Where their recombination is similar to that of DNA, so ...
2
votes
4answers
106 views

Convert a list of list of numbers into a matrix of 1s and 0s

I want to take a list of list of integers and convert them to a matrix of 0s and 1s where an element of the matrix is 1 if "the row is in the column". The row corresponds to an integer in the list and ...
3
votes
2answers
73 views

Finding all the binary bit strings of a given length

I am new to Mathematica, this forum and programming in general. I m trying to fulfill a given task. I want to write a function, which takes as input an positive integer, say $n$, and returns a table ...
9
votes
5answers
341 views

Simple way to group the list-indices of equal elements?

I am looking for a simple way to group the list-indices of equal elements of a list. Examples: ...
6
votes
2answers
136 views

Partition list overlapping into N sub-lists as evenly as possible

There are similar questions here I haven't seen one where the there is an overlap. The requirements: The result should be N sub lists with the overlap specified. There should be no dropped elements ...
7
votes
2answers
289 views

Change part of a list

I'm starting in Mathematica. I would like your help to solve the following question (which is really basic): Whenever the sequence 1, 2, 1 appears in a given list, I want to change this part of the ...
1
vote
1answer
37 views

Display indices of the list [closed]

data = List[RandomVariate[ExponentialDistribution[2], 200]] // Sort; list = List[Table[i, {i, 0, 200}]]; d2=Riffle[{data},{list}] Partition[d2,2] This gives me ...
1
vote
2answers
52 views

How can I multiply the elements of a list using loops?

{1,1,1,-2,1,2} How acn I multiply the elements in the list using loops?
6
votes
1answer
88 views

Combine list elements preceding a specific element

Consider the following list: {"END", "END", "a", "b", "END", "p", "q", "END", "t", "END"} I want to combine elements that precede the marker element ...
1
vote
0answers
33 views

Multiple Plot + array function [closed]

please I have two problems in my script in Mathematica. I have the following code (the part of it is): ...
3
votes
2answers
180 views

Applying Mod on list of list with outcomes +1, -1, other

I have a list lis = {{7, 8}, {17, 9}, {11, 10}, {12,10}} I want to apply Mod to each pair with output +1,-1 or ...
0
votes
1answer
70 views

Quick Wolfram Question [closed]

This is my code so far: For[i=2, i<10, i++, Solve[x^i == x+1 && x >0]] I would like to sum up all the x values that it outputs. How can I do so?
0
votes
3answers
53 views

Point manipulations to list form

I tend to do a lot of code the manual way, which doesn't work out for bigger data sets. I wanted to know if there were in built functions to do the following; ...
4
votes
4answers
238 views

Name a list with Table

I am struggling to find a way to assign a value from a list to names from another pre-defined list with Table[]. names = {first, second, third} ...
6
votes
1answer
113 views

Trying to find a better way to implement a recursive depth first search

I'm trying to implementa recursive depth first search. It works and the result is below: ...
5
votes
1answer
109 views

Best Practice: spending transactions to expense list

So lets say I have a list of spending transactions tlist = {{john,23},{bob,2},{john,7}...} and I want to have a list of the total expenses per person. I can do ...
7
votes
1answer
126 views

How to combine NDSolve interpolating functions?

In the following working example ...
0
votes
0answers
23 views
8
votes
5answers
242 views

DeleteCases for once only

I want to delete an array of elements from another one, DeleteCases seems to be an option, but the problem is that it deletes an element more than once if available,...
0
votes
1answer
37 views

How to map a list of entities into a function?

x = RandomChoice[CountryData[]] Here I have defined x to be a random country. ...
0
votes
0answers
53 views

How to apply command to all elements of a list?

So I generated a list of cities and I want to apply FindGeoLocation to all of them without having to seperate the elements and then applying. ...