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

learn more… | top users | synonyms (3)

3
votes
1answer
93 views

How to efficiently select elements from a Hash?

How can I write an efficient version of the following selection statement: Keys[Select[hash, # < constant &]]; // AbsoluteTiming hash can be made from: ...
3
votes
2answers
89 views

Wrapping Interval Notation for Take

I'm trying to implement the solution to a math problem in Mathematica, but my code can't handle a particular boundary case. I think that I could implement a function that would do what I want it to, ...
0
votes
3answers
99 views

How to manipulate with external data?

I have a .txt file which contains a lot of triples (a, b, c) (one per row) which should be coefficients of my equation ax^2+bx+c=0. I want to include each triple in .nb file and solve each equation. ...
-2
votes
1answer
112 views

How can I produce a list of solutions for a function which is updated with updated variables using for loop?

I need to loop over a set of equations, solving for X and adding the new X value to the old X value at each step. The output I need is a list ...
10
votes
3answers
174 views

Pick with nested list

I have a list of pairs of values. Some of those pairs are invalid based on another list. I would like to select only the valid pairs. ...
6
votes
3answers
169 views

Mapping a function over the parts of a deeply nested Array

I have two tensors: tensorS = Array[Subscript[s, #1, #2, #3, #4] &, {2, 16, 16, 19}]; tensorR = Array[Subscript[r, #1, #2, #3] &, {2, 16, 19}]; ...
10
votes
4answers
429 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 ...
2
votes
2answers
90 views

How to make functions from datasets

I have a csv that encodes the results of plugging certain parameters (say, A and B) into certain functions (say, ...
2
votes
1answer
61 views

Manipulating lists with uneven amounts of entries

So I have a list like so list={{a},{b,c},{d,e,f},{g,h}} and the basic logic I want is to be able to manipulate each of the nested lists individually. So If I ...
6
votes
2answers
306 views

Finding the coefficient of a certain power in a generating function

I want to compute $(t^1+\dots +t^5)(t^2+\dots+ t^6)(t^3+\dots +t^9)$ and find the coefficient of $t^{15}$ for example. $t$ is an indeterminate Now in Maple this is simply as ...
0
votes
2answers
150 views

Indirect transformation based on a list of data points

I have a set of data which describes the Intensity function $Int(q)$ as a function of $q$. The data list provided below provides the shape of $Int(q)$ versus $q$.How can I use this information to ...
5
votes
1answer
129 views

How to efficiently select element in a list of lists?

How can I write an efficient version of the following statement? Cases[list, {_, feature_} /; feature < constant]; // AbsoluteTiming List is of the form, list ...
3
votes
3answers
159 views

Breaking up combined data into several smaller data sets

I have one combined data with first number as the x-value and the remaining as different y-axis values (y1,y2,y3...). How do I break this combined list, data= (x,y1,y2,y3...) into smaller lists, such ...
6
votes
2answers
213 views

Is there a bug in the Part function of Mathematica 10?

I am using Mathematica 10 now. I typed code below {{1, 2}, {2, 4}, {3, 6}, {4, 8}}[[;; , 1]][[1]] and this gives result 1 ...
2
votes
1answer
62 views

How to select elements with a specific style of a list?

Suppose I have a list: where 3 'up's of the list are red(I've made it to Cell Expression as follows). ...
3
votes
2answers
266 views

Why does a certain CSV file import properly into LibreOffice but not into Mathematica 10.0?

I'm working on a project involving data manipulation and it involves working with CSV files. I know that the files are properly formatted as when I import them into LibreOffice, all of the columns ...
8
votes
3answers
299 views

How to remove a line of a matrix if not all elements are numeric?

I have a matrix a n columns and m lines. I'd like to efficiently remove the lines that are not entirely composed of numeric ...
1
vote
1answer
61 views

Appending functions to a list [duplicate]

Could someone please explain the difference between these methods, and possibly a nicer way to get the first result? (This is a toy example and in my real program I'd like to use ...
3
votes
2answers
89 views

Is the MaximalBy function still used [closed]

On the mathematica reference website it gives examples using the MaximalBy function, However when I am using it, I see no desired output. This leads me to wonder if mathematica has stopped using this ...
2
votes
3answers
185 views

Alternatives to Append/AppendTo for generating a list in an interactive DynamicModule?

I have a stack of timelapse microscopy images that I am trying to segment frame-by-frame using some of Mathematica's image processing functions. I have created a little interactive DynamicModule with ...
7
votes
1answer
299 views

Tuples without self-loop

I have a simple question coincerning the Mathematica function Tuple. Currently, I apply the following code ...
15
votes
8answers
587 views

UnFlatten an array into a ragged matrix

Trying to unflatten an array that was part of ragged array of sub matrices. As input we have flattened array: ...
8
votes
5answers
218 views

How to do DateDifference on table items containing dates

I have a Table with data in form {{date}, value}: ...
6
votes
0answers
56 views

Listable compiled functions used in NMinimize

This is an example from MMA: cListable = Compile[{x}, (x-1)^2, RuntimeAttributes -> {Listable}] In case of single entry: ...
6
votes
5answers
309 views

Find patterns in a list

again, I have a list like this: ...
3
votes
1answer
83 views

Use Style on list elements

I have a list like this: list = {0, 0, 0, 1, 1, 1} I want to color all the 0's in red, but I dont want to count through all the elements, like in my solutions, ...
4
votes
2answers
116 views

Is there a built-in function to map a list of heads to a list of data?

Assume that this built-in function is called func. What I want is func[{f,g},{a,b,c}] will return the following result: ...
3
votes
1answer
55 views

Part specification error only in LogPlot

I've a problem. I defined a simple list and a function like below: lst := {5, 10, 20} f[m_] := lst[[Floor[m/10]]]; and drew a plot ...
5
votes
2answers
112 views

Return value of Reap when using tags

I've noticed a behaviour of Reap that I don't quite understand yet. Suppose I want to Sow several values during a computation. ...
16
votes
4answers
347 views

Make MapIndexed listable

My goal is to apply MapIndexed to every element of a nested list without destroying the arithmetic operations within the elements. For example, let's start with ...
1
vote
2answers
648 views

Computing 10-dimensional volume of a 9-sphere [closed]

I'm trying to compute 10-dimensional volume of a 9-sphere with radius r using Monte Carlo. ...
1
vote
1answer
144 views
2
votes
2answers
149 views

How to get the current index during a Scan iteration?

Is there a special keyword to get the current index in Scan ? For example, let say I have the following code : ...
6
votes
2answers
243 views

Converting a string into a nested list of strings

The following string can be converted easily into a list with ToExpression ...
3
votes
2answers
104 views

How to modify the elements of a list in a loop?

I have a list with points coordinates. And I'm trying to traverse it and perform some matrix operations on each point. But I have a problem with storing modified points in the initial list instead of ...
2
votes
1answer
102 views

How to build a list of constraints for NMinimize

Let's say I have aset = {-1, 0, 2}. I would like to create a variable Var that takes values from that set, i.e. ...
7
votes
5answers
319 views

How to display operations on list elements

When applying some arithmetic operation on two lists, I'd like to display the actual operations between the elements of each list. For example, {1, 1} + {1, -1} ...
1
vote
3answers
136 views

How to ReplaceAll independent of depth?

I have a big list which in principle can be described as this more compact list : ...
0
votes
1answer
144 views

How to plot data points in the form X, Y, E(X, Y) where X and Y coordinates are not ordered?

I have got a file with field values (RF simulation of a resonator) which consists of 3 columns: X and Y cartesian coordinates ...
1
vote
1answer
108 views

Remove curly brackets _completely_ to map a function to the elements of a list [duplicate]

Most list manipulations can be done with Flatten, Partition and Take. I didn't managed to ...
2
votes
4answers
153 views

Import xls data with dates

I have an excel table that have 2 columns, the first one are dates, and the second one are values. I want to plot the value vs the date. I need to: first clean all the non numbers strings like ...
5
votes
1answer
321 views

How to split a Dataset into training and testing for machine learning?

Suppose I have iris data In the Dataset Format. How to split the iris data Into training and testing for Machine learning? For example,Transform the data for Classify.
6
votes
3answers
295 views

Rotate lines around their midpoint

I am trying to rotate a series of lines by the same angle around their centre point. Say each line is defined by a co-ordinate at each end, simplified example below of a typical dataset. ...
1
vote
1answer
77 views

How can I write a function which takes another function of a variable and the variable itself as arguments and gives a list of critical points?

This is an exercise from Power Programming with Mathematica by Wagner. I need a function which takes a function and a variable as arguments, like this: critpts[f_,x_]:= and then on the rhs I've got ...
3
votes
1answer
111 views

Read and write files

I have a text file, its content is(for example): ...
3
votes
4answers
195 views

Replace all symbols in a matrix with their numbered forms

I have a matrix made mostly from "x" with a few 0's thrown in: ...
6
votes
2answers
182 views

Problem when defining function through NIntegrate and NDSolve and Interpolation - Bug?

More than a single question, I have some doubts about the output of certain functions when defined through the result of other calculations. I am an active user of Mathematica, but maybe I haven't ...
4
votes
3answers
161 views

unlisting a nested list

I have a list like this: list = {{a,{1,2,3}},{b,{1,2,4}},{c,{{1,4,5,5},{6,3,2,1}}}} This is a nested list which each element has a name. I want to export it to ...
1
vote
3answers
118 views

Removing some data and replacing them with new ones

I have a data list where the elements have the form (time, velocity ). I need to remove some malformed elements in places where the data does not change smoothly and then replace those points by ...
1
vote
2answers
169 views

Replace a value in a nested array

When I run the following, ...