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

learn more… | top users | synonyms (3)

1
vote
2answers
59 views

How to efficiently get a list like this?

I want a function myfun that generates list like this ...
10
votes
5answers
272 views

For a given expression: if it appears, remove it, but if it is absent, add it

While reformatting Szabolcs's code from (42660) I noticed this interesting operation: ...
3
votes
1answer
102 views

linear combination of successive elements in a list

Say I have a list $E$ and want to build a list $F$ with the entries $F_j=E_j-2E_{j-1}+E_{j-2}$. I know that this happens to be achievable by iterating the function ...
0
votes
1answer
49 views

Correcting a gap in ListPlot

This is a small sample of my data ...
0
votes
0answers
45 views

Generating a list of overlapping end coordinates [duplicate]

I'm a very new user to mathematica so this may be a silly question. i'm trying to evaluate some integral between end coordinates of some evenly spaced range. my range is defined by the number of ...
1
vote
1answer
48 views

How to delete more than one (specific) elements in a list

lst = {a, b, c} DeleteCases[lst, a] Delete one specific element a. How do I delete elements ...
3
votes
1answer
54 views

Converting path list to the nested list

I'm trying to convert the plain path list to the nested tree list like the following codes. ...
3
votes
3answers
218 views

Use map on a different level

I have just started to get used to Mathematica's Map, Apply, and related functions, and I can't figure out how to do maps that require working "one level down". For example, I am currently trying to ...
2
votes
2answers
133 views

How to apply # on different lists? [duplicate]

