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

learn more… | top users | synonyms (5)

2
votes
3answers
117 views

Table with condition

I have 2 lists of numbers A = Range[16, 65] and B = Range[10, 16]. I want to form all possible combinations $(a,b)$ of the ...
0
votes
0answers
35 views

Sorting Ordered List of Words by First Letter

I am trying to sort an ordered list of the most common Arabic words. I want to create sublists of words according to their first letter while maintaining the order of the original list. Here's an ...
0
votes
0answers
29 views

3D listplot, for a given table

I have a table of 4 data, my first problem is how can I choose one region in which just one of these variables is constant and the listplot3D the other 3 variables? I need to do this for at several ...
0
votes
0answers
23 views

Get rid of infinty in matrix elements (by seperately defination of diagonal and off-diagonal elements)

I want to generate a matrix in which the elements have the below rule to be generated: ...
4
votes
1answer
84 views

Better use of pattern matching in replacing elements of a list

I have a list of reals and I'm replacing those which are contained in a given interval with two different values depending on wheter the selected reals are positive or negative. I came up with this ...
4
votes
4answers
327 views

Lists in Mathematica

I have a list of the form: { {0.185794, {α -> 5.8794, χ -> 3.14159}} ,{0.206365, {α -> 6.07943, χ -> 3.14159}} } How can I transform this list such ...
3
votes
2answers
112 views

Delete elements from a list

I have two lists, for example s={{1,3,2},{1,3,2},{2,3,1},{3,1},{2,3,1}}; c={{3},{1,2},{3}}; First element of c means that ...
11
votes
1answer
137 views

Bad interaction between Join and ListPlot (or Plot)

When you write this code: tab = {{1, 1}}; tab = Join[tab, {{2,2}}]; you expect to get the following table: {{1, 1}, {2, 2}} ...
3
votes
1answer
50 views

Evaluating a list of randomly sampled triplets with a function of three variables

I'm new to Mathematica. I need to generate a list of 1000 triplets of random numbers {r, p, t}, so that 0 < r < 1, ...
1
vote
1answer
68 views

Generating a very large list of integers not divisible by a set of primes

I have read (58520), but the solutions there do not work when using a large maximum value because they rely on Range. For example, ...
2
votes
1answer
83 views

Duties of Threads accompanied by `#` or a Rule `->`

I was willing to understand the Coolwater's solution of the presented problem here. He proposed the below solution ...
0
votes
1answer
39 views

Mean brightness and the standard deviation of columns in a gray scale image

I want to calculate the mean brightness and the standard deviation of columns in a gray scale image (8bit). Can the following calculation code be made faster or/and shorter: ...
1
vote
0answers
36 views
1
vote
1answer
42 views

How do I extract religion fractions data from CountryData?

In this code: data = CountryData["UnitedStates", "ReligionsFractions"] I need to extract all of the names of the various religions as a variable and the fraction ...
2
votes
3answers
75 views

Getting directly a packed array of repeated packed arrays

Consider this code: Needs["Developer`"]; N@Range[5]; PackedArrayQ@% Table[%%, 5]; PackedArrayQ@% which prints True, ...
0
votes
1answer
86 views

Problem with FoldList: Use Foldlist with more than one List/Use FoldList with multidimensional array

I have the following function: vt[ea_, v0_, cm_, b_] := ea + (v0 - cm)*b ea is a set of lists and ...
5
votes
5answers
284 views

How can I make a lists of pairs out of two lists of triples?

I want to use this expression for my computation: FoldList[vt[#2[[1]], #1, #2[[2]], b] &, v0, Transpose[Join[{ea, cm}]]] My problem now is that ...
0
votes
0answers
34 views

A list of bound variables

I have been given a set of (bound) variables and inequalities, and then I want to use Exists[...,...] to get an quantified formula. But when I tried, trouble will ...
0
votes
0answers
34 views

How to convert from Dataset Object to List? [closed]

I have a Dataset of coordinates and I want to eventually plot them. How do I go from to {GeoPosition[{37.33,119.6}], GeoPosition[{37.33,119.6}] .....}?
1
vote
1answer
41 views

Splitting Logical Expression in list of expressions

I have long results of a Reduce statement in the form of {(expr1) || (expr2) || (expr3) || ...} I am looking for a way to split ...
0
votes
1answer
48 views

Replacing Non-Constant Elements from List with Pattern [closed]

I have a list list = {0, 0}, 0, {0, 0}, 0, 1}, {{0, 0}, 0, {0, 0}, 0, 2}, {{7,7}, 20, {7, 7}, 3}, {{8,8}, 30, {8, 9}, 4}} And I want to remove all elements which ...
1
vote
1answer
38 views

Replace empty list elements with pattern

I have a list which sometimes looks like: list = {{},{}} I need to catch these occurrences and replace them with {{0,0},0}. The following hasn't worked So, ...
1
vote
1answer
53 views

Deleting duplicate cells from notebook

I need to delete all duplicate cells in my notebook, keeping just one occurrence of each pair (or tuple). No need to choose which to keep. Is there a (simple) way to do it?
1
vote
1answer
51 views

Local Max/Min from the list with fluctuation

I am trying to find the local minimum of the list of data with some noise. Here is how the data looks like below image, and I want to extract the three points. From an question by giacomo (link), I ...
0
votes
2answers
75 views

How to plot the mean of a 2d list with some empty elements

How can I plot the mean of such a list: http://pastebin.com/dNjeR4WC which contains an alternating number of elements in the sublists and some sublists that are empty and should not be considered in ...
2
votes
1answer
54 views

