# Tagged Questions

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

142 views

### Creating a single three-dimensional array from imported data

I'll preface this by saying that I'm not a Mathematica veteran - I'm a chemist who is trying to find a way to import time-dependent spectral data in a usable form. I have figured out how to import the ...
148 views

### Remove pieces of a text file

I have imported a text file as a Table with testpbkg = Import["unweighted_events.lhe", "Table"] The file looks like this. I want just to select the text ...
199 views

### Operations in nested lists

New to Mathematica, I have a nested list containing many lists(A) of 16 lists(B) of 3 integers(C). I wish to put in each (Aj, Bi, C2) the result of (Aj, Bi-1, C2)+(Aj, Bi, C1). I could do it with a ...
46 views

### How to apply a piecewise function to a list? [closed]

I have created this code: xn = {4, -4, 4, -4} f[x_] = Piecewise[{{Sqrt[x], x >= 0}, {Sqrt[-x], x < 0}}] f[xn] With this code I would expect as a result: ...
2k views

### How to avoid procedural loops in this example?

I want to iterate over a list, and return the index as long as I found the first element satisfying my condition. Written in a for loop: ...
291 views

### Adding data to an existing list

I have list: {{a, b}, {c, d}, {e, f}} What is the most simple (but automated) way to add this data to the list? ...
39 views

### Combination of Values: Automated generation [closed]

How can I get a list of combinations for two values (e.g. 0 and a) such as for N=3: {{a,a,a},{a,a,0},{a,0,a},{0,a,a},{a,0,0},{0,a,0},{0,0,a},{0,0,0}} ? I'd like ...
47 views

### Finding Nearest Element to a line in a 2 dimensional Array

so i have a 2-dimensional list of data of x and y coordinates. I am looking for a way to get the element of the list which has the closest y value to a given y value. I tried using Nearest but this ...
24 views

### Why Inner doesn't work with Dot/List? [duplicate]

The recent question about generalizing Dot for list of matrices had a nice solution/comment using Inner. Briefly, we have 6 ...
633 views

### Understanding Transpose

It is very likely that it is my lack of math skills that is showing up here. However, I think Transpose is such an important function that I need to master it. So I ...
41 views

### Simple list manipulation [closed]

I have two lists: {1,2,3} and {a,b,c} and I want this result: {{1,a},{2,b},{3,c}}. What is the right command? How does one call such an operation?
459 views

### Easiest way to extract the coefficient of a polynomial

For a term in a polynomial, say 387 a1^4 a2^3 x^3 y^7 z^100 w^364 what is the most efficient way to extract the coefficient of this term, i.e. ...
233 views

### Generating a vector basis

I have several lists parameterizing a vector space, for instance {a[1],a[2],a[1]+2 a[2]-a[3]} For each list I want to generate a basis such as ...
62 views

### Replace part on string in list

I have a list with string and integers and want to replace one word in the string with an integer. For Example if I have ...
52 views

### (Cartesian product) How to get the coordinate of points while each coordinate of each axis is known? [duplicate]

For example, I have data like this: m = {{1,2,3},{4,5,6}} It means 1,2,3 are available x position, 4,5,6 are available y position. The question is, how to get ...
471 views

### Element-wise test on List elements

This question could sound pretty silly but I can't find a way to apply element -wise tests to a list. For example if I digit ...
34 views

### How-to set item background color based on criteria? [closed]

Description After carrying out some computation and establishing a set of data, I would like to tablularise data and highlight values which do not meet acceptable treshold. A similar question has ...
32 views

### Map a list of functions to a number [duplicate]

Suppose I have a list of functions like: listfun = { Sin, Cos, Tan } And suppose I want to map listfun to a single number <...
60 views

### Generating matrix of distances between points in cylindrical coordinates

I am working on an analytical model for the sound intensity generated from a vibrating cylinder. Part of this work requires me to split the cylinder up into a number of elements, with the more ...
3k views

### Get the coordinates from ContourPlot and RegionPlot

How do I get the coordinates from a contour plot I've done in Mathematica? For example, I have a two-variable function f[x, y], for which I can make a contour plot: ...
555 views

### Creating overlapped block matrices

I'm doing an FEM assignment using Mathematica. (EK1 = {{a11, a12}, {a21, a22}}) // MatrixForm (EK2 = {{b22, b23}, {b32, b33}}) // MatrixForm I don't know how ...
914 views

### Permutations[Range[12]] produces an error instead of a list

This input: Permutations[Range[12]] Results in this (error) output: ...
56 views

### How to Set Priority Between Longest and Shortest [closed]

As is shown in this post's answer, it seems that though you can set priority of Longest (or Shortest) by ...
57 views

### Time series of a point using ImageFeatureTrack

This question regards tracking, however it is more about writing efficiency in mathematica compared to other programming softwares. I get the tracking of a point between two movie frames by: ...
37 views

