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

learn more… | top users | synonyms (4)

5
votes
2answers
73 views

Nested permutations

I would like to compute all "nested permutations" (not sure if it's the right term) of a list consisting of simple elements (numbers, strings) and simple sublists (level 1 lists of simple elements). ...
0
votes
3answers
74 views

Identify a scalar, a list

I have a symbolic scalar m2 and a symbolic list (representing a 3x3 matrix) A. I want a function which does something like: ...
0
votes
1answer
39 views

How to delete some elements from a list? [duplicate]

This question is asked quite often but none of the answers I found seem to do what I want. I have a list ...
3
votes
5answers
296 views

Function involving For loop

I've written the following function (the code includes the output): ...
6
votes
1answer
95 views

Split list into overlapping sublists

I would like to split a list into overlapping sublists! I want to generate a first sublist with a specified number of elements. Then I want to shift one element to the right and generate an ...
1
vote
0answers
52 views

Compile a listable function to be applied over list of lists [closed]

Consider a simple function g[x_,y_,z_] := x + y + z; (indeed, any multivariate function g will illustrate the same thing). ...
1
vote
1answer
101 views

Bin a large matrix

I have a large dataset and I'm trying to plot its scatterplot as well as an overlayed set of binned "summary" data points (in a different color of course). My intended effect is similar to this one ...
0
votes
1answer
245 views

Making table and plotting results of NDSolve problem

I am trying to solve two equation to find /[Phi][x] and plot h vs. /[Phi][x] for different values of L.I tried by writing as: ...
0
votes
1answer
40 views

Could I use Select with condition on any column other than First (Last)? [closed]

I often deal with huge tables of various functions of randomly generated values for my research. Sometimes there's need to only keep rows which satisfy a specific condition. This is easy with ...
8
votes
3answers
299 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 ...
1
vote
1answer
89 views

Factor terms by kets

I have an expression that contains several kets with numerical factors. I would like to retrieve the individual kets and store each individually as a list element. The expression is as follows: ...
1
vote
1answer
37 views

Selecting last partition in integer partition [closed]

I want to get the last partition from an integer partition. For example: IntegerPartitions[8, {3}] ...
5
votes
4answers
168 views

How to find the right permutation, which fits to the problem?

I'm new here and I hope I can find some help. I'm from Germany, so sorry for my English. I look for a number, whose digits are all different. It isn't known how many digits it has. But there is a ...
1
vote
2answers
116 views

Doing same operation on multiple files

Is there a way in mathematica to do same operation on multiple files at once? And preferably have the output in a table or list form? I want to do the following operation preferably in few non-labor ...
1
vote
4answers
5k views

Creating a data1 versus data2 plot?

I have a table of data with multiple rows and columns, and I have to make a versus data table using two of these columns. Essentially, I have to set one column of data (column 3) as the y-axis and ...
26
votes
6answers
1k views

How to understand the usage of Inner and Outer figuratively?

Description: In Mathematica the functions like Thread, Inner, Outer etc. are very important ...
0
votes
1answer
63 views

Extract all elements of an expression in order into a list [closed]

I have and expression a + b + c - d and I would like to generate a list of {a, +, b, +, c, -, d}. I have tried ...
1
vote
1answer
92 views

Summation over list elements

As we know, one of the simplest way to do a summation (with special intervals) over list elements is using Sum[list[[i]], {i, 3, 8, 2 }] (*with steps of 2*) for ...
4
votes
1answer
102 views

How to transform a list (of sums) into list of summands

Suppose you have the list list={a,Sin[b+c],d+c}. What I want is to transform all elements of list with head ...
12
votes
7answers
3k views

extract values from replacement list

Solve returns a list of replacement rules In: Solve[x + y == 3 && x - y == 6, {x, y}] Out: {{x -> 9/2, y -> -(3/2)}} I am only interested in the ...
9
votes
4answers
159 views

Faster position-based duplicate removal in a ragged array?

Take a ragged 2D array: rArray={{4, 2, 1, 0}, {2, 2}, {0, 0, 3, 3, 3}, {4, 0}, {3, 4}} I need to "deduplicate" this, where a duplicate is any element of a ...
8
votes
3answers
301 views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...
9
votes
4answers
1k views

Ways to compute inner products of tensors

One way to evaluate the following sums is combining Table and Sum: $u_{abcd} = \sum_{e=1}^3 v_{aeb}w_{ced}$ $q_{ab} = \sum_{d,e=1}^3 v_{d e a}w_{deb}$ It will look like ...
0
votes
1answer
46 views

Eigenvalues and Eigenvectors Order [duplicate]

Say I have a list of eigenvalues and eigenvectors produced from a matrix $M$ using the command {eig1,eig2}=Eigensystem[M], which will return the eigenvalues with ...
2
votes
1answer
48 views

3D-Plot of a list of complex numbers and a list of real numbers

I'm a newcomer to Mathematica, and I'm having trouble with the following question. Say we have a list of complex numbers list1 and a list of real numbers ...
0
votes
4answers
80 views

Cases vs Select, Pattern vs Pure function [duplicate]

What is the difference between having Cases with selection condition presented by pattern and a with pure function as condition? ...
3
votes
1answer
95 views

Recursive list contruction

I am attempting to implement the exercises from The Little Schemer in Mathematica, and running to a bit of a challenge with rember (remove member). Given a list and a value, the function just returns ...
6
votes
5answers
156 views

Removing elements from a nested list based on their global count

I have a very large table containing sublists, such as for instance: {{1, 2, 3}, {4, 5, 6, 7}, {1}, {1, 8}, {9, 10}, {11, 6, 12, 13, 14, 15, 16}} I want to ...
2
votes
3answers
88 views

How to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?

I am using Mathematica version 9.0 and am trying to compare and remove x-coordinates, and the associated y-coordinate, that are less than previous x-coordinates. Below is an example using sample data. ...
2
votes
1answer
340 views

Derivatives of list elements

Bug introduced in 8.0.0 and fixed in 9.0.0 Could someone explain the odd behavior of the Derivative function when drawing arguments from lists? We have, ...
11
votes
1answer
585 views

When to use @@@ vs. /@ [duplicate]

So much thanks to Szabolcs in improving sequence.. for complete explanation. I am so glad to read all explanation which fundamentally remove the problem. But in number 4 of its explanation pointed to ...
5
votes
2answers
219 views

delete zero rows in a matrix

If there is a matrix with some of its rows equal to zero: (its zero rows are randomly distributed and does not have an ordered arrangement): same as: ...
1
vote
2answers
192 views

Check RUT (Rol Único Tributario) for numbers over 7 digits

In Chile the RUT (Rol Único Tributario) is a national identification number. Every RUT has a check digit modulo 11. The RUT has 7 or 8 digits plus a check digit or letter. I made this code that works ...
1
vote
1answer
47 views

Adding up a list of subscripted elements [closed]

I have a list of entries with subscripts. I want to add just the entries. How can I do that in the presence of subscripts? For example: list = {1a, 2b, 3c} And ...
6
votes
7answers
348 views

Convert array from {{…}} to “[[…]]”

I have made this function: conv01 = Map["["<>StringJoin@@Riffle[#,","]<>"]"&,Map[ToString,#,{2}],{0,1}]& to convert: ...
2
votes
1answer
61 views

Replace parts of nested lists

I have list of stock data as follows: lis1= {{{1992/10/12, 126.946, AEX}, {1992/10/13, 127.85, AEX}}, {{1992/10/12, 88.487, AFLI},{1992/10/13, 91.825, AFLI}}} ...
1
vote
1answer
38 views

Deleting duplicates of plus or minus symbolic quantities from a list [closed]

Let's say I have a list l = {a + bc - d, -a - bc + d, a + b};. Now I want to apply DeleteDuplicates[l, crit] to this list, such ...
1
vote
0answers
44 views

Transform a vector DE into a set of scalar DEs [closed]

I have the vector equality: {{a,b},{c,d}}.D[{x1[t],x2[t]},t]=={{e,f},{g,h}}.{u1[t],u2[t]} I want to solve this using DSolve. ...
3
votes
1answer
47 views

Saving Dot-ed eigenvectors in a special comparison

We have produced a 4*4 matrix in any iteration containing nx from 0 to 2 by steps of 0.5. and in any iteration we have saved sorted orthogonalized-eigenvectors based on their eigenvalues with this ...
5
votes
2answers
143 views

Displaying a list of percentage values according to their classification

I have a list of percentages as follows: percent = {21.15, 42.3, 57.68, 73.06, 84.6, 90.37, 96.14, 99.99, 99.99, 99.99, 99.99} I want to classify these ...
3
votes
3answers
499 views

Efficiently compute double sum

Is there a "Mathematica Way", like Map or Apply to compute the following double sum? $\sum_{i=1}^{N_1}\sum_{j=1}^{N_2} m_i n_j \, f(\tau_{i} \gamma_{j})$ I have already stored the lists ...
3
votes
4answers
197 views

Trouble with Position[] [duplicate]

I am in trouble with Position, Although my example works as expected it throws a warning. Position[{{a,b},{a,c},{a,b}}, _?(#[[2]]==b&), {1}] During ...
0
votes
2answers
45 views

“Part specification is longer than depth” warning in Position function [duplicate]

I'm working on a project which analyzes financial data. I download the price and dividend information for the SPY ETF which tracks the S&P 500: ...
2
votes
1answer
112 views

Dirichlet convolution of two lists [closed]

The Dirichlet convolution of two arithmetic functions f,g is defined by $f\ast g(n) = \sum\limits_{d|n} f(d)\ast g(n/d)$ How can I get the Dirichlet convolution of two lists? For example: Input: ...
2
votes
2answers
148 views

Efficient List of Lists

I'm running some analysis that requires the creation, row by row, of a large list of lists. The big list is called "Nodes" and it will ultimately contain hundreds of thousands of rows. The first few ...
1
vote
2answers
68 views

How to find the same number in sublists of list

Intersection[Table[Table[Sqrt[p1]/r1,{r1,0.1,0.7,0.1}],{p1,0.5,5,0.5}]] I am trying to find same numbers in the sublists. But Intersection is not working for ...
1
vote
1answer
57 views

calculate relationship between cause and effect (rows/columns/delta etc.) on tableform

I tried to enter this Excel (on the right of the picture) information to program. following these codes has been used: ...