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

learn more… | top users | synonyms (3)

3
votes
3answers
82 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 ...
4
votes
1answer
135 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 ...
1
vote
1answer
86 views

references in a nested matrix

I have a nested matrix n: ...
2
votes
1answer
52 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
162 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 ...
6
votes
3answers
262 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
41 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 ...
2
votes
3answers
128 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 ...
3
votes
2answers
74 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 ...
12
votes
8answers
509 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: ...
6
votes
5answers
274 views

Find patterns in a list

again, I have a list like this: ...
6
votes
1answer
239 views

Tuples without self-loop

I have a simple question coincerning the Mathematica function Tuple. Currently, I apply the following code ...
7
votes
5answers
183 views

How to do DateDifference on table items containing dates

I have a Table with data in form {{date}, value}: ...
4
votes
0answers
44 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: ...
3
votes
1answer
74 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, ...
15
votes
4answers
298 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 ...
4
votes
2answers
102 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
48 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 ...
4
votes
3answers
143 views

How to test if all the elements in a list are Integers? [closed]

Consider a list such as s={1,2,3,3,5,6,3} With IntegerQ[number] , you know if number is an ...
5
votes
2answers
91 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. ...
1
vote
2answers
620 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
91 views
2
votes
2answers
137 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
188 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
313 views

How to plot several functions without jumping? (multiple eigenvalues of a system as functions of 2 parameters)

I've been working on this research problem for months with some success by no global/proper solution to the problem. So I have square, Hermitian matrices of various sizes ($8,20,38$ dimensions) with ...
3
votes
2answers
95 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 ...
5
votes
5answers
286 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} ...
7
votes
2answers
1k views

Get the coordinates from ContourPlot and RegionPlot

How do I get the coordinates from a contour plot I've done in Mathematica? For example, I have a two-variable function f[x, y], for which I can make a contour plot: ...
2
votes
1answer
76 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. ...
1
vote
3answers
121 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
115 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 ...
5
votes
1answer
148 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.
4
votes
5answers
530 views

Convert a string into a list of numbers

I got the following problem I don't know how to solve or if it's at all possible to solve(I'm quite new to Mathematica and don't have an IT background, so please explain slowly if possible:)) I'm ...
1
vote
1answer
54 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
107 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 ...
6
votes
3answers
245 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
72 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 ...
6
votes
8answers
232 views

Merging lists and adding common elements [duplicate]

I have two 2D arrays where some of the x-values are identical, L={{1,1},{2,2},{3,3}}; J={{0,1},{2,2},{4,4}}; I want to add these lists in the following way ...
6
votes
2answers
140 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 ...
3
votes
1answer
99 views

Read and write files

I have a text file, its content is(for example): ...
10
votes
2answers
275 views

Solving the magic backyard puzzle with MMA

I was trying to solve this puzzle using mma It looks like the generalization of the magic square. Anyway here my attempt:- There are four columns $(x,y,z,w)$ and nine rowa which are denoted by the ...
1
vote
1answer
83 views

Inverting matrix of unknown size

I have a matrix that has a variable number of columns and rows (but it is always square). The matrix is: $$ \Gamma = \begin{bmatrix} \Theta & 0 & 0 & 0 & T & 0 & R_j \\ ...
1
vote
3answers
109 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 ...
4
votes
3answers
151 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 ...
3
votes
4answers
172 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: ...
1
vote
2answers
142 views

Replace a value in a nested array

When I run the following, ...
2
votes
3answers
67 views

Take a list with the amounts of the random samples from another list while holding the index

I have a list called cant with some amounts of samples to take from the list community as follows: ...
3
votes
5answers
195 views

First pair out of order

I would like to know how to efficiently determine the first pair of elements in a list that are not in order according to some predicate p. That is, list[i] > list[j] according to p, and i is the ...
0
votes
2answers
135 views
4
votes
8answers
375 views

How to sort my list?

For example I have two lists of such structure L1 = {{"Australia",a1}, {"USA",a2}, {"Norway",a3},...} L2 = {{"Russia",b1}, {"Norway",b2}, {"Japan",b3},...} I ...