# Tagged Questions

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

759 views

### Newton-Raphson Method and the Van der Waal Equation Coding question

So I need to find Specific Volumes using the Newton Method from the Van der Waal equation over a change of constant Temperature but variant Pressure. I have been able to make a list of however many ...
113 views

### How do I operate on this list elegantly? [duplicate]

calibData = { {200, 10}, {100, 20} } MapAt[N, MapAt[Log10, calibData, {;; , 1}], {;; , 1}] I want to apply a base 10 Log to the first element of each tuple. ...
399 views

### Taking real and imaginary parts of indexed functions and speeding up ComplexExpand

I am setting up a large system of ODEs and in order to use the IDA method (which is sig. faster for my system and thus attractive), I must split my equations into real and imaginary parts. I am ...
102 views

### List Manipulation matrices

I have the following two lists: List A: ...
142 views

...
300 views

### How do I find the number of countries that have a type of industry?

I am trying to find the number of countries that have a certain type of industry. Currently, I have this code: ...
72 views

### Don't understand why Do-loop index is not evaluated in Play expression

So here is some weird behavior: When I create a list inside a loop whose elements are Play functions, with arguments that depend on the counter, it is as if the counter is being stored symbolically, ...
343 views

### Do loop - variable does not change [duplicate]

I got the follwing code which should add a '1' 100 times to an empty list. plotVals = {} Do[Append[plotVals, 1], {l, 1, Nmax}]; The output is again an empty ...
721 views

### Counting sublists containing 0

Given a list: data = {{0, 2}, {0, 0}, {1, 0}, {1, 2}, {2, 3}}. I would like to count the number of sublists which contain zero. ...
850 views

### Position of First nonzero number

I want to know is there any one line code to find position of first nonzero number without calculating position of all non zero numbers. For example, ...
491 views

### Row-Reduced-Echelon-Form with Equation Parameters for Consistent Systems

I often do row-reduced-echelon-form (RREF) calculations that involve parameters using the RowReduce command. Most times, I want to know which parameters make the system consistent. For example: ...
14 views

### Part::partd error on one of two similar lists [duplicate]

I have run into a problem that I can't explain. Here is the code: ...
133 views

### Expanding lists with split strings

I've got data of the type: list = {"Class","MW","10 - 11"} which I would like to split into a number of lists based on the number of characters in the second ...
76 views

### Exporting data which includes rule as number only and use lhs as label

