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

learn more… | top users | synonyms (4)

0
votes
0answers
3 views

Simples exercise using the function Cases (beginner question)

I'm having some trouble in the following exercise: Find which elements of the list are prime numbers or divisible by 3. list = Table[i^2 - 6 i - 1, {i, 0, 15}] my attempt: Cases[list, ...
3
votes
3answers
61 views

Calculating expected value from paired values and weights

I'm very new to Mathematica. I just need a quick solution on how to multiply x with y when a data set is given as ...
2
votes
2answers
90 views

Combining lists to create points to plot with ListLinePlot

I would like to make a ListLinePlot using these lists: ...
8
votes
1answer
79 views

How to partition a 2-D array properly?

Given that I have the following array lst = Array[Subscript[P, #1, #2] &, {5, 5}, {0, 0}] $ \left( \begin{array}{ccccc} P_{0,0} & P_{0,1} & P_{0,2} ...
0
votes
3answers
102 views

Complement[] changes order of elements?

Consider this example: Complement[{a, y, c, d, e}, {a, c}, {d}] (*{e, y}*) However, I was expecting the result to be: ...
2
votes
3answers
63 views

Removing an ordered pair from a list of ordered pairs according to a certain criterion

I have a list of ordered pairs produced by evaluating {IsotopeData["Thorium226", "ExcitedStateEnergies"], IsotopeData["Thorium226", "ExcitedStateSpins"]} I'm ...
12
votes
6answers
309 views

Splitting a list into increasing sublists

I have a list of numbers (say, for example, {1,2,3,4,3,2,1,2,3,4,3,2}), and I want to split it into sublists so that each sublist is the (smallest) sublist whose ...
1
vote
1answer
134 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
0answers
60 views

Plotting 3D data as a surface [on hold]

I am having a problem plotting some data in a 3dimensional surface. These data are distributed like a surface. And I would like to plot them joining them all as a surface. The data are in the form ...
10
votes
4answers
3k views

Removing empty sets from lists

If I had a list, say, names= {"Andy", "Bob", "Carly", "Sandy", "Jeff", "Tim", "Tom", "Zach"} and I decide to pick a characteristic only a certain of them have, ...
6
votes
2answers
240 views

Modifying the elements of a list according to a given probability

Let list be a list of lists, the elements of which are random integers in the interval $[1,c]$. Each element $i$ has a probability ...
6
votes
5answers
161 views

Nested list from a flat folder list

I have a list of folders and files in my current working directory as a result of a built-in function FileNames: FileNames["*", "", Infinity]]. It looks like this: ...
0
votes
0answers
45 views

Large lists to manipulate later in chunks [on hold]

If I try to evaluate either one of the following expressions: Table[n, {10^8, 10^9] Range[10^8, 10^9] I get ...
0
votes
0answers
48 views

Piecewise NDSolveValue: Nested Variable Iteration

I am attempting to make the variable Rc a piecewise-function of [z] and have it update as NDsolve iterates through the range of 'z' such as {z,0,Le), but to no avail. The following code is an attempt ...
2
votes
2answers
69 views

Perform calculation on several sublists using Map

I am trying to perform a calculation on a list containing sublists. More exact: The x-axis values are time data, progressing from zero, the y-axis data are data points, which I want to normalize. I ...
8
votes
3answers
161 views

How can I generate a $2n$-point moving maximum of a list as efficiently as MaxFilter?

This is based on the prior question, Moving maximum function?, where @rasher provided two winning solutions (i.e. clearly the most efficient): MaxFilter[list, 1] ...
0
votes
0answers
72 views

Fitting Data using GeometricBrownianMotionProcess

I am trying to fit Data (see below) using a GeometricBrownianMotionProcess, and have attached two figures. One figure is that of the Data, and the other of the GeometricBrownianMotion for given ...
2
votes
3answers
157 views

Reassigning values in Map

I have a list of lists. Minimal example: lists = {{a,b,c},{d,e,f}} I want to set the values on position 2 (b and e) to the value of their right neighbour (c and ...
1
vote
2answers
37 views

Converting data set from one form to another

I wish to convert Data to Data2. Both sets are provided below. Note that the second set has an arbitrary parameter "t". How can this be done. ...
11
votes
5answers
309 views

Partition a list into sublists of different lengths

I have the list {a, b, c, d, e, f, g, h, i} and I want to make a sub-list of the form {{{a, b}, c}, {{d, e}, f}, {{g, h}, i}} ...
0
votes
3answers
53 views

How to generate a list of outputs for function f(x,y) for a set of known (x,y) values [closed]

Say I want a list of outputs the function f(x,y)=x+y will give for x,y values of (1,5),(5,3),(0,2),(1,1),(2,6). How do I do that? I know this must be pretty straight forward. I just can't figure it ...
0
votes
1answer
29 views

Using Select function to select elements based on last element of nested list [closed]

Good morning, I have a list with each element containing a tuple and a single. It is of this form: ...
17
votes
2answers
373 views

Count number of sublists with a total not greater than a given max

Suppose I have a list of positive integers: data={1, 1, 2, 3, 3, 3, 5, 5, 5, 7, 7, 8, 8, 9, 10, 10, 12, 16, 23} I want to count the number of subsets up to ...
11
votes
2answers
190 views

why MeanFilter is nearly 100 times slower than MovingAverage for 1D array?

I used to average over my data with MeanFilter before I learn about MovingAverage and thought that these two functions are similar except that MeanFilter is more powerful for its ability to deal with ...
2
votes
1answer
111 views

Need Help Writing code to find Capparelli Partitions

I am trying to add multiple criterion to IntegerPartitions[n] so that it sorts only partitions that fit the criterion. It creates a list of list of numbers in ...
1
vote
5answers
183 views

Finding roots of transcendental equation and collecting into a list

I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated. I ...
3
votes
3answers
190 views

Delete rows based on specific periods

I have data (.xlsx format): two columns - data in first column imported as DateObject (dates with specific time), data in second column are numbers (113388.28, 865165.98 etc.). I want to delete the ...
-2
votes
0answers
25 views

“Extract” certain elements of a list of “rules”? [duplicate]

I have the following list: {u1[0] -> 3773.62, u2[0] -> 3773.62, u3[0] -> 48.7871} I need to extract the elements on the right hand side of each rule ...
1
vote
1answer
27 views

Histogram and Random Lists [closed]

Suppose I have the following list listrand of random numbers from RandomReal[-30,30] (where the size of the list is 40). Is ...
1
vote
2answers
89 views

How to find the palindromic number I'm looking for?

I'm looking for a number which is the same when you read it reverse like 101 or 878. I have to get all numbers from 10 to 1000. There are 99 numbers. ...
2
votes
1answer
66 views

How to find the local minimum points in the multi-dimensional numerical data?

I am trying to get some local minima of an n-dimensional function (which only has numerical form). For two-dimensional function data, we can find the local minimum points from the contour plot easily. ...
1
vote
4answers
117 views

Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
1
vote
3answers
109 views

Scatter plot with smooth lines [closed]

I have two lists of data between which there may be some functional dependence. I want to plot one against the other (hence scattered plot) where the points are connected by smooth lines. In ...
1
vote
1answer
58 views

Assign List of Vectors to List

I want to assign a list of vectors (though each only contains one) to a list. For example, create list called "eVectors" and do ...
11
votes
2answers
188 views

Fastest way to sum the upper triangle

I feel like this is an recurring question: if there's a symmetric matrix whose diagonal is not all 0, how could I get the sum of the part of it that's above the diagonal as fast as possible? Small ...
5
votes
2answers
72 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
71 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
295 views

Function involving For loop

I've written the following function (the code includes the output): ...
6
votes
1answer
92 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
100 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
240 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
39 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
298 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 ...