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

learn more… | top users | synonyms (4)

2
votes
2answers
135 views

Map 2 list to a function

Im playing around with CountryData and I want to pass it 2 lists as argument, listCountries = {...} and ...
4
votes
3answers
142 views

Symmetric list with maximum in center

How to sort a list, e.g. RandomInteger[{0, 100}, 50] that the Maximum is in the center and all other elements are placed symetrically in descending order around ...
3
votes
2answers
241 views

Binarizing a matrix

I have an image with a few bright pixels with the remaining ones very dark. The difference is in orders of magnitude. I want to binarize this matrix (corresponding to the image) making all values ...
2
votes
3answers
164 views

Speeding Up Replacing of Labels in Large Matrix?

I am Mathematica novice and am trying to find a fast way to replace labels in some rather large matrices (512x512 or 1024x1024) that have resulted from segmenting images with WatershedComponents or ...
22
votes
3answers
844 views

DeleteDuplicatesBy is not performing as I'd hoped. Am I missing something?

Déjà vu: a new-in-v10 function should provide a better solution to an old problem, but my enthusiasm is curbed when I run timings. This time the function is ...
0
votes
1answer
38 views

Interactively Manipulate SparseArrays or Lists

I'd love to use SparseArrayor List to group a set of parameters together in a function. ...
1
vote
1answer
72 views

Integers in Range have trailing decimal - how to remove?

I want to create a list like {0,0.2x,0.4x,0.6x,0.8x,1} If I try Range[0, 1, 0.2] x what I get is ...
2
votes
3answers
241 views

What is the order of faces on a D20? How can I optimize the order of faces on a D-n?

I am creating a customizable D20 for 3D printing using OpenSCAD, with the following code: ...
1
vote
0answers
60 views

deleteduplicates Delete elements of a list [duplicate]

I have a math problem about Mathematica, I am looking help from you. I hope that you could help me. The Math Problem: list= { {0,0,1},{1,0,0},{0,1,0} ,{1,2,3}}; ...
2
votes
2answers
47 views

How to further process a 2 dimensional list created with tuples

I created with Tuples[{{USD, EUR, JPY}, {UP, DOWN}}] the following result: ...
2
votes
3answers
172 views

How to display the indices/element positions of a ragged array?

I have a three-level ragged array like so: ...
2
votes
2answers
88 views

Adding a tree to a list of trees within a loop [duplicate]

I'm trying to write a function which for a list of trees checks if a given tree is isomorphic with any of the listed, and if not - adds it to the list. I tried to use both ...
1
vote
1answer
246 views

ListPlot[] code for CSV file not working

I have a CSV file with $9$ columns. I want to plot them in the following way. Column $1$ will be along the $X$-axis. Any point $(x_i, y_i)$ of $i$-th curve in the plot will have the $x$ value from the ...
4
votes
2answers
268 views

All possible pairs of two items

I have 4 different items {1, 2, 3, 4}. I want to obtain all possible pairs of two of the items. I have written: ...
4
votes
1answer
519 views

Why is there a huge performance gap using Map with more than 100 List entries

im using Map on a List like this: cube= {{1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 1, 4}, ... , {5, 5, 4}, {5, 5, 5}} Mapping the whole List with 125 entries takes ...
1
vote
1answer
86 views

Replace distinct values of list with values of another list

First of all I´m new to Mathematica; I´m trying to exchange distinct values of a list with values of another list (piecewise). I thought ReplacePart in combination ...
2
votes
2answers
89 views

How do I delete items at the same position from every sub-list within a list? [duplicate]

We have data in a list called megadata where megadata[[1]] for instance are the temperatures of each data point, ...
1
vote
1answer
97 views

Using Map in a function definition

I want to calculate the hessian of a matrix. So each element gets replaced by a 2 by 2 matrix. ...
3
votes
3answers
149 views

Elegant way for map a function over the columns of an array

I have an array data = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; And I want map Standardize over the column of the array. I use ...
4
votes
2answers
138 views

Get part of lousy data

I want to get part of large data. some part of this data is as follows: ...
5
votes
3answers
282 views

Command to insert item into list

Is there a command to insert an item into a list such that they form pairs? In other words to take InsertObject[{a,b,c},d] which will output ...
1
vote
1answer
245 views

DeleteCases that match partially [duplicate]

Say I have a list of strings L , L2= "some_text-to-delete" and I want to delete all the Li that match with "text" or "delete" DeleteCase only gives the ones that match exactly...
0
votes
4answers
141 views

Using levels in MapIndexed

I am trying to use MapIndexed to manipulate a matrix of data but I am having trouble getting the levels parameter to work the way I would like. Suppose that my data ...
6
votes
4answers
1k views

Swap elements in list without copy [duplicate]

I have a lists with 100,000 elements and would like two swap to entries without dublicating the list Example: ...
2
votes
3answers
488 views

Backsubstituting solution into FindRoot and Plot