I use listD1 = Table[FindRoot[(*my eqns depending on k*), {k, conc}] to get a list of solutions for the different values of ...
239 views

### how to export nested list

I have a ListPlot where I extract my data again using pts1 = Cases[(*I put my list plot here*), , x_Point :> First@x, Infinity]; which gives me the data as ...
87 views

### Generate higher dimensional box vectors

I'd like to generate integer vectors in $\{-M,-M+1,\dots,M\}^n$, where $M$ and $n$ are parameters. For a fixed $n$, say $n=3$ for instance, I only know I can use ...
569 views

### Elegantly adding two differently spaced lists of ordered pairs $(x, y)$

Suppose that I have two lists, list1 and list2, of ordered pairs $(x, y)$. The two lists are differently spaced in $x$; some ...
305 views

### Ranking a vector containing ties

How can I rank a vector such that the ties are replaced by their middle ranks. For example, {1, 2, 2, 3}. I want to rank this vector but the ties must be replaced ...
112 views

### Problem with List Dimension Outer Map [duplicate]

I am currently handling a big list which has the following dimension: {6, 3, 4, 2, 2, 1, 8} where the last number 8 represent a ...
473 views

### How can I define a Listable function only apply to a vector?

Consider the function f which should behave as f[{{1, 2}, {3, 4}, {5, 6, 7}}] ...
223 views

### Variable partitioning of the data in the form of “list of lists”

I am looking for a way for variable partitioning of the data in the form of a "list of lists" for interpolating the imported data from excel. The data looks like: ...
191 views

### Levels and slots

I am struggling with levels and #, if I understand this I think I will be able to grasp the entire concept. ...
180 views

### Quickly selecting for points in a set that are within a critical distance of points in another set

Imagine two lists of two-dimensional coordinates: listA = RandomReal[{0,100},{202,2}]; listB = RandomReal[{0,100},{97,2}]; I'm attempting to quickly generate a ...
111 views

### Why does Rescale performance vary significantly based on the real number values in a list?

I have a list of the form: testList = Table[{Flatten[RandomReal[{-200, 200}, {1, 2}], 1], RandomReal[{-200, 200}, {69, 2}]}, {i, 1, 100}]; And I would like to ...
861 views

### Finding the position of strings in a list that contain a particular word/string sequence

If I have a list of strings Like: ...
121 views

### Can Map operations be compiled or otherwise sped up for large lists?

I'm performing a series of Map operations in the following script: ...
173 views

### Speeding up Position for finding the indices of a small number of integer elements in a large matrix

I have a large $100 \times 4000$ element matrix composed of integer elements, testMatrix, and I was to use Position to find the ...
154 views

### Generating an array using list values at indices corresponding to entries in a separate list satisfying some criterion

Imagine one has an array of integer value sets that looks like this: ...
172 views

### johansen test error in code

Cross-posted at the Wolfram community forum I have found this code on a forum, apparently it worked in a previous version of mathematica. Now when I run it, it keeps running for ages. I am not able ...
116 views

### Gather dependency on list order?

I get intrigued about Gather behavior on this post. I thought that Gather was invariant under list order? Here is the result I ...
745 views

### What's the cleanest functional-programming style way to perform this list operation?

I am looking for the correct method for accomplishing the unknown piece in the following code snippet: rolls = Tuples[Range[1, 4], {2}] ...
609 views

### Finding max value of each column of 4x4 Array

I have the following array in both MatrixForm and List form ...
216 views

### Taking a percentage of data from a list or a table

I have a list of data and for the calculation I only need the a of portion of the data. I know that Take[data, {1,100}], for example, is taking line 1 to 100 of the ...
199 views

### Selecting terms from a matrix

There are similar questions to this on the forum but none fit the purpose here: I would like to extract certain elements of a matrix depending on whether a factor is present or not, and create ...
700 views

### List plot joined with stair steps instead of diagonal lines

What's a simple way to plot a list of points so that they're joined with stair steps instead of straight lines between the points? I'd imagine something like... ...
167 views

### Using list elements in TrackedSymbols for Dynamic

During the execution of the following code a column of three lists and two sliders are displaying in output. The first list updates if either a or b changes. The second list updates only if the value ...
322 views

...
278 views

### Calculating the median difference between elements with a (particular pair) of consecutive integer indices residing in the same sublist

NOTE: I formally made a serious mistake in the first example provided. pointLists[[1]] had an extra element, and we should have a guarantee that ...
669 views

### Replace For-loop with functional code

I am very new to Mathematica. I have code written using for loops. I want to rewrite it using Map/Thread but I am not sure how ...
170 views

### Change sublist based on position

Supposed that: list = {2, 3, 5, 7, 9}; sublist = {{3, 3, 5}, {2, 2, 2, 7, 9}}; I want to change each sublist in sublist as following: Find the positions of ...
985 views

### All possible topological orderings of a graph

TopologicalSort[] returns one of many unique orderings. From wikipedia: if a topological sort does not form a Hamiltonian path, the DAG will have two or ...
270 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 ...
365 views

### Sum of two functions, list processing

I am creating some simple graphs of functions defined by ordered pairs. Students are learning about "operations on functions", in this case, adding functions. If I have two functions defined by ...
246 views

### Better way to make a certain list with palindromic sublists

Here is my code, which works, but seems a little too long, I think might be a more refined version. ...
164 views

### Appending to sublists using “anchor” values

Say I have a set of lists that look like this: ...
143 views

### Accessing sublists conditional on their length

Say I have a list that looks like this: ...
70 views

### Listing all combinations produced by picking one element from each of several sets [duplicate]

I have a problem like this, I am given the following sets {a,b,c}, {d,e,f}, {h,i,j}. I want to pick one element from each set, and output a list of all the ...
139 views

### How to extend “List-of-numbers-with-number” arithmetic to “List-of-X-with-X” arithmetic? [duplicate]

I'll start with a couple of examples (since this is all one can get from the documentation anyway). First, adding lists of numbers equal length is done term-by-term. E.g. ...