If I have list1 = {1, 2, 3, 4} list2 = {5, 6, 7, 8} How can I do so, that function[#1, #2] takes ...
4
votes
1answer
82 views

Parsing string with nested information

I am trying to parse a string, but I have no idea how to solve the following problem ...
2
votes
1answer
68 views

Filtering outliers [duplicate]

I have a question. My data is: ...
1
vote
1answer
86 views
4
votes
3answers
149 views

Selective threading of the Rule

How can I change form1 to form2 form1 {10000, 10004} -> {2, 2, 637} form2 ...
0
votes
0answers
71 views

How to accumulate elements in a list using Reap and Sow [duplicate]

Does anybody know how to rewrite this fragment using Reap and Sow instead of AppendTo. I need to reduce the execution time. Thank you. ...
4
votes
4answers
466 views

All binary sequences with length n

I don't know if there is a built-in function for this, but I'm thinking about something like this Outer[List, Table[{0,1},{n}] ] But ...
7
votes
4answers
275 views

Generalization to AllTrue, AnyTrue and NoneTrue

I am wondering if there is a natural Mathematica way to generalize those functions. To be specific, All three functions AllTrue, ...
1
vote
2answers
99 views

Plot a bunch of lines in 3D from point data

I have a 12*25 array, wherein each entry is of the form $\{x,y,z\}$. So 12 different $x$ values, 25 different $y$ values and 12*15 $z$ values in all. I'd like to plot 12 curves of various $x$ values ...
1
vote
2answers
58 views

Incomplete Parallel Mapping

I am still struggling on how to nicely handle list operations in Mathematica, and perform simultaneously parallel computation. We consider a tab of the form ...
9
votes
6answers
490 views

The longest run of at most k different elements in a list

I have a long list with ca. 500K elements. The list contains about 10K different elements. For simplicity let’s assume the list is of the following form: ...
3
votes
1answer
132 views

Calculate efficiently an expensive hermitian matrix

I want to compute a matrix $M_{pq}$, for which the calculation of each coefficients $M_{pq} = f(p,q)$ is an expensive function. I know that my matrix is hermitian, so that $M_{qp} = M_{pq}^{*}$. As a ...
4
votes
2answers
142 views

Finding the Position of the Minimum Neighbor for Each Element in a Large Matrix

I have a large matrix ($6020\times 8452$), and I want to create a new matrix where the relative position of the minimum neighbor is each element in the matrix. For example, if I had the matrix ...
2
votes
1answer
98 views

How get repeated elements from two lists

How to write a code that takes an certain element related to a given subset in a LIST 2, that occurs also in a LIST 1? for example, there are two lists: ...
1
vote
1answer
47 views

Compute the evolution of percentages from a data file

My data is stored in external .out files which contain six columns and a large number of rows. I know that I have to provide a small sample but the structure of my data is so unique, so I provide the ...
4
votes
2answers
182 views

Generate lists that satisfy a condition in an efficient way

The following code produces lists of sublists with maximum length 5 that shuffle zeros around an ordered list (here {1,2}). It produces all permutations while ...
2
votes
2answers
121 views

How to produce a table with column and row headers included?

I have searched and have not found a solution. n = Table[i^2 + j*3, {i, 3}, {j, 7}] // TableForm Export["stuck.xls", n] ...
0
votes
1answer
51 views

How to split (large) arrays like this?

I want to split this table (list/array) ...
0
votes
1answer
78 views

Extracting parts of a list subject to a condition

I've got a list like following: ...
1
vote
1answer
27 views

Select equation in a list of conditions

I have an equation list {a'[t]==b[t],c'[t]==d[t],x'[t]==y[t]} and upon running FullSimplify[] it becomes ...
0
votes
1answer
44 views

convert list to equation form

Suppose I have a list condition={f'[t]-3,g'[t]-f[t]} and now I want to use DSolve on it so I need to convert the list to ...
5
votes
2answers
103 views

How to use Manipulate to cycle through a list of lists over a function

So I can do something like this which I like: Manipulate[i, {i, {1,2,3,4}}] It lets me pick which specific values I want to allow to be chosen for my function. ...
1
vote
1answer
205 views

Lookup construction using data matrix and Reap/Sow versus AppendTo`s

I am a user of MMA9 and made my own kind of Lookup, which is now a standard command in Version 10. In my program there is a section in which by means of a StringReplace[ ]-command containing a lot of ...
1
vote
2answers
116 views

How to join several list interleaving with some fixed list between?

How to join several list putting some fixed list between? Like this MyJoin[{{a,b},{c,d},{e,f}},{x}] giving ...
0
votes
1answer
48 views

Organizing and displaying list-like result

This is most likely a piece of cake for you guys, but it is difficult for me. Related to a math problem, I examine if ...
1
vote
1answer
58 views

Replacing members of a list with elements sampled without replacement from another list

I have a list of element pairs: pairList = {{1,2}, {2, 3}, {3, 4}, {4, 5}}; I'd list to pick a subset of the elements in this list: ...
0
votes
1answer
45 views

Help for properly writing simple derivative expression

I need help to write the following expression (only 1 iteration): f(x) = ...some basic function... f[X0,...,Xp] = f(p)(x0) / p! What I have so far: ...
0
votes
0answers
65 views

DeleteDuplicatesBy function does not exist

I'm using 10.0.1.0 x64 on Windows. The DeleteDuplicatesBy function appears in autocomplete lists, and is present in the documentation, but does not appear to ...
10
votes
1answer
187 views

Max element of a list with a custom ordering function

I need a function to find max element of a list according to some custom ordering function, assuming that the function implements a total order (elements being compared might not even be numbers). ...
4
votes
4answers
161 views

Extract Specific Dates from DateList

Hopefully this is an easy question but I couldn't find an easy answer anyway. Surely there is some simple way to splice this... I want to take a large datelist in the format of {{2014,12,31}, value} ...
8
votes
6answers
282 views

Adding list of list to a list

Hello I need some help on how to add a list to a list of list. The program would have to do as below: {{0,0}, {0}, {0,0,0}}+{1,2,3,4,5,6} will give ...
3
votes
2answers
92 views

Counting the total number of instances of some collection of objects in a list

I have a list of some sort list = {"l1","l2","l3","l4"} and I'd like to count the sum total number of occurrences of n of the ...
1
vote
1answer
81 views

How to specify x axis values in the ListPlot[] [closed]

I am using ListPlot[] to plot a list of 1000 values. I need to specify the value shown in x-axis.It seems that is a classic question but I have looked for in this forum but I did not get any response ...
2
votes
2answers
158 views

Trying to Figure Out how to work with datasets & Classify[] and Predict[]

I'm new to Mathematica and I'm a bit overwhelmed. I have always used R for my statistics problems. Now that I'm trying to replicate what I do in R in Mathematica I'm making little progress. For ...
5
votes
3answers
237 views

Multiplying block matrices

I have a 2*8 matrix A, and a 2*8*2 matrix B. So B[[1]] and B[[2]] are both 8*2 matrices. I need a neat way to multiply A by B so that the first list in the result is A.B[[1]] and the second list ...
2
votes
2answers
97 views

Using `Fold` to show stages of Euler product formula

I would like to recursively replicate each stage of the Euler product proof. This does it: ...
2
votes
3answers
251 views

Picking items from a list

There's probably a Mathematica primitive to do this, but I don't know what it is...suppose I wanted to construct a list of all integers from $1$ to $n$ that were not divisible by $12$, and that were ...
3
votes
3answers
167 views

How to Update 2D List based on a binary array

I have 3 lists: numbers = {{1, 2}, {3, 4}, {5, 6}}; toUpdate = {{1, 0}, {0, 0}, {1, 1}}; newValues = {{10, 20}, {30, 40}, {50,60}}; I have to update the list ...
0
votes
0answers
65 views

Fourier Transformation of a List

As we know the FourierTransform goes a function of t ,for example, f[t] to ...
9
votes
3answers
208 views

Truncating a list once all members of a set have appeared?

Consider if you would the case where we have some list of elements: list0 = {54, 4, 7, 9, 3, 54, 4, 20, 2, 456, 2, 3}; And we have some target list: ...
1
vote
1answer
39 views

Nested list element at position specified by a list

I'm trying to avoid constructions like Y[[X[[1]], X[[2]], X[[3]]]]. That is we have a nested list (Y) of depth $n$ and another ...
0
votes
1answer
155 views

How do I plot results of complicated calculations in Mathematica?

I am new to Mathematica and am struggling with making plots of how features of solutions vary with parameters. For example, I can find the eigenvalues and zeroes of a Sturm Liouville problem (showing ...