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

learn more… | top users | synonyms (3)

4
votes
3answers
241 views

Extracting Pareto elements from a list

How can I extract the Pareto elements from a list? For example, for that list: ...
7
votes
4answers
191 views

Generating all matrices with 1 (possibly) replaced by -1

I have a matrix $M$, whose dimension I am unsure of, which has only $\lbrace0,1\rbrace$ entries. I would like to generate all the possible matrices that result from changing (some subset) of the $1$'s ...
3
votes
3answers
201 views

Are table headings functional?

Are table headings for aesthetics only? If I have: ...
8
votes
3answers
584 views

Analytically finding critical values in a hysteresis curve made with ListPlot

Let me start with a super basic explanation of what I'm trying to do, and I will follow with a more detailed discussion afterwards. From data in the form shown below (a ...
9
votes
5answers
202 views

Is there a better way to add a “key” for the list of GatherBy?

In ruby , 1.upto(10).to_a.group_by{|x| x%3} gives {1=>[1, 4, 7, 10], 2=>[2, 5, 8], 0=>[3, 6, 9]} I would like use ...
4
votes
4answers
184 views

clean functional way to get first n rows that yield maximum rank

I have a matrix A and want the matrix consisting of the first n rows of A, having the same rank as A, where n is minimal. More generally, I want the shortest "start piece" of a list, such that some ...
6
votes
3answers
419 views

Sum over binary digits of integer

This might seem like a simple enough question but Mathematica seems to simplify inadequately here: How would you sum over the digits of an arbitrary binary number? I already tried this: ...
0
votes
2answers
77 views

Extract a List of Co-ordinates from a List of Complex Solutions

Let's say I have this list of solutions from a previous computation: ...
2
votes
3answers
366 views

Generating pairs of additive and multiplicative factors for integers

Given an integer $n$, I want to get two lists: a) the set of pairs of the divsors $a,b$ into exactly two factors $n=a\cdot b$, b) the set of pairs $a,b$ of two summands $n=a+b$. The code I ...
15
votes
6answers
1k views

Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$

Looks like a question for pupils, right? In fact if the available math symbol is limited to $+$, $-$, $\times$, $/$ then it's easy to solve: ...
1
vote
1answer
151 views

Optimization of correlation calculation

How can I make the following line of code run faster? Is there a way to do this calculation as a matrix vs vector than vector vs vector? In the code below, f is a ...
4
votes
2answers
500 views

Optimize inner loops

I'm Mathematica newbie so please be gentle :) I have this, heavily non-optimized part of code, which I would like to speed up. I have put all matrices to be RandomReal, but in my code they take ...
4
votes
1answer
228 views

Performance of a Do-Loop of variable length

If I'm changing a basis depending on a (non quadratic) matrix $\mathbf{M}\in\mathbb Z^{d\times k}$ and some $\mu\in\mathbb N^k$, i.e. i have an array a of the same ...
1
vote
2answers
311 views

Specifying parts from lists for plotting using Show

I have the following data: ...
2
votes
0answers
289 views

Generating a function which outputs possible chemical reactions

I want to make a list of chemical reactions and I write them down in a $\require{mhchem}\LaTeX$ format. They are of the following form $$NA_n^i+MB_m^j \rightarrow \hat NA_{\hat n}^{\hat i}+\hat ...
0
votes
1answer
148 views

Assign the result of Solve in a list [duplicate]

