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

learn more… | top users | synonyms (3)

3
votes
3answers
213 views

Efficiently test membership for a list of values

I have two lists: excluded and values. I would like to efficiently determine whether ...
5
votes
2answers
197 views

What is the idiomatic way to shift and extend a list by a number of elements?

I have a lists, list, and want shift it right by a given number of elements, m, extending the list by repeating the last ...
1
vote
2answers
48 views

How to delete blank valued keys from nested association?

Considering we have: acs = <|"A" -> <|"a" -> " ", "aa" -> "asd"|>, "B" -> <|"bb" -> " "|>|> How can we come to have a result ...
3
votes
2answers
63 views

Retaining relative sizes of local maxima using MaxDetect[List]

I would like to be able to find the position of the two greatest local maxima in a list. For the example: list={1,2,3,4,2,1,2,6,5,4,3,2,} I would like to return ...
0
votes
0answers
38 views

KroneckerProduct of the lowest eigenvector [on hold]

tmatrix, is a random matrix constructed with this command: tmatrix = RandomReal[{-1, 1}, {4, 4}] Its lowest eigenvalues can created by ...
0
votes
0answers
39 views
4
votes
3answers
64 views

Replace values in a list based on conditions

I have a list with negative and positive numbers list = {-1, -2, 1, 2} and I want to replace all negative values with 0 and all positive values with 1 ...
0
votes
0answers
44 views

being a function in a multiple steps and using syntax for being shortened [on hold]

My desire is to access to a table with the bellow construction: Table[desired[t], {t, 0, 2, 0.1}] For achieve to desired[t] ...
3
votes
1answer
123 views

Programming for matrix manipulation

I want to write a programme which operates on nd x nd matrices. The programme looks the matrix as a n x n block matrix where ...
19
votes
3answers
3k views

Data interpolation and ListContourPlot

I am fairly new to Mathematica and I have two quick questions on using it for a Hydrology and Hydrogeology class. One is about data interpolation and interpolating without any data defined in an area. ...
0
votes
0answers
17 views

Time Series into List of Pairs? [on hold]

Mathematica's new update includes this handy dandy TimeSeries thing in which all Weather Data is automatically generated as. However, I need to manipulate this data in list form- How would i go about ...
6
votes
5answers
311 views
24
votes
3answers
2k views

Extracting values from nested rules in JSON data

I have been using Mathematica to analyse some data from the StackExchange API. It is conveniently available in JSON form, which Mathematica interprets as replacement rules. However, some of the rules ...
13
votes
10answers
600 views

Count the sequences in an array

Is there a short and easier way to count number of sequences in a list? Let's say I have three lists: list1 = {0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0} ...
1
vote
2answers
67 views

Formatting a table of values

How do I display a list of values $\{a_1,a_2,\ldots,a_n\}$ in a two column format? --------- 1 | a_1 2 | a_2 3 | a_3 ...... n | a_n I tried ...
2
votes
2answers
38 views

Join data imported in different variables [on hold]

I've imported data from Excel into several variables and I would like to join all data in one "big" variable. I seem to have a problem when one variable contains numerical data... ...
1
vote
2answers
80 views

Ask about the variable and constants in partial derivative in a loop

EDITED I have a function in a list like : func={2(x^2)+x*y+3(y^2)}; I want to have a UI that ask me which parameter (x or y) is a variable in a ...
0
votes
1answer
25 views

Transpose four lists of data into two lists for use in List Plot [closed]

I have four lists of data x1 = {1,3,5,7} y1 = {0,2,4,6} x2 = {10,12,14,16} y2 = {8,10,12,14} In one line is it possible to use transpose to get two lists which ...
2
votes
1answer
505 views

How do I sort complex numbers?

Okay, so I posted something about sorting, and it was linked as a duplicate to This post However, I am having problems trying to sort a list that contains both real and complex numbers. I put them ...
4
votes
3answers
125 views

How to get multiplication of the elements of a specific list/Matrix

Assume there is a list: List1={a,b,c,d}; Then I want to get these calculation: ...
3
votes
1answer
107 views

Map an Argument to a list of functions

I want to "map" an argument to a list of functions. Here is the concrete Problem. I generate a list "Messungfit" of functions: ...
0
votes
0answers
53 views

Switching ArcTan argument from a sequence to a list

The objective is to determine the angle formed by the line connecting two points in the plane, say p and q. The ...
0
votes
2answers
31 views

How to get Complement function working in a For loop? [closed]

I've been working on a piece of code that will delete small components from a nested uneven matrix (n pages, n rows, 3 columns), by deleting the pages with less than ~30 rows. However, I've notice ...
4
votes
2answers
113 views

Initializing several values of a function

How do I initialize several values of a function at once? Consider the function f[0] := 1; f[1] := 2; f[2] := 3; f[n_] := f[n] = f[n-1] + f[n-2] + f[n-3]; Is ...
2
votes
4answers
160 views

