Tagged Questions

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

56 views

Bad interaction between Join and ListPlot (or Plot)

I need help, please. It is a very simple problem, but I cannot figure it out how to solve it. When you write this code: tab = {{1, 1}}; tab = Join[tab, {{2,2}}]; ...
38 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, ...
64 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, ...
78 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 ...
37 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: ...
36 views

Imported thumbnails from Flickr don't all show up as images? [on hold]

I imported thumbnails from flickr like this: ...
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 ...
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, ...
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 ...
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 ...
33 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 ...
33 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}] .....}?
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 ...
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 ...
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, ...
52 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?
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 ...
68 views

...
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 ...
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 ...
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 ...
78 views

binning list of lists in unequal bin lengths

I'm lookin for binning of ...
525 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 ...
31 views

How can I get a cycle or a way (Range) to give me 1 when n=1 and all the numbers under when n is greater [closed]

so if I want in Mathematica to have something like the idea of the following: when n=1, {1} when n=2, {1,2} when n=3,{1,2,3} when n=4, {1,2,3,4} Note the idea I want in not the sets, so do not give me ...
147 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 ...
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 ...
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: ...
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 ...
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: ...
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 ...
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!
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 ...
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? ...
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?
340 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 ...
232 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 ...
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 ...
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 ...
51 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 ...
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 <...
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 ...
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 ...
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 ...
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: ...
80 views

Longest and Shortest won't work in ReplaceList?

I'm trying to make a pattern that's easy to preceive by human but hard to write out by Mathematica when I came across this problem. (Check the original problem here) Let's check this simple case: I'...
41 views

Diagonal part of product of matrices

I am trying to find the best way to compute only the diagonal part of a product of two (or three) matrices. I tried two different approaches: computing the standard matrix product and then extracting ...
330 views

Maximum brightness of two gray scale images

I am using the answer of bill s in Greater operator should give greater element. Here he showed the example: ...
42 views

More efficient way of filling in a specific entry in a list of lists [duplicate]

"coords" is a list of coordinates in the 2D plane ordered in a specific way, with the 3rd (z-axis) positions left empty to be filled in with specific values, like temperature or concentration at the ...
I want to construct $k$ lists $M$ of positions $(i,j)$ for a matrix $X$ of size $n\times m$, where all entries are "painted" with "white" color. The distribution of such a list $M$ must obey the ...