2
votes
4answers
118 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 ...
0
votes
4answers
74 views

Minimum and maximum values under conditions

Let's create some sample data ...
2
votes
5answers
117 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, ...
2
votes
3answers
101 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, ...
5
votes
0answers
120 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
94 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 ...
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 ...
8
votes
4answers
258 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$ ...
2
votes
3answers
139 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: ...
5
votes
1answer
129 views

How to slice TimeSeries data?

When retrieving curated data, v10 now returns TimeSeries objects. For example, ...
2
votes
3answers
251 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.
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
273 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: ...
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 ...
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: ...
1
vote
1answer
69 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
92 views
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 ...
2
votes
2answers
114 views
2
votes
2answers
118 views

Map 2 list to a function

Im playing around with CountryData and I want to pass it 2 lists as argument, listCountries = {...} and ...
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 ...
0
votes
1answer
79 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
2answers
134 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
95 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 ...
19
votes
3answers
555 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. ...
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 ...
1
vote
3answers
118 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
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}}; ...
2
votes
2answers
37 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
129 views

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

I have a three-level ragged array like so: ...
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 ...
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 ...
3
votes
2answers
208 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
468 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
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 ...
2
votes
2answers
42 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
86 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
124 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
134 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
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 ...
1
vote
1answer
63 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...
0
votes
4answers
128 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 ...
2
votes
3answers
68 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 ...
5
votes
4answers
225 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
4answers
116 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
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 ...