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

learn more… | top users | synonyms (3)

5
votes
4answers
115 views

Counting variable from a list of matrices

I have a list of matrices ...
0
votes
1answer
54 views

How do I manage my memory better when using the Map function?

So I'm attempting to write a Mathematica program that prints a range of natural numbers as the sum of four cubes. I wrote the following Mathematica code to try this, but am running into a memory ...
4
votes
3answers
115 views

Select certain items from nested list

I have a list as follows: lis1={{{a1,b1,c1,d1,e1},{a2,b2,c2,d2,e2}}, {{a3,b3,c3,d3,e3},{a4,b4,c4,d4,e4}}} and would like to delete certain elements from it resp. ...
3
votes
2answers
50 views

Manipulation of .csv imported data — no blanks in either of two lists

Above is a .csv file. I am trying to construct two lists of male and female math test scores such that only districts which include info for both male and female students are included i.e. neither ...
1
vote
1answer
62 views

Take sublist with fixed interval

For example: a = Range[20]; a = ArrayReshape[a, {4, 5}] I want to take elements from a with interval = 2 : ...
4
votes
2answers
102 views

Gridding in a Nested Matrix

We have a nested matrix as: nested={{he, {{e, f, g, h}, {s, 0, q, i}, {s, 0, q, j}}}, {ho, {{e, f, g, h}, {0, u, t, i}, {u, t, 0, j}}}} and with the line ...
0
votes
2answers
89 views

Generate a list with random values between a and b [on hold]

I am trying to perform system identification.. To properly identify the system i have to give the system a "rich" signal which are able to "activate" all the modes of the plant. A rich signal would ...
3
votes
2answers
51 views

Average list of list of parameter values

I have a list of lists of fitted parameter values, e.g. list={{a->1,b->10},{a->2,b->20},{a->3,b->30}} (the actual parameter names can vary, as ...
10
votes
1answer
595 views

Solving and Animating Three Body Problem

I am attempting to solve a three-body problem using the Lagrange formalism, with a 1/r potential. I started off by defining T and U (kinetic and potential energy) as follows: ...
0
votes
3answers
71 views

Getting a list of x coordinates of intersection points of two functions

I have two functions, f[x_] := 5 Sin[2 x] g[x_] := (5 x + 2)/(x + 2) I am trying to find the x coordinates that intersect ...
0
votes
2answers
86 views

Specific excel data needed in a list

I need to create a list from a general Excel database that requires only data from "ALL STUDENTS" rows on columns 2 and 7. The List most be of the form {DISTRICT, MATH} where the MATH score is ...
1
vote
5answers
139 views

Select a certain row among the duplicates

I have the following problem: I have a (a lot)*3 table, meaning that I have 3 columns, say X, Y and Z, with real values. In this table some of the rows have the same (X,Y) values, but with different ...
0
votes
1answer
38 views

How to extract info from Association? [duplicate]

How can one extract a list of keys and a list of values from the association? e.g. as = <|a->1, b->2, c->3, d->4|> ...
0
votes
1answer
48 views

Joining sub-lists nested two levels deep in a list [on hold]

I have an obviously easy task, but I can't do it, and I could not find a solution by searching the site. I have a list as follows: ...
0
votes
0answers
30 views

Command Select returns empty result [on hold]

I'm trying to do something like c = N[Solve[14 == 3x^2+4x+1, x, Reals]] Select[c, 1 < # < 2 &] Unfortunatelly, I get ...
1
vote
1answer
53 views

Incompatibility of Append and NumberForm? [on hold]

Consider the code list = {.12, .23, .34}; Append[Round[list, .1], 10] Append[NumberForm[list, 1], 10] The use of Round returns the expected result ...
0
votes
0answers
53 views

How to handle substrings of a matrix by a named index

I am using open source code to run stochastic simulations. The output looks like this: ...
2
votes
3answers
103 views

Max function used with nested lists

I have a list as follows lis1={{{1,5,6},{4,7,8}},{{1,2,2},{5,6,7}}} and would like to calculate the max value of each nested list in order to get following ...
1
vote
0answers
28 views

Tracking solutions over a Brillouin zone

Thanks to @bbgodfrey I have a function that finds the two solutions to a set of equations bounded by a hexagonal region (corresponding to the Brillouin zone). It takes the angle ...
2
votes
4answers
80 views

Pairs of data to Classify[]

Suppose I had the following data a={1,2,3,4,5} How would I turn this into b={{1,2,3}->4,{2,3,4}->5} That is, ...
7
votes
7answers
364 views

Generate a list

Given the list o = {xmin, xmax, ymin, ymax}; how can I generate the following list? ...
0
votes
1answer
49 views

How can I use nonlinear model fit with multiple variables? [closed]

I have a data set with four entries. the first three entries correspond to variables in the fit x,y, & z. The fourth entry corresponds to the function value. I am trying to fit this data to a rate ...
0
votes
4answers
87 views

How to trim the zeros from the right of a list? [duplicate]

I need to remove the zeros from the right of an integer list up to the first non-zero element. Such as {0,1,0,0,2,0,0}->{0,1,0,0,2}. Padding zeros can be simply ...
0
votes
1answer
46 views

How to import data from a .mat or a .txt file and manipulate dimensions

I'm new to Mathematica (I know very, very little - so I apologize if anything I say is absolutely wrong) - but I'm trying to upload a file from matlab and arrange it in matrix form. I have a .mat ...
1
vote
1answer
29 views

Truncating a List of Subsets of Ordered Pairs

I have a set of pairs: ...
1
vote
5answers
135 views

Manipulating List?

I have a huge list with 1000 elements. Manually entering and calculating SUM of probabilities it would take a few hours. Example: list = {1, 2, 3, 3, 4, 3} ...
0
votes
0answers
62 views

Matrix iteration failing after second step

I am calculating 11x6 matrix using different logics as in below code. Problem is in Do loop in below code where I have two different criteria to update matrix "fd". I am expecting logic in IF which ...
0
votes
1answer
43 views

Replace element of matrix based on rule which invloves other element of same matrix

I am trying to replace 1s row of matrix d iteratively from right by multiplying last element in 1st row with (1-int*dt) to generate 2nd last element. The replacement continues till I reach the 1st ...
1
vote
2answers
117 views

How can I reshape my solutions to make a 3D plot?

I need some help on the following. I need to run Solve for multiple values of a and b. To do so instead of using Do, I use ...
1
vote
1answer
31 views

Replace parts of nested lists

I have list of stock data as follows: lis1= {{{1992/10/12, 126.946, ^AEX}, {1992/10/13, 127.85,^AEX}}, {{1992/10/12, 88.487, ^AFLI},{1992/10/13, 91.825,^AFLI}}} ...
0
votes
0answers
49 views

How to replace a part of array based on certain rules which involves usage of other array

I am trying to replace outermost column of array "fd" in below code. fd is matrix of dimension (nas1,nts) which is initially filled with 1. I want to replace outermost column of fd with result of Max ...
6
votes
3answers
229 views

List and patterns

Given some tuple $\{N,M,L\}$ such that $N\geq M\geq L\geq 0$ and $N>0$, how can I generate all tuples $\{n,m,l\}$ such that $n\geq m\geq l\geq 0$ and such that ...
1
vote
2answers
36 views
1
vote
3answers
85 views

2D Interpolation of data file

I hae a datafile with 5 columns of the structure: x_i f(x_i,y_1) f(x_i,y_2) f(x_i,y_3) f(x_i,y_3) f(x_i,y_4) with i = 1 to about 100. Thus there are about ...
0
votes
0answers
22 views

NCAlgebra to calculate a Hermitian conjugate

I have to calculate a non-commutative product of this form: $(-H a+ J a b)**(-H a + K c)$ where $H,J,K$ are variables and $a,b,c$ are operators that don't commute. For this purpose I used the package ...
4
votes
1answer
88 views

Better method to swap the values of two 2-D arrays

I have two 2-D matrices $A$ and $B$(owns same dimentions) which have the style written as below: $ \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1k} &\cdots &\cdots & ...
2
votes
3answers
90 views