Given a matrix of integer, create a matrix with 1 or 0 according to which numbers are in the first matrix

Not sure the title gives the idea of what I need, so here is a sample: I have ten (w) combinations (subsets) of 20 (n) numbers taken 4 (k) at time. I need a matrix of dimension w x n with 0/1 in each ...
0
votes
1answer
98 views

Appending elements to a list in parallel table

Is there any way to store values in a list that is being computed in parallel? For example, if ParallelTable is computing some ...
0
votes
2answers
69 views

Write list of numbers to a file

I have a list of numbers: e.g. list={1,2,3,4,5} To write the list to a file I use (here each integer number occupies 7 spaces): ...
2
votes
2answers
132 views

Approximation of definite integral by parabolas

This question is related to Trapezoid approximation to definite integral. As promised, I am now asking about how to draw approximation of integrals by parabolas. I tried to modify MarcoB's code, and I ...
0
votes
0answers
14 views

Selecting elements from list based on list of positions [closed]

I have a list with elements I want to select: list = {1, 34, 98, 4, 5} Now I want to select elements of those list based on a list with positions like: ...
7
votes
4answers
189 views

How to Apply Functions to Lists with Many Curly Brackets?

For example, consider the list defined below. samplelist = {{{1,2,3,4}}, {{5,6,7,8}}}; How would I apply the Times operator ...
2
votes
2answers
95 views

How to remove multiplicities from for a list in way meeting special criteria

I have a list of pairs, tabul, which has the property that the second element of each pair is also an element in my list data. I ...
0
votes
1answer
73 views

Elements inside arrays seem to be strings rather than signed numbers

When I have code like b = Array[Subscript[be, #] &, {3, 1}] b = b /. {Subscript[be, k_] :> Subscript[-be, k] /; k > 1} I am noticing that Mathematica ...
3
votes
1answer
135 views

Union of two or more lists

I have a number of lists (only 3 shown here) ...
0
votes
0answers
27 views

FoldList[Union,…] version 8 vs version 9 [duplicate]

I have a list of matrices something like shown below A = {{{1,1,1,1,1},{2,2,2,2,2}},{{3,3,3,3,3},{4,4,4,4,4},{5,5,5,5,5}}} When I try to run the code ...
-1
votes
0answers
45 views

Building Pythonic Programming style to Mathematica with visually-accessible list comprehensions?

The question List comprehension in Mathematica has comment about this Functional style using lazy lists? where they build some sort of style for lazy lists: I understand it so that it is impossible to ...
2
votes
2answers
115 views

What is wrong with my use of Flatten? [duplicate]

Why does Flatten[f[g[a, f[b]], f[c, d]]] result in f[g[a, f[b]], c, d] I expected the answer to be ...
0
votes
2answers
291 views

Extract X value from corresponding Y value from a List or Transpose [duplicate]

I have a list of X values and Y values separately, and also together with: data=Transpose[{X,Y}] This data is from a chromatogram, and I want to extract the ...
2
votes
2answers
95 views

How can I get a certain kind of iteration?

Can I get this type of do-loop in Mathematica? Do[Print[j," ",k," ",l], {j,k,l, {a, b,z}, { c, d,y} }] I want this to work so that, in the first iteration, ...
3
votes
1answer
54 views

Iteration variable in variable [duplicate]

Is it possible to create following list by some sort of iteration? {a1,a2,a3,...,a100} I cannot think of any way to append a to ...
2
votes
3answers
100 views

Efficient extraction of a subset

The context is molecular dynamics. The data is in the format (index_1, index_2, distance). The goal is to find all of the distances to the neighbors of point index_0 and to present a set listing the ...
0
votes
1answer
408 views

Generating all “from n choose k” configurations of a simple list [duplicate]

Suppose that I have a 1-D list called myList. Here's an example: myList = {"A", "B", "C", "D"}; I want to write (or find ...
1
vote
1answer
51 views

How to set the values into some variables from different lists [duplicate]

I have a list of Values and a list of variables. I want to set the Values into Variables. Assume the following code: ...
1
vote
0answers
36 views

Generate a list of values of a function for each value of the parameters already found

The following question is an extension of this question Find all roots of a function with parabolic cylinder functions in a range of the variable. Now I want to use the roots found to calculate a ...
7
votes
1answer
114 views

Automatically grouping words into categories

Say I have a comma-separated list of words. For example sake, let it be things I have seen during my trip to a safari zone. It would look something like that: ...
1
vote
2answers
121 views

Query in Lists Mathematica - Pivot table

Recently, I finished a simulation, and I got the following data: ...
1
vote
0answers
43 views

How to remove brackets from this list? [closed]

I have some lists which have many brackets. I'd like to remove brackets from the lists. For example, I need to change the list ...