Possible Duplicate: Assign the results from a Solve to variable(s) I want to assign the results of a Solve command in a list. For example Solve[-((287 s^3)/50) == 0, s] returns {{s -> 0}, ...
4
votes
6answers
226 views

Sorting Matrix elements

I have matrix in as shown, consisting of real numbers and 0. How can I sort it to become out as shown? ...
5
votes
3answers
236 views

Operations on elements of ragged lists

Suppose I have a list of lists with different lengths, sorted from longest to shortest ...
5
votes
4answers
402 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 (...
6
votes
1answer
221 views

Why is MapIndexed better than mapping over a range?

Background I'm working on an application in which I need to create and control two sets of locators. I know from reading the Mathematica documentation and certain posts on Mathematica.SE that this ...
27
votes
4answers
807 views

Filtering beat-to-beat heart rate data

From an experiment, I have a dataset of beat-to-beat heart rate data: a list of the time between each heart beat in [ms]. The data is measured using an infrared optic sensor at the finger tip. The ...
11
votes
3answers
170 views

Why can't I use Sequence to perform a Select like task?

Suppose I wanted to write down a list of $p^2$, for $p$ a prime between $1$ and $20$. I would expect Table[If[PrimeQ[k], k^2, Sequence[]], {k, 1, 20}] to work. ...
3
votes
1answer
223 views

Operations on a List of Vectors (Norm)

I have a List containing vectors. The coordinates are random numbers: r = {RandomReal[{-1, 1}, n], RandomReal[{-1, 1}, n], RandomReal[{-1, 1}, n]}; Now I want to ...
0
votes
2answers
116 views

Matrix conditional operation

Say I have a matrix of: tmp1 = 5; tmp2 = 5; tmp3 = RandomChoice[{0, 1, 2, 3, 4, 5}, {tmp1, tmp2}]; MatrixForm[tmp3] How to do a conditional operation of elements ...
7
votes
2answers
1k views

Building matrices by attaching vectors (columns) and matrices

Having the need to attach a column to a matrix or to join matrices to make longer rows is an operation that I use very frequently and I find the Join function ideal ...
2
votes
1answer
194 views

How do I create a histogram out of this datastructure: x[i] = value_i?

Here is my SSCCE: a[1] = 2; a[2] = 3; a[3] = 6; Histogram[a] This throws and error though. Here are my questions: What kind of data type is a? Is it an ...
7
votes
3answers
365 views

Filter list based on date

What I would like to do is remove entries from a list of instrument data when it is in maintenance. The maintenance data I have is a series of dates which look like this; ...
0
votes
2answers
187 views

How to get a sub range of a larger matrix?

This should be an easy question but I only found a partial solution using All. Say I have a matrix A = 1000 x 5, how to get only a part of that matrix, say B = n x ...
2
votes
3answers
1k views

How to convert output of a For loop into a list

I have written a For loop in my Mathematica notebook. This For loop, when activated, will generate a sequence something like: ...
5
votes
2answers
276 views

How can I force points in a list to have distinct x values?

I have a list of points that may be used for linear interpolation using Interpolation and need to ensure that no two points have the same $x$ value, since, if they ...
1
vote
4answers
171 views

Order of operations for the Table function [duplicate]

Possible Duplicate: Using pure functions in Table I have run into a situation that I do not understand when trying to generate a nested list of pure functions. I have the following code. ...
5
votes
2answers
156 views

How to efficiently find multimap k-itemset frequency

I am doing this to learn association rules. The data d is in format {id, value}, for example: ...
1
vote
3answers
151 views

Selecting a Point that has the Lowest Absolute x/y-coordinate From a List of Points

Given that there is a set of points, for example, {{3,4,2},{5,2,-1}}. How do I go about selecting the point that has the lowest absolute x, y or z-coordinate from ...
5
votes
3answers
195 views

Self-referential list or table of buttons

How could one create a table or list of buttons, such that clicking on a button removes the button itself from the list?
1
vote
0answers
84 views

Non Commutative Multiply [duplicate]

Possible Duplicate: Non-commutative symbolic linear algebra I want to multiply two matrices, for example, A = {{e, f}, {g, h}} B = {{a, b}, {c, d}} ...
5
votes
2answers
283 views
7
votes
5answers
283 views

Making a table with elements like {10i+j, i, j}

Table[10i+j,{i,4},{j,3}] will generate a table that looks like this: {{11,12,13},{21,22,23},{31,32,33},{41,42,43}} I would like ...
2
votes
3answers
185 views

Rearrangement of the list

I have the following list: ...
0
votes
1answer
155 views

Rearranging a biclustered matrix

I currently have a $77\times 38$ matrix, and I have used a clustering algorithm to cluster the row data and column data. The rows and columns of my matrix correspond to a list of country codes (not in ...
1
vote
2answers
120 views

Return a string from a vector containing a string and a number

I currently have a List of the form, {{String_1, 8.}, {String_2, `101.}, {String_3, 37.}, ..., {String_n, 28.}} Along with another list, ...
5
votes
1answer
276 views

DeleteCases messing with my mind

I'm losing my mind. Please tell me my laptop is doing weird things and not me. Or do I need to get committed someplace? ...
11
votes
3answers
243 views

Threading over a list of lists of lists and a list of atomic expressions

Although I solved the following problem using MapThread, I'm curious about why Thread does not work as I expect it to here. ...
8
votes
2answers
485 views

Fluorescence Correlation Spectroscopy Simulation

I am simulating Fluorescence Correlation Spectroscopy which basically involves tracking the random motion of particles in a box with periodic boundary conditions and then calculating their intensity ...
7
votes
3answers
365 views

What is the correct way to conditionally add elements to lists? [duplicate]

Possible Duplicate: How to avoid returning a Null if there is no “else” condition in an If contruct I have several situations where I need to conditionally add an element to a list, at ...
1
vote
3answers
202 views

Adding headers to sublists

I would like to transform the following list: ...
6
votes
2answers
181 views

Can Tuples help simplify this?

I have a list {1, 2, 3, 4} and wish to form {{{1,2},{3,4}}, {{1,3},{2,4}}, {{1,4},{2,3}}} I ended up doing it manually ...
9
votes
2answers
180 views

How to find synchronization offset?

I have 2 sets of data containing delays (audio / video). ...
7
votes
3answers
239 views

Restricted accumulation of values

Please consider the following list data. I was trying to accumulate data until the result turns positive the first time and ...
5
votes
1answer
242 views

Numbering element in descending order

How can I numbering the elements in descending order of second elements of sublists? For example, if I have the list which is ...
2
votes
3answers
196 views

Adding elements in the sublists

How can I add the elements in the sublists? For example, if I have the list which is m={{1,3},{2,3},{4,1}} then, the output that I want is ...