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

learn more… | top users | synonyms (4)

2
votes
3answers
88 views

Find position avoiding For loop

I have a list: {a,b,c,d,e,f} And a function sizeFunc[element_] which returns the size ...
2
votes
1answer
36 views

Dropping rational coefficients

I have a list of expressions (they all are exact numeric quantities, not containing any variables), some of them have integer or rationals coefficients, or complex coefficients with rational or ...
10
votes
2answers
3k views

How to get Matlab data imported with the same dimensions?

I have some Matlab image data with the following dimensions (output is from Matlab): >> size(im) ans = 86 86 3 45 The data imports just fine ...
1
vote
0answers
27 views

Accessing the elements of a list of values [on hold]

I have a list of polynomials (all with the variable x) called lyle and a function that accesses this list and evaluates it at ...
0
votes
2answers
253 views

Animate a sequence of bitmap-like data Mathematica 9.0.0

I am new to Mathematica, but already find it a very nice tool. Right now I am trying to create an animation of numeric data, where each frame corresponds to a distinct text file with a table-like ...
2
votes
2answers
93 views

Replace elements in some region in a list

I want to replace some elements in list. Assume that we have A={{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}} and we want to replace elements ...
0
votes
1answer
59 views

Match a variable name pattern [duplicate]

I have a list of variables: {RBI,RCD,ASD,FGH} I want to select only those whose name starts with R. Using the pattern Rx_ ...
1
vote
1answer
41 views

Sort and Save Matrices Eigenvectors to a Larger Matrix

We are going to sort and save all orthoginalized-eigenvectors of 4*4 random matrices (produced in any iteration) to a larger matrix such as storagematrix. Since, produced random matrices are 4*4, ...
2
votes
3answers
487 views

For loop in Length computation code

Here is a code I wrote that is supposed to give the length of list after some splitting and regrouping. But it is inefficient. Is there a way to rewrite in more professional and efficient way? I guess ...
2
votes
3answers
110 views

Join nested lists based on first and last elements within each list

I have a nested list like this: test1 = {{1, 3}, {1, 4}, {1, 7}, {2, 1}, {3, 5}, {4, 1}, {5, 2}, {6, 1}, {7, 6}} I want to join the lists together depending on ...
12
votes
5answers
584 views

Is there a way to riffle more than two lists?

I thought Riffle would generalize such that Riffle[{a,b,c},{1,2,3},{x,y,z}] would return ...
9
votes
2answers
247 views

Is there a built-in equivalent to Python's enumerate?

Python's built-in function enumerate takes an iterable over $(a_0, a_1, \dots )$ as argument and returns an iterable over the sequence of pairs $((0, a_0), (1, ...
0
votes
0answers
36 views

sum and infinity [on hold]

I posed this question a few days ago that is no answer, but now I will clarify. If you have the sums $ (1+2+..+n) + (1+2+3+..+n-1)+ (1+2+3+..+n-2)+(1+2+3+..+n-3)+...+(1+2+3)+(1+2)+1$ for large ...
0
votes
2answers
49 views

Identify a scalar, a list

I have a symbolic scalar m2 and a symbolic list (representing a 3x3 matrix) A. I want a function which does something like: ...
7
votes
4answers
222 views

Improving a selection routine

How can this code for extracting the smallest (absolute) real value be improved? and would it be simpler using associations? ...
3
votes
3answers
149 views

Move element inside a list

I need to change the position of a single element in a list. Example: I start with: {a,b,c,d,e,f} I want to move the a before ...
0
votes
1answer
60 views

Do TakeWhile and LengthWhile work with Greater? [closed]