Shorthand to write repetitive test in mathematica

I have the following set of Mathematica statements: ...
1
vote
3answers
79 views

Finding roots of transcendental equation and collecting into a list

I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated. I ...
2
votes
3answers
62 views

Flattening of Matrix rows [duplicate]

It's got to be easy, but I can't come up with a general solution. m = {{16, 2, 3, 13}, {{5, 11, 10, 8}, {9, 7, 6, 12}}, {4, 14, 15, 1}}; What I'm trying to ...
0
votes
1answer
39 views

How to switch keys in a Map to Association [closed]

I have an association that has parameters for a function. These parameters represent two cases that need to be applied to the function. Some parameter values are common to both cases but some are ...
0
votes
0answers
29 views

How to generate the list of consecutive pairs from a list? [duplicate]

What is the morally right solution to mapping a list {a,b,c,...} to the list of pairs {{a,b},{b,c},{c,..},..}? The solution I came up with feels a little clumsy: Shift a copied list by one and form ...
-1
votes
1answer
52 views

Manipulate excel file and plot

I have a number of .csv files that have the following format: I want to do the following: ignore the last two rows sort all the remaining rows w.r.t the 2nd ...
3
votes
2answers
62 views

How to re-arrange lists, divide one list into 2 lists with a particular step [duplicate]

How to re-arrange following list: {a1,b1,a2,b2,a3,b3,a4,b4} or this {a1,b1},{a2,b2},{a3,b3},{a4,b4} to get: ...
10
votes
1answer
142 views

Faster trimming of leading/trailing zeroes in rectangular array

Given a (large) rectangular array, e.g. (small for example case): ...
1
vote
1answer
48 views

Collecting specific Lists of data in coordinate form

Note: This might be trivial for many of the users but i am new to mathematica so i don't know!!! Question: Suppose i have three list of data as follows: ...
13
votes
6answers
683 views

Finding the period of an array of integers

A simple array of integers is given. The problem is to detect if a pattern is repeatedly occurring in the array, and find the length of that pattern. For example, for ...
1
vote
2answers
48 views

Perform operation on part of a table / create a reference

There is a function f that I would like to operate on a rectangular part of a table t. The part is specified by function ...
0
votes
0answers
24 views

Generating a list consisting of function values like in a triangular matrix

A goal is to generate a SymmetrizedArray of dimension n^k with specified symmetry (let it to be ...
1
vote
4answers
166 views