### Removing every member of a list from another list [duplicate]

I have a list of lists A={{1,2},{3,6},{7,8},{5,0}}, and another list of lists B={{1,2},{5,0}}. If any list in B is also in A, I want to remove them from A. E.g.,Taking {1,2} and {5,0} out of A to get ...
234 views

### Solve and design “water flow”

In some strategy game I play, I'll have to change the terrain to make the water flow in some specific way to fulfill my goal. The water flow changes with terrain so if I can change the terrain wisely ...
598 views

### Mysterious behaviour of Pick

As everyone knows, Pick can do amazing things, The most fascinating phenomenon is that it can pick though all sorts of lists: The basic & pattern matching: <...
81 views

### Longest and Shortest won't work in ReplaceList?

I'm trying to make a pattern that's easy to preceive by human but hard to write out by Mathematica when I came across this problem. (Check the original problem here) Let's check this simple case: I'...
117 views

### How to Find out the Recurring Period by Pattern Matching?

Note: It's not hard to solve this problem AT ALL, so please, try to explain how to use PATTERN MATCHING instead of how to find out the recurring period. We can easily extract real digits from a ...
41 views

### Diagonal part of product of matrices

I am trying to find the best way to compute only the diagonal part of a product of two (or three) matrices. I tried two different approaches: computing the standard matrix product and then extracting ...
332 views

### Maximum brightness of two gray scale images

I am using the answer of bill s in Greater operator should give greater element. Here he showed the example: ...
55 views

### Export list entries under a certain condition without using loops

I have a big list that contains many 3D- chains (set of points) and for each of them a polynomial. So the structure of my list is for example ...
283 views

### Finding the position of a specific value in a list

Is it possible to easily find the position of a specific value in a list? For example, if the list is {{x1,y1},{x2,y2},...,{xn,yn}} I would like to know the ...
587 views

### Replace a column in table with a list of numbers?

I have a Table of values e.g. {{x,y,z},{x,y,z},{x,y,z}…} How do I replace the the "z" column with a List of values?
42 views

### More efficient way of filling in a specific entry in a list of lists [duplicate]

"coords" is a list of coordinates in the 2D plane ordered in a specific way, with the 3rd (z-axis) positions left empty to be filled in with specific values, like temperature or concentration at the ...
57 views

### Random Matrix with criteria

I want to construct $k$ lists $M$ of positions $(i,j)$ for a matrix $X$ of size $n\times m$, where all entries are "painted" with "white" color. The distribution of such a list $M$ must obey the ...
70 views

### How to Replace Plot Slot Numbers With Variable Names

The format of my data looks like: ...
58 views

### How to transform the $y$ values in a list of $(x,y)$ pairs [duplicate]

How can I transform data = {{1, 0}, {0, 1}, {1, 1}} to {{1, f[0]}, {0, f[1]}, {1, f[1]}} This is similar to ...
41 views

### output has a term uncomputed

I am trying to sum the all numbers in each row of matrix and divide them by the max value of the row. My output has the following terms that has not been computed yet (example, the second element in ...
67 views

### How to do abstract matrix operation?

In this simple example, I have 2 lists, each of which contains 3 matrices。 $J$ here is also a matrix with the same dimension. What I want is $aJc+bJ(b+c)$, but if I use dot product, the result is as ...
164 views

### Selecting points inside a closed curve

Let's create a rather dense grid of initial conditions ...
1k views

### Filtering beat-to-beat heart rate data

From an experiment, I have a dataset of beat-to-beat heart rate data: a list of the time between each heart beat in [ms]. The data is measured using an infrared optic sensor at the finger tip. The ...
69 views

### Selecting the maximum value from the results returned by NSolve

I'm trying to select the maximum value from the answers Mathematica 7.0 is getting from a simple basic NSolve algebric equation : ...
124 views

### How to make a table from two lists?

I have two lists. ...
31 views

### How to pair elements of a nestlist? [duplicate]

I have a this list for example expdata={{49, 50, 51, 52, 53, 54},{0,3,5,2,0,1}} and I want to rearrange it like this ...
528 views

### another way to do this mapping of a two argument function

Sorry, I'm just starting to learn mathematica. I have the following two-argument function: h[{x_, y_}] := x ^ y When I do the following: ...
91 views

### Python Convolve2D functionality in Mathematica

I am new to mathematica. I am looking for an alternative for scipy.signal.convolve2d. I did find functions like ListConvolve, ...
60 views

### Henon Map Equation Trekker

I am trying to make an Equation Trekker for the Henon map in the following way: ...
I want to get the difference of all elements of a list for example: $L=\{1,2,3,4,5,6\}$ for any $i$ and $j$ $\in L$ return the differences, for example for the first element $1$ we get the difference ...