I want to find roots from a transcendental equation using FindRoot as a function of a real parameter and then plot the solutions vs. the parameter. The following commands work perfectly: ...
3
votes
2answers
110 views

Matrix of given size with unspecified elements

I want to generate a Matrix of given size whose elements are not specified I can use Array[a, {3, 2}] to get ...
1
vote
1answer
133 views

Inverting matrix of unknown size

I have a matrix that has a variable number of columns and rows (but it is always square). The matrix is: $$ \Gamma = \begin{bmatrix} \Theta & 0 & 0 & 0 & T & 0 & R_j \\ ...
0
votes
3answers
112 views

Positions of a string in a list [duplicate]

Sorry for the bad title..Didn't know how to describe this, feel free to change it to be more specific. I have a list in this form: ...
8
votes
8answers
743 views

Replace interior of matrix with zeros

I have f.e. the following square matrix: ...
0
votes
1answer
52 views

Constrain Fit to make a fit that remains positive over the range of my independent variable

For example, say I have the following data. ...
6
votes
7answers
340 views

A problem involving classification of data

Toady, I encountered a problem while trying to classify certain data. I have the coordinates of six points. ...
0
votes
1answer
96 views

Combining list x-y data with a list of errobars into one list (mathematica-style)

Suppose I have a list of data I can ListPlot: { {x1,y1}, ... } , and a list of y-errorbars: {erry1, erry2, ... } Is there ...
2
votes
2answers
202 views

Alternative for MapThread in listable functions

How can I rewrite this more efficiently taking advantage of flo, dem, and Nsup being ...
1
vote
1answer
110 views

references in a nested matrix

I have a nested matrix n: ...
7
votes
4answers
269 views

Position of Subsets in a List

I have a particular list of integers and a matrix whose entries are lists. Say I know that my particular list is a subset of at least some of the elements in the matrix. I want to find an efficient ...
1
vote
0answers
139 views

How to sequentially select, from a large set of tuples (of matrices), those with a certain property

I'm interested in finding a computationally efficient way for selecting all tuples of matrices which have a certain property. The property I'm interested in is that I want the column sum, of f[the ...
0
votes
1answer
56 views

How to cut elements from set of data based on function restrictions? [duplicate]

For example, say I have a set of data which takes the form list = {{1,2,4,5,3,2},{2,3,4,2,1,6},{2,3,4,5,4,3}} where all of the elements have a length of 6. ...
1
vote
3answers
173 views

Binning events with weights

I have two vectors, one containing sampled energies and the other one for each of these energies a weight: e(i) and w(i). I ...
2
votes
2answers
245 views

Delete pairs from a list

I have a data set in which I need to remove all matched pairs of entries - not just the first entry that is duplicated but both entries. To add to the complexity, the pairs must be between different ...
5
votes
1answer
233 views

More efficient Omnibus number determination?

Amusing myself with concepts from "Omnibus Sequences, Coupon Collection, and Missing Word Counts", in particular the sequences. To paraphrase the concept, a string is k-Omni over some alphabet a if ...
5
votes
2answers
117 views

Comparison Operation for Nested Matrices

I have a nested matrix n as bellow ...
1
vote
4answers
110 views

Drop row if sum of part of row is equal to zero

My problem is the following: Suppose I have a matrix A which looks the following: ...
5
votes
3answers
633 views

How do I save/export a list so that it can later be easily imported as a list again?

I have a couple of big lists (each of them contains elements that are themselves lists of two elements, i.e. an element of each list that I have is of the form {x, y}) that I want to save/export. ...
4
votes
6answers
477 views

Insert all elements from one matrix into another

I have two matrices $A$ and $B$ which are the same size. Each element of $A$ is a list of numbers. Each element of $B$ is just a number. How do I insert each element of $B$ into the corresponding list ...
1
vote
1answer
135 views

Assign values to variable names in lists

I hope somebody can help me in this (I guess) simple question: I have a list of variable names ls={w0,w1,w2} and another list of values ...
0
votes
2answers
95 views

How do I sum up p items in a sequence?

I have the following sequence list = {p1, p2, p3, p4 ....} I am summing up the p items as follows: p1 + p2 + 2*sqrt (p21*p2) = p12 p12 + p3 + 2*sqrt (p12*p3) = p123 p123 + p4 + 2*sqrt (p123*p4) = ...
0
votes
1answer
99 views

Matrix operations performed with column-vectors

We have 3 matrices: m1, m2 and b. We want to apply matrix operations (dot or sum) in a ...
6
votes
2answers
277 views

How can I create a class of matrices programmatically?

I am trying to figure out how to create a function that can create the matrix pattern below, where: f[1] returns {{1}} ...
0
votes
2answers
183 views

Defining a function as a sum of several Gaussians

I have a function that is a summation of several Gaussians. Working with a 1D Gaussian here, there are 3 variables for each Gaussian: A, ...