Tagged Questions

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

learn more… | top users | synonyms (3)

0
votes
1answer
556 views

Find Roots in Do loop

Task: Finding roots in loop t = List[1, 2, 3, 4, 5] fx[x_] := a*x^2 - 5 List[Do[Print[FindRoot[fx[k] == 1, {a, 1}]], {k, 0, 5}]] Output: Currently the output is ...
3
votes
2answers
242 views

Listable compiled function using Map

I'm trying to minimize the computation time of problem which is too long to post. I use compilein order to gain some speed. To increase speed I would like to use ...
0
votes
3answers
300 views

Finding an index with certain conditions

EDIT: I need to find out an index i which depends on certain conditions and I'm not able to implement it. I have a list (time points) $t_i$ and two constants $a,c$ ...
9
votes
5answers
541 views

Counting the population of integers

Suppose that myData is a list of sublists. Each sublist has a length of one or greater and contains any number of replicates of the integers 1, 2, 3, and 4. I ...
0
votes
0answers
62 views

get while loop output into a list [duplicate]

I would like to get the output from this while loop and use it as a list so I can count the frequency of the various tuples.. ...
0
votes
2answers
257 views

Converting a list of replacement rules into a list of real values [duplicate]

The following command outputs a list of replacement rules. ...
14
votes
3answers
399 views

Quick multiple selections from a list

What is the fastest way to make multiple selections from a list? Compiled methods included. For example, here are two methods for selecting a subset, compared:- ...
2
votes
2answers
415 views

Replacing values of a function

I have recently starting using Mathematica and have recently come to what seems as an impasse in my understanding of the language. If this is too "tell me how to do it" I would certainly understand. ...
9
votes
5answers
312 views

How can I remove matching sublists from my list?

I want to use DeleteCases (or any appropriate function) to remove elements of a list, which in turn are lists of fixed size. The rule I wish to apply is that any ...
6
votes
3answers
341 views

Delete elements from a list really fast

I have this bit of code that works, but it's very slow when there are 600k elements in the list: ...
0
votes
1answer
155 views

Discrete 3D plots of median ratios of two 2D matrices of lists of values

Lets say I have 2 2D arrays where each cell contains a list of values: Example: ...
5
votes
1answer
885 views

How do I find the Euclidean distance between one point and all the points in a list?

I want to find the Euclidean distance between one point (x1) and a list of points (y1), which contains a lot of coordinates x1 = killer[[2]] {6.05102, ...
6
votes
2answers
849 views

Elegant way to handle columns operations

Inspired by this question from @sjdh and by my recurrent use of columns operations in database sets, I was looking for one way to make columns operations more symetric, so I can handle with matrix and ...
3
votes
3answers
183 views

Count items in a list that occur before a date

I have a list of dates that happen throughout 2013. I wish to construct a graph showing a cumulative total of elements that happen before that date. I have a working algorithm, but it seems too slow ...
8
votes
3answers
556 views

How to rebuild original data from a histogram?

I have data in the following form. I have a list of values and a list of frequencies that indicate how often each value has occurred. Example list of values: ...
11
votes
2answers
597 views

Vlookup function as Excel in Mathematica

How can we create a Vlookup function, similar to what we have in Excel? So if we have a table a and another b, we could add ...
3
votes
1answer
170 views

Efficiently finding the maximum value of a column in a matrix

Imagine I have a matrix of the following form: TestArray = $((a_1,b_1,...),(a_2,b_2,...),(a_3,b_3,...),...)$, where a specific example might be: TestArray = ...
2
votes
1answer
150 views

writing a function using multiple variables

I am fairly new to Mathematica and am trying to write a function for the equation: xx = [x/(Sqrt[h^2 + d^2 + y^2]))*(Sqrt[h^2 + (d + yy)^2]) where h, d are known ...
1
vote
1answer
230 views

Frequency of elements in a list (merging tally data) [duplicate]

I've got a list in the format of list={{a,1},{a,1},{b,1},{c,1},{b,1}} And I want it to "compress" into a list of pairs ...
4
votes
2answers
227 views

How can I eliminate equivalent equations from a list?

I want to find the numbers $a$, $b$, $c$, $d$ of the plane $ax + by +cz +d = 0$ which make the distance from the point $M(1,2,3)$ to the plane equal to 2. I tried ...
5
votes
3answers
3k views

Summing along rows or columns of a matrix

I have a list of rows in database such as {{a,b,c}, {d,e,f},{g,h,i}} I want to be able to add each row across and each column down (like a spreadsheet). In other ...
0
votes
1answer
310 views

how to work with list as function parameter

I want to output an arrow based on input from user and I tried writing this small function to achieve this: ...
4
votes
2answers
724 views

Selecting multiple columns from a matrix?

Sample data: ...
12
votes
1answer
352 views

How can I collect data for visualization of quick sort?

I know how to implement quick sort in Mathematica. But I don't know how to get the temp data for visualization, because I used recursion. I want the effect similar to this: ...
1
vote
1answer
156 views

ListPlot does not recognize my list

I have created a list in Mathematica and for some reason it does not want to Plot my list in pairs {x1,y1}, but instead does {y1,y2} even though I partitioned the list to make it in the correct ...
3
votes
3answers
255 views

How to change a value within a list of lists?

I essentially have two questions, both are related. 1) How do I change a value within a list of lists (I provided a example problem)? 2) Why does my code not work? I have a list which was created ...
27
votes
2answers
749 views