Combining Map with Drop [duplicate]

I assume my question has been answered before, but I can't find such an answer anywhere:. How can I drop the first element from each sublist within a list? I should be able to use ...
2
votes
2answers
142 views

Creating a single three-dimensional array from imported data

I'll preface this by saying that I'm not a Mathematica veteran - I'm a chemist who is trying to find a way to import time-dependent spectral data in a usable form. I have figured out how to import the ...
2
votes
3answers
78 views

binning list of lists in unequal bin lengths

I'm lookin for binning of ...
12
votes
6answers
529 views

how to permute list of number{1,2,3,…,n},while preserve the order of first m terms as well as the last n-m terms?

For example, starting from {1,2,3,4}, I want to generate all permutations like {1,3,2,4},{1,3,4,2},{3,4,1,2} which preserve the ...
2
votes
3answers
148 views

Remove pieces of a text file

I have imported a text file as a Table with testpbkg = Import["unweighted_events.lhe", "Table"] The file looks like this. I want just to select the text ...
14
votes
5answers
311 views

Apply multiple functions to parts of a nested list [duplicate]

data = {{1, a, x, "one"}, {2, b, y, "two"}, {3, c, z, "three"}} I want to apply a list of four functions {f, g, h, m} one ...
0
votes
1answer
46 views

How to apply a piecewise function to a list? [closed]

I have created this code: xn = {4, -4, 4, -4} f[x_] = Piecewise[{{Sqrt[x], x >= 0}, {Sqrt[-x], x < 0}}] f[xn] With this code I would expect as a result: ...
0
votes
1answer
39 views

Combination of Values: Automated generation [closed]

How can I get a list of combinations for two values (e.g. 0 and a) such as for N=3: {{a,a,a},{a,a,0},{a,0,a},{0,a,a},{a,0,0},{0,a,0},{0,0,a},{0,0,0}} ? I'd like ...
15
votes
8answers
2k views

How to avoid procedural loops in this example?

I want to iterate over a list, and return the index as long as I found the first element satisfying my condition. Written in a for loop: ...
1
vote
1answer
47 views

Finding Nearest Element to a line in a 2 dimensional Array

so i have a 2-dimensional list of data of x and y coordinates. I am looking for a way to get the element of the list which has the closest y value to a given y value. I tried using Nearest but this ...
0
votes
2answers
57 views

How I can calculate product of series matrices

How I can calculate product of series matrices: A= Im...In. In-1 ...I1 which In = {{n,7n-2,3,2n-1},{3,4,n,6n-1},{9,3,n,n-3},{n-2,1,8,7n/3}} thanks!
1
vote
0answers
24 views

Why Inner doesn't work with Dot/List? [duplicate]

The recent question about generalizing Dot for list of matrices had a nice solution/comment using Inner. Briefly, we have 6 ...
4
votes
3answers
291 views

Adding data to an existing list

I have list: {{a, b}, {c, d}, {e, f}} What is the most simple (but automated) way to add this data to the list? ...
1
vote
0answers
41 views

Simple list manipulation [closed]

I have two lists: {1,2,3} and {a,b,c} and I want this result: {{1,a},{2,b},{3,c}}. What is the right command? How does one call such an operation?
10
votes
3answers
341 views

How to extract the list of all matrices from a Block Diagonal Matrix?

I am working on a function to do the opposite operation of How to form a block-diagonal Matrix from a list of matrices? Here is my current algorithm: For i ...
1
vote
3answers
233 views

Generating a vector basis

I have several lists parameterizing a vector space, for instance {a[1],a[2],a[1]+2 a[2]-a[3]} For each list I want to generate a basis such as ...
2
votes
1answer
62 views

Replace part on string in list

I have a list with string and integers and want to replace one word in the string with an integer. For Example if I have ...
0
votes
1answer
34 views

How-to set item background color based on criteria? [closed]

Description After carrying out some computation and establishing a set of data, I would like to tablularise data and highlight values which do not meet acceptable treshold. A similar question has ...
2
votes
2answers
52 views

(Cartesian product) How to get the coordinate of points while each coordinate of each axis is known? [duplicate]

For example, I have data like this: m = {{1,2,3},{4,5,6}} It means 1,2,3 are available x position, 4,5,6 are available y position. The question is, how to get ...
1
vote
1answer
32 views

Map a list of functions to a number [duplicate]

Suppose I have a list of functions like: listfun = { Sin, Cos, Tan } And suppose I want to map listfun to a single number <...
0
votes
1answer
60 views

Generating matrix of distances between points in cylindrical coordinates

I am working on an analytical model for the sound intensity generated from a vibrating cylinder. Part of this work requires me to split the cylinder up into a number of elements, with the more ...
1
vote
0answers
37 views

Removing every member of a list from another list [duplicate]

I have a list of lists A={{1,2},{3,6},{7,8},{5,0}}, and another list of lists B={{1,2},{5,0}}. If any list in B is also in A, I want to remove them from A. E.g.,Taking {1,2} and {5,0} out of A to get ...
2
votes
0answers
56 views

How to Set Priority Between Longest and Shortest [closed]

As is shown in this post's answer, it seems that though you can set priority of Longest (or Shortest) by ...
0
votes
0answers
57 views

Time series of a point using ImageFeatureTrack

This question regards tracking, however it is more about writing efficiency in mathematica compared to other programming softwares. I get the tracking of a point between two movie frames by: ...