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

learn more… | top users | synonyms (3)

1
vote
4answers
70 views

Replacing more than one element from a Sublist

The following expression allows me to extract the value of x and y: ...
0
votes
2answers
42 views

Defining a function from a list [on hold]

I have a list of 49 numbers, and I would like to define a function f such that f(n) is simply the nth number in the list. How can I do this?
5
votes
5answers
252 views

Populate an upper triangular matrix from a vector of elements

What is the best way to populate an upper triangular (or alternatively: lower triangular or symmetric) matrix from a vector of elements? This example input: ...
3
votes
5answers
173 views

Take the next element in a nested list

My problem is the following: Consider a list of elements. To better understanding my following explanations, I would take this example: ...
0
votes
1answer
43 views

Help with programming(using list) [on hold]

I would like to make a program which gives me what is the greater natural number "n" less than an arbitrary given natural number "k" which satisfy: for each prime divisor "p" of n, p^2-1 divides n. I ...
1
vote
0answers
52 views

Setting a Row from a Matrix as Variable

I'm not advanced in Mathematica but I'm trying to get better. I have a big set of Data and I want to Plot the first row against ...
1
vote
1answer
44 views

What is the correct way to plot a dynamically generated list of functions?

For example, I want to generate a list of random waves and plot them. Then I wrote f:=Random[Real] h:=Floor[f*20] And then ...
1
vote
3answers
39 views

Collect the lists

I have a list of lists from which I pick out the positions of the number 1 and then print out these positions for each list. I am having some trouble collecting what I am printing into a list / matrix ...
0
votes
0answers
53 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}}; ...
3
votes
3answers
131 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 ...
2
votes
2answers
116 views

Map 2 list to a function

Im playing around with CountryData and I want to pass it 2 lists as argument, listCountries = {...} and ...
0
votes
1answer
77 views

How to create an array of functions

For a project I'm working on, I need to solve a differential equation numerically. I know this is easily done with NDSolve, but I want to solve it several times ...
2
votes
3answers
92 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 ...
2
votes
2answers
127 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 ...
19
votes
3answers
547 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
19 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
3answers
116 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: ...
0
votes
4answers
126 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 ...
1
vote
1answer
36 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
2answers
35 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
128 views

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

I have a three-level ragged array like so: ...
4
votes
4answers
244 views

How can I name “a[[i]]” the parts of Table “a”? Or how to make Table “a” grow inside FindMinimum?

Let's say I want to minimize a function that uses a Table named a with the Conjugate Gradient Method of ...
5
votes
2answers
161 views

Integrating a list of functions

For the purpose of this minimal example, let's say we have a list of functions, like this: f[y_?NumericQ] := {NIntegrate[z*y, {z, 0, 1}], a y} I want to ...
5
votes
5answers
505 views

Prevent Part[] from trying to extract parts of symbolic expressions

If you have a list, e.g. {1, 2, 3} then you can extract the $k$th part using Part (...
1
vote
1answer
74 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 ...
21
votes
5answers
6k views

How to find the phase difference of two sampled sine waves?

I'm trying to measure a phase difference between two Sine functions I've acquired with a computer. I'm uploading one of the .txt files with the data I'm working with here: txt file. To remove the ...
2
votes
2answers
69 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 ...
4
votes
1answer
464 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 ...
3
votes
2answers
206 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: ...
1
vote
1answer
48 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 ...
-3
votes
0answers
37 views

Going back 10% on an price [closed]

I have updated something by adding 10% to a value, I now want to find the original value by taking 10% off, how can I do this?
2
votes
2answers
41 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
82 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. ...
2
votes
3answers
123 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
133 views

Get part of lousy data

I want to get part of large data. some part of this data is as follows: ...
8
votes
1answer
111 views

Strange behavior of BinCounts

Just try this example: ...
5
votes
3answers
261 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 ...
18
votes
8answers
1k views

Selectively Mapping over elements in a List

I am using the following code to easily generate a row of images of all eight planets of our Solar System: ...
1
vote
1answer
62 views

DeleteCases that match partially [closed]

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...
27
votes
5answers
1k views

How to efficiently find positions of duplicates?

Is there an efficient way to find the positions of the duplicates in a list? I would like the positions grouped according to duplicated elements. For instance, given ...
3
votes
4answers
825 views

How can I make the Cartesian product of a list with itself? [duplicate]

I'm trying to build the table {{1, 1}, {1, 2}, {2, 1}, {2, 2}} given the list {1, 2} I can do it like this ...
5
votes
4answers
220 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
67 views

Table to text string [closed]

I know this is a simple question and there is a single command to do this but I have been looking for the command for 30+ minutes and cannot find it. I have a list that I want to put tabs between ...
2
votes
4answers
113 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: ...
6
votes
1answer
351 views

ReplaceAll inside an Iterator

I'd like to apply a set of rules to an expression defining the iterators of the table, like this: ...
3
votes
2answers
80 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
57 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 \\ ...
6
votes
4answers
472 views

How to find all data points within closed curve

I want to find all data points inside curve as given below: ...