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

learn more… | top users | synonyms (3)

-2
votes
4answers
115 views

Compare elements in a list

Assume that there are three different points in x-y coordinate like: p1={4, -1}; p2={5, -2}; p3={1, 5}; In order to compare these points to each other in a ...
7
votes
10answers
167 views

How to group each element with each consecutive elements in one head

Suppose I have the following list: list = {a, b, c, d} I want to generate this result: ...
2
votes
0answers
29 views

Convex optimization

I am playing with some Compressed Sensing (think single pixel camera) applications and would like to have a Mathematica equivalent of a Matlab package call Convex Optimization (CVX). Specifically, I ...
1
vote
1answer
179 views

Manipulate inside a function definition [on hold]

I am writing a notebook where I have to configure several curves (using locators in manipulates). in order not to repeat the code, I would like to write a function that wraps a manipulate and returns ...
4
votes
2answers
65 views

Faster Alternative to DeleteDuplicates for deleting elements in list [duplicate]

I have a list in this style data={{a1,b1,c1,d1,e1,f1}, {a2,b2,c2,d2,e2,f2}} I need to delete all elements in which b1 is ...
1
vote
1answer
62 views

references in a nested matrix

I have a nested matrix n: ...
4
votes
1answer
166 views

Apply function to every element of list regardless of depth

I want to apply a function to every element of a list without taking braces into account (depth level), but with the same form of output. Here is an example : ...
4
votes
0answers
65 views

magic rectangle with mma

I was trying to solve this puzzle using mma It looks like the generalization of the magic square. Anyway here my attempt:- There are four columns $(x,y,z,w)$ and nine rowa which are denoted by the ...
2
votes
3answers
143 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
4answers
112 views
1
vote
1answer
89 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
4answers
147 views

Need an efficient way to do this list manipulation

Lets say i have two lists with me as given below: l1 = {4, 6, 8, 9, 10, 12}; l2 = {2, 3, 4, 5, 6, 7}; Now i have a function S2P(details irrelevant) which takes ...
3
votes
3answers
146 views

Zero-order interpolation not going fully around

Connected to this question, I want to do a zero-order interpolation of a bunch of datapoints which is periodic. The code I use is as follows: ...
2
votes
3answers
106 views

Using select to pick out elements of nested lists in an odd way

Suppose I have a nested list such as, {{{A, B}, {A, D}}, {{C, D}, {A, A}, {H, A}}, {{A, H}}} Where the elements of interest are, ...
3
votes
5answers
123 views

Creating a new list by dropping sub elements of the original list

Suppose I have a nested listed as follows, {{{1,2},{3,4,5},{2,3}},{{2,3,4},{5,4,1},{1,4,3}},{{3,4,5},{3,4,5}}} Where the elements are, ...
6
votes
0answers
129 views

Learning Resources for Data Science in the Wolfram Language

I'm delivering an upcoming course on Data Science with the programming/analysis done predominantly in the Wolfram Language. I created the following table to leverage students' familiarity with Lists ...
0
votes
0answers
96 views

Improving the speed of evaluating Table with nested functions

I am a Mathematica novice working with a stack of 1024 x 1024 WatershedComponents (or MorphologicalComponents) label matrices ...
8
votes
4answers
262 views

Fast method to select matrix elements based on a vector of positions

There is an operation for which I have long wanted to find a better solution. Let: a be a matrix of dimensions $m\times n$ ...
0
votes
0answers
42 views

1D bin packing solution with NMinimize or NMaximize (use minimal office space) [on hold]

I want to use NMinimize to solve a 1D bin packing problem. The goal is to assign a large number of staff to as few rooms as possible. The empty rooms can then be sub-let and generate income. Hence ...
2
votes
3answers
252 views

Create a list of random reals

How can I create a list of random pairs $(x,y)$ where $0<y<x<1$ and $x,y \in \mathbb{R}$ ? I can't seem to place that inequality restriction on the random numbers that are generated.
5
votes
1answer
130 views

How to slice TimeSeries data?

When retrieving curated data, v10 now returns TimeSeries objects. For example, ...
1
vote
4answers
91 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
45 views

Defining a function from a list [closed]

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
278 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
177 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
44 views

Help with programming(using list) [closed]

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
1answer
45 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
40 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
132 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
119 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
80 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
98 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
138 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
565 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
20 views

Interactively Manipulate SparseArrays or Lists

I'd love to use SparseArrayor List to group a set of parameters together in a function. ...
0
votes
4answers
129 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
37 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
38 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
130 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
163 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
510 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
76 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
71 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
473 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 ...