DeleteDuplicates not deleting duplicates

It is not surprising that DeleteDuplicates[{5,5.}] returns {5,5.} because DeleteDuplicates ...
0
votes
2answers
584 views

Assign the output of a loop [duplicate]

Possible Duplicate: Creating a table/Matrix during a For loop Yet another simple question. ...
6
votes
6answers
393 views

How can I merge two lists in a special way?

It's been over a year since I've used Mathematica, and I'm having a total brain fart on a home project. I'd like to take an existing list of lists, say, ...
2
votes
2answers
388 views

How can I transform a list of binary digits into integers?

I want to transform a list of binary digits into integers. With the Table function, I produce four lists of binary digits of length 32. Then I tried to turn these ...
1
vote
1answer
134 views

How can I make my code simpler?

I want to find similar letters ...
7
votes
3answers
321 views

Find all the last weekends in a year

In order to obtain the weekends of a year you'd use something like this: ...
15
votes
7answers
825 views

Removing elements from a list which appear in another list

There are two lists {a, b, c, a, d, a, e} and {a, c, a}. I need to remove those elements from the first list which appears in a second list, to get {b, d, a, e}
2
votes
1answer
130 views

Error in setting matrix elements [duplicate]

Possible Duplicate: How to Set parts of indexed lists? For better organization of my code, sometime I use data objects in the form: ...
5
votes
3answers
381 views

Efficiently extracting an array subset given a separate array

I have two arrays. The first array consists of tens of millions of rows and three columns with a string, a number, and a string. ...
8
votes
3answers
700 views

How can I get a running sum for a list?

I've got following data I'm reading from a file: ...
6
votes
3answers
965 views

Ways to compute inner products of tensors

One way to evaluate the following sums is combining Table and Sum: $u_{abcd} = \sum_{e=1}^3 v_{aeb}w_{ced}$ $q_{ab} = \sum_{d,e=1}^3 v_{d e a}w_{deb}$ It will look like ...
4
votes
2answers
459 views

How find the first element of a list greater than zero (or another criterion) when there is a symbol in the list?

I need to find the position of the first element of a list that is either greater than zero (or some other criterion) or a symbol. Something like ...
17
votes
3answers
735 views

Optimising 2D binning code

I have a set of (x,y,z) data, 45,000 to be precise and I want to bin the z values in 256 equidistant bins based on their (x,y) values. The final array should be a set of 256x256 array with each slot ...
6
votes
5answers
329 views

Handling holidays in financial time series

I have two lists: list1and list2, which are financial time series with only 2 variables—date and price. The problem is: these ...
5
votes
2answers
278 views

Concatenate strings from different levels of list

After a lot of trouble I've finally come pretty close to what I want to do. I now have a list that looks like this: ...
0
votes
0answers
49 views

How to ContourPlot a Table? [duplicate]

Possible Duplicate: Why is ContourPlot not displaying this curve? Why do I have to put Evaluate[] here I'm trying to plot certain contours of a function $f:\mathbb R^2\to\mathbb R$. What I ...
1
vote
1answer
228 views

System Identification with large Input/Output Data

I have some questions about system identification. I made some measurement of current step (input) and voltage response(output) and I want to fine the parameters of my impedance. The sample rate is ...
4
votes
1answer
135 views

RecurrenceTable with vector

Mathematica can do a RecurrenceTable with a vector, here is a simple example: RecurrenceTable[{x[n + 1] == 2* x[n], x[0] == {1, 2, 3}}, x, {n, 3}] with output ...
1
vote
3answers
506 views

Ignore missing data while doing a Mean

I want to compute the mean of a list while ignoring missing values, but I don't find a lot of information on how to deal with Missing data in Mathematica. I have a list like : ...
2
votes
2answers
167 views

Modify a sub-part of a sub-list only

I have this list: a = {{{0, 0}, {1, 7}, {2, 0}, {3, 2}, {4, 7}}, {{0, 0}, {1, 0}, {2, 1}, {3, 2}, {4, 7}}} and I'd like to transform it to this: ...
6
votes
5answers
480 views

Elementwise join

I have two tensors of arbitrary but equal rank n (and equal dimensions): A and B, and I want to get a third tensor of rank n + ...
6
votes
1answer
142 views

Implementing Remainder Tree

I want to implement Remainder Tree based on this. With the answers on SE I've come up with: ...
14
votes
9answers
487 views

Distributing elements across a list of lists

I have two lists: u = {{1, 3}, {2, 6}, {3, 9}} v = {0, 4} and I want to obtain this list from them: ...
3
votes
2answers
108 views

Nested List Product

I want to apply Times on the elements of a list such that: ...