# Tagged Questions

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

460 views

### Replacing values above a threshold with 1 [duplicate]

I have a list with some values and I want to replace a value which is greater than 1 with 1 otherwise keep the value. In this case 10562: ...
332 views

### LengthWhile until first duplication

I have the need to trim each of a large number of potentially very long lists (10^6+ elements) to the length where the last occurrence of any distinct element happens, or said another way, where the ...
107 views

### Experiment with TagSetDelayed involving Part

Reading Associating Definitions With Different Symbols, I was intrigued by this: You can think of upvalues as a way to implement certain aspects of object-oriented programming. A symbol like ...
2k views

### How to select all elements above the main diagonal of matrix?

How to select all elements above the main diagonal of matrix? I need to create a list of them.
157 views

### Elegant way to rearrange year/date table into time series/values

I often have data in the form of YEAR JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 1950 -1.022 -1.146 -1.289 -1.058 -1.419 -1.36 -1.334 -1.05 -0.578 -0.395 -1.151 -1.248 1951 ...
200 views

### How can I thread lists of different sizes?

What I need is the equivalent of Maple's zip(+, A, B, 0). Sure I can get it with: ...
491 views

### Selecting every last element of a nested list

I couldn't find a similar question so I decided to ask this one. I have a nested list with many sublists of equal length. To make things easier let's say it's like that: ...
3k views

### Semi prime numbers

The high school textbook I am using has the example of semi-prime numbers. They wanted students to find (by "perspiration") all the semi-prime numbers less than $50$ (for a question on set theory). ...
221 views

### Intersection does not take list of lists

The function Intersection takes a number of lists (sets) and finds their intersection. However, the precise input is ...
360 views

### Sorting lists element by element [duplicate]

I have a problem regarding list sorting. Let's say I have a list of lists obtained using Subsets[], of the form ...
293 views

### Specifying an array that may have an unknown number of entries [duplicate]

Say I'm running some process of unknown duration, and during the process, I need to periodically record the state of some variable. If we knew exactly how long the process took, we could simply ...
393 views

### Fast method for combining two lists

I have two lists, v1 and v2. Each element of the lists may be positive or negative. I want to create a list ...
455 views

### How to replace plus sign by comma

I want to replace plus by comma and the order of numbers in the list should be in increasing order. Example: a1 + a10 + a11 + a13 + a2 + a27 + a28 In this ...
100 views

### Evaluating the tensor product many times for a given list

I need to evaluate the tensor product 10 times in a given list( {g,e,r}) Here I have evaluated for 3 times... ...
9k views

### Table - find index of the maximum element [duplicate]

Let's suppose that I have table t = {1.23, 3.4, 10, 34, 1.78, 0.98, 12.56}. To take the biggest element I can use Max[t] ...
1k views

### ListPlot doesn't shows all points [closed]

I have a table: p1 = Table[(Binomial[2000, k]*StirlingS2[1386, k]*k!)/(2000^1386), {k, 1, 1386, 1}]; I used ListPlot[p1] ...
232 views

### Counting instances where the two identical characters are at the same positions in two strings

Let $s_a$ and $s_b$ be two strings over a $q$-ary alphabet. For each character $(c_1,...c_q)$ in the alphabet, I'd like to return a pair of values $(r,k)$ where $r$ represents the count for the ...