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

learn more… | top users | synonyms (3)

1
vote
1answer
81 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 ...
6
votes
7answers
1k 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.
2
votes
2answers
109 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 ...
2
votes
2answers
154 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: ...
1
vote
1answer
144 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: ...
10
votes
4answers
2k 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). ...
2
votes
1answer
75 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 ...
1
vote
2answers
136 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 ...
0
votes
2answers
91 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 ...
4
votes
3answers
332 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 ...
2
votes
7answers
285 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 ...
1
vote
1answer
50 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... ...
0
votes
1answer
984 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] ...
1
vote
1answer
247 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] ...
2
votes
3answers
137 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 ...
0
votes
1answer
42 views

Error about limit MaxExtraPrecision

After my evaluations I have an error: N::meprec: Internal precision limit $MaxExtraPrecision=50. reached while evaluating ... ...
7
votes
6answers
229 views

Faster list duplicate 'limiter'

Given some list, e.g., {5, 3, 2, 3, 1, 0, 1, 3, 5, 5, 4, 5, 1, 2, 5, 2, 2, 0, 1, 4}, I need to limit the duplicates, if any, to an arbitrarily chosen number. The ...
2
votes
1answer
113 views

Select repeating cluster of numbers [closed]

I have a list with measured data. There are multiple measurements in the list, but each measurement requires some time to find its equilibrium. I'd like to know the positions of the equilibria, but ...
1
vote
2answers
66 views

Choosing a position in an array with uniform random probability conditioned on it having a specific element

I have an array exArray with two types of integer elements: 1 and 2. I'd like to choose a ...
2
votes
2answers
58 views

Specifying an array with a specific number of copies of two elements

To specify an array of length L in Mathematica, where each entry is someElement, I'm accustomed to writing: ...
0
votes
0answers
16 views

logarithmic distribution of a range in fixed number of elements [duplicate]

I want to distribute a range between 4 to 93 in 50 numbers which are logarithmically distributed. How I can do this in mathematica?
7
votes
5answers
274 views

Find positions of duplicates that are neighbours

Assuming the following list {1,2,3,3,5,6,3} I would like to get the position of values that are next to each other and are duplicates. That is, the output should be {3,4}. Thank you for any help. ...
7
votes
3answers
255 views

When does a list contain only ones?

I am starting with a list of length n that contains all -1's. For instance, when n = 6 the list is {-1, -1, -1, -1, -1, -1}. I ...
13
votes
4answers
1k views

Moving maximum function?

How can I construct a moving maximum function? For example, if I have a list of 12 values: { 5, 6, 9, 3, 2, 6, 7, 8, 1, 1, 4, 7 } and I want to maximize over 3 ...
1
vote
3answers
155 views

Distinguishing slots in a function mapping Position across a list

Suppose that I have a list myList that has more than one level. Here is an example of such a "data structure": ...
2
votes
3answers
118 views

Quickly plotting (number of events) vs. (time) for a very large number of events encoded as pairs of real numbers representing start and end times

I have an array that looks like the following: exampleArray = {{t1,r1},{t2,r2},{t3,r3},{t4,r4},{t5,r5},...}; Where each pair of real numbers $(t_k,r_k)$ ...
21
votes
5answers
502 views

More efficient way of generating list of occurrence counts?

Given a list, e.g., target = {a, b, c, b, c, d, c, d, e, f, a, h, g}, I want to generate a list containing the occurrence count of the corresponding element of the ...
0
votes
1answer
69 views

how to filter out numbers of specific type in a table

I am working with a way to generate a table of some numbers, but the one functions could return the complex numbers which I don't want. I am going to filter out the complex numbers. The only way I can ...
1
vote
2answers
107 views

How to create automatically some matrices for symbolic manipulation?