TakeWhile[{1, 2, 3, 4, 5}, # > 3 &] gives me {}. Similarly ...
1
vote
2answers
59 views

Convert a list of lists of rules to a list of values [closed]

I have a list of the following form: thisVeryExcitingList={{x->1},{x->2},{x->3}} I would like to convert it to the form ...
6
votes
1answer
180 views

Bug in LengthWhile?

Bug introduced in 8.0.0 and fixed in 8.0.1 Is this a bug or my MMA went insane or I'm missing something? LengthWhile[Reverse@IntegerDigits[1000], # == 0 &] ...
11
votes
1answer
148 views

ListConvolve Memory Hemorrhage

Bug introduced in 10.0.0 and fixed in 10.2.0. I wrote a routine that convolves an impulse response array with a test array and checks for the RMS difference between that convolution and a data ...
2
votes
3answers
180 views

Delete rows based on specific periods

I have data (.xlsx format): two columns - data in first column imported as DateObject (dates with specific time), data in second column are numbers (113388.28, 865165.98 etc.). I want to delete the ...
0
votes
0answers
35 views

Creating multiple plots from multiple lists [closed]

I'm having trouble creating a series of list plots from a set of lists. I have 19 lists and I would like to have 19 Listplots. Here is an example of what i've got now: ...
0
votes
0answers
45 views

Programming style for destructive modifying array arguments [closed]

ReplacePart[] returns a new array, leaving its array argument unmodified. a={{1,2},{3,4}; ...
0
votes
3answers
73 views

Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
-1
votes
2answers
66 views

Delete Element within a List based on the Order [closed]

I want to do the following, deleting the element of a list that do not match an increasing order as example: {1,2,3,4,6,5,7,8}->{1,2,3,4,6,7,8} I've thought of using DeleteCases but I'm not able to ...
21
votes
2answers
855 views

How can the {x,y,z} points that fall on the outer boundary of a set of values be selected and smoothly surfaced?

For a given set of x,y,z values, that may, or may not form a uniform shape, how can the center of the data cloud be found, and the surface points be located and a solid smooth surface created from ...
29
votes
2answers
955 views

DeleteDuplicates not deleting duplicates

Bug introduced in 9.0 and fixed in 10.0.0 It is not surprising that DeleteDuplicates[{5,5.}] returns {5,5.} because ...
0
votes
0answers
25 views

How to show different DateListPlots with a popupmenu with different plot parameters

I bumped into the following problem: I have a relatively large dataset (250k row,11col), imported in from an SQL database. The format of the data is {{year,m,d,h,m,s},value}. I have successfully ...
0
votes
1answer
67 views

When plot a list, how to Manipulate a sequence of defined functions at the same time?

I am trying to plot a sequence of functions, for example{(a+b)^i},{i,1,100}. All the expressions I have stored in the list. Now I want to plot them and see how their value would change if I change ...
0
votes
3answers
50 views

Dynamic insertion of variables

I have a list of eigenvectors of a given matrix. I need to programmatically modify this list by multiplying each vector by a variable #i, e.g. ...
25
votes
3answers
2k views

Extracting values from nested rules in JSON data

I have been using Mathematica to analyse some data from the StackExchange API. It is conveniently available in JSON form, which Mathematica interprets as replacement rules. However, some of the rules ...
0
votes
1answer
74 views

Bin a large matrix

I have a large dataset and I'm trying to plot its scatterplot as well as an overlayed set of binned "summary" data points (in a different color of course). My intended effect is similar to this one ...
-1
votes
2answers
43 views
0
votes
1answer
218 views

Making table and plotting results of NDSolve problem

I am trying to solve two equation to find /[Phi][x] and plot h vs. /[Phi][x] for different values of L.I tried by writing as: ...
5
votes
7answers
424 views

List manipulation challenge

It's necessary to get from list = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3},{a4, b4, c4}, {a5, b5, c5}}; I'd like to do this with ...
0
votes
0answers
32 views
1
vote
1answer
237 views

DeleteCases that match partially [duplicate]

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
3answers
109 views

Positions of a string in a list [duplicate]

Sorry for the bad title..Didn't know how to describe this, feel free to change it to be more specific. I have a list in this form: ...
0
votes
1answer
48 views

Module using for creating a table [closed]

I want to have a 4 tables with using of module. Unfortunately I don't know why doesn't it work ...
-2
votes
3answers
82 views

Applying a function to a list with fixed intervals and fill the resulting list [closed]

I want to apply a function f to a list with fixed intervals, and then fill the gaps of the resulting list, as shown in the following picture. Since it will be run ...
2
votes
1answer
61 views

List of list to list of rules

I have a list of this type p = {{y, 1, 3}, {x, 2, 0}, {z, 3, 1/(k + 1)}} I can use a Do loop that is ...
6
votes
8answers
776 views

Finding the midpoints of an ordered list of numbers

Suppose that I have an ordered list of numbers. The numbers in the list may be evenly spaced, but they may not be. Here are two examples, list1 and ...
7
votes
1answer
97 views

Converting a Table to a Dataset

I feel like this is a simple task, and there may be a built in method to doing this (but I can't find it if there is). I would like to be able to take a table and convert it into a structured Dataset. ...
1
vote
4answers
104 views

Difficulties with list manipulation

I have a list of five elements. For example, list1 = {a1, a2, a3, a4, a5}; I'm trying to get a list: ...
0
votes
0answers
20 views

Specifying plot markers (filled diamonds or squares) [duplicate]

I can plot my list data and I can use of specifying circle to show my plot-markers. I used of Mr.Wizard comments on that page. But I don't know how can I fill the circles of those plot-markers with ...
1
vote
1answer
73 views

Factor terms by kets

I have an expression that contains several kets with numerical factors. I would like to retrieve the individual kets and store each individually as a list element. The expression is as follows: ...
5
votes
3answers
207 views

how to concatenate a list of a list of strings

I have two lists of lists, La and Lb that I want to concatenate so that every element of a list n in La is concatenated with the corresponding element of list n in Lb. For example: La = {{P, O, O, ...
3
votes
6answers
548 views
1
vote
1answer
52 views

Adding another looping element with a list

I have code that is looping on to elements and is working shown below ...