I want to create in an automatic way some matrices to do symbolic calculations with them. They look like these: $$ \left( \begin{array}{cccc} a & 0 & b & 0 \\ 0 & 1 & 0 & 0 ...
5
votes
4answers
826 views

Select a repeated element in a list

I want to select all elements that repeat 4 times in the list. I propose this code ...
1
vote
4answers
342 views

List manipulation: position & max value combination

Starting with {{0, 0, 0}, {1, 1, 2}, {2, 3, 3}, {3, 4, 5}} I would like to get {{0, 2, 3, 5}, {1, 3, 2, 3}} where the ...
1
vote
1answer
135 views

MapThread multiple functions onto multiple lists

I'm trying to learn the functional style which seems to prevail in Mathematica. I'm having trouble accomplishing the following: Let's say I have multiple lists of arbitrary data (using two lists ...
5
votes
5answers
404 views

Counting 'False' values at the ends of a list

I have table like this: t = {False, False, False, 4.5, 6.789, 1.23, 0.98, False, False} and I want to know how many False values I have at the beginning and at ...
0
votes
1answer
70 views

Why Solve won't work for user-defined function, used for system solving? [closed]

I have a list of x-es, that I transform into a list of tx-es. Also tao is my user-defined function that I don't know the parameters of, but I do know the values I get when I put the tx-es in it. And ...
0
votes
1answer
121 views

Using DeleteCases with multiple AstronomicalData properties

I am attempting to use AstronomicalData and DeleteCases together to remove invalid cases of two properties while listing the ...
1
vote
2answers
112 views

Computing lists using AstronomicalData

Edit: Initially in my question I asked how I could search the database of AstronomicalData["Exoplanets"] and return 2 filtered values that only contained valued ...
0
votes
2answers
100 views

Associate the elements of a table

I have a table form as: table = {{a, 6}, {b, ff}, {c, 2}} I want to associate the first element of each pair from the table to the second element of the pair as ...
0
votes
0answers
55 views

analysing data with MLF using (Oracle) Database connection

I'm testing the MLF package in Mathematica for datamining purpose. I start the databaseconnectivity with the following code: ...
0
votes
0answers
25 views

Threading a single abscissa through a list of ordinates [duplicate]

Suppose that I have the following list, called list. list contains elements X, ...
0
votes
2answers
101 views

Delete False values from a list [closed]

I have table: t = {False, False, False, a <= 456, a <=567, a<= 897} I want to delete all values which are 'False' and make my table to looks like: ...
0
votes
2answers
71 views

How can I make my output to be added to an existing list?

v = {{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 1, 1}, {1, 1, 1}} For[i = 1, i < 6, i++, For[e = 1, e < 6, e++ 1, Print[Mod[v[[i]] + v[[e]], 2]] ]] I ...
1
vote
1answer
62 views

Testing a List inside of an Table if it is != 0 [duplicate]

I'm new to mathematica so I hope this is not a too stupid question, but I couldn't find a solution in the mathematica documentation. I've got a normal table, initialized with "0" as entries. In the ...
2
votes
2answers
261 views

How to plot several functions without jumping? (multiple eigenvalues of a system as functions of 2 parameters)

I've been working on this research problem for months with some success by no global/proper solution to the problem. So I have square, Hermitian matrices of various sizes ($8,20,38$ dimensions) with ...
0
votes
2answers
84 views

What's wrong with my use of Do? [closed]

My code is: Do[Print[number[[i ;; (i + 4)]]], {i, number}]. The variable number here is a list consisting of 1000 digits. My ...
0
votes
0answers
85 views

Select {x,y} pairs from a list where x conforms to a rule [duplicate]

I'm working on some pet project and I have a very large list of {x,y} pairs. I want to make a new list containing all {x,y} pairs where x is, let's say, even (I actually need something more ...
3
votes
2answers
156 views

Finding positions of multiple elements in lists

I realise that Position[{2, 4, 8, 16, 32, 64}, 4] will return {{2}} I would like to do something like this: ...
1
vote
1answer
88 views

How to convert each pair of { and } into ( and )? [duplicate]

I am a learn-by-example person. I have no idea to change every { and } to ( and ...
1
vote
1answer
168 views

How to convert the following list into a LaTeX table?

How to convert the output of the following code In[43]:= Func[x_]:=Select[Range[x],Total[IntegerDigits[#]^3]==#&]; Func[1000] which is Out[44]= ...
10
votes
10answers
611 views

Finding neighbors from list

Say you are given the following list: list={{3, 2, 1}, {3, 4, 2}, {2, 4, 1}, {1, 4, 3}}; Two numbers $x,y$, not necessarily distinct, are neighbors if one of the ...
10
votes
3answers
326 views

Zero-dimensional matrices

In a recent Mathematica project, $(n \times 0)$- and $(0 \times n)$-dimensional matrices have suddenly become a frustratingly common edge case for me. For instance, consider the following two ...