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

learn more… | top users | synonyms (3)

0
votes
4answers
60 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
35 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
22 views

Truncating a List of Subsets of Ordered Pairs

I have a set of pairs: ...
1
vote
4answers
101 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
51 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
36 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
108 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 ...
0
votes
1answer
29 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
47 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
221 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
34 views
1
vote
3answers
81 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
85 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
83 views

Shorthand to write repetitive test in mathematica

I have the following set of Mathematica statements: ...
1
vote
3answers
78 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
60 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 [on hold]

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
45 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
61 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: ...
8
votes
1answer
136 views

Faster trimming of leading/trailing zeroes in rectangular array

Given a (large) rectangular array, e.g. (small for example case): ...
1
vote
1answer
46 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: ...
0
votes
0answers
24 views

ListContourPlot for 3D data [closed]

I have an n x 3 list of some solar cell data that looks like this. ...
13
votes
6answers
671 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
47 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
23 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
161 views
2
votes
2answers
158 views

Are there any good mass row/column swapping functions for matrices?

I have the following matrix Keeping the 20 row and 20 column fixed (so the 21st rows and columns because I started at 0)...how do I push each row and column back one spot? I need to push the 0th row ...
4
votes
6answers
215 views

Indexed Map Thread

I'm attempting to MapThread a function of two lists that requires the index of the list values. For example, MapThread[#1*i+#2*j&,{{a,b,c},{e,f,g}}] Where #1 ...
2
votes
1answer
52 views

Simplify on a structured array

Why doesn't Simplify and FullSimplify operate on object generated using SymmetrizedArray? ...
0
votes
0answers
31 views

Copying an Imported List to another File

I have a file which begins with a large list of elements created by joining 12 different data imports, which I would now like to copy to another file so that the file can be sent by itself and not ...
1
vote
3answers
124 views

How to do a Check for every element in the list?

I know how to do a Check for the list in general: ...
1
vote
5answers
134 views

How to split list to strings?

Considering a list: lst = {"1", "2", "3", "4", "5", "6"} How can I have two strings : str1 = "1, 2, 3" str2 = "4, 5, 6" ...
0
votes
1answer
27 views

Add elements of one list to sublists of another list [duplicate]

I have the following list of sublists with different lengths {{1,1,1},{2,2},{3,3,3,3}} and a second list {4,5,6}with the same ...
19
votes
3answers
349 views

Bug in MovingMap (breaking change between version 10.1 and 10.0.2)?

The MovingMap window spec has been changed between version 10.1 and 10.0.2. Version 10.0.2 ...
5
votes
2answers
169 views

Create a list of rules built from data set fields

I want to convert a dataset to a list of features and a list of target values, for use in Predict and also more generally. I know ...
0
votes
1answer
32 views

Strange behaviour of Append [closed]

I have the following situation and I completely do not understand why the second system can be solved but the first (of the same equations, as it seems) cannot. How is it possible? ...
0
votes
4answers
112 views

Make a program that does union of two lists

I have to make a program that gives as a result the union of two lists using a For loop. I can't figure out how to inspect if the elements of a list are different. ...
2
votes
1answer
54 views

sparse array with list [closed]

i'm trying to populate a sparse array with lists in certain positions, i tried the following code, ...
4
votes
3answers
117 views

How to map over inner keys of nested Associations?

Considering an association: <|"a" -> <|aa-> "asc", bb-> "asd", cc-> 0, ImageType -> "asd", dd-> "asd"|>|> How can I make the inner ...
4
votes
4answers
598 views

Writing a circular matrix

I have two square matrices, $A$ and $B$, of the same size, say, of $m \times m$. What I want is to write a programme/function of three variables, $A$, $B$ and $n$, that outputs the $mn \times mn$ ...
1
vote
2answers
50 views

How can I manipulate this list?

I performed a loop with Table where I solve a system of 4 equations that depends on two parameters: eta and p. I create two lists for each parameter as follows: ...
2
votes
4answers
195 views

How to switch from array to string?

Considering we have an array: a = {2/3, 4/5, 9/7, 3/7, 1/7, 1/9}; How can I get this to be: "2/3 4/5 9/7 3/7 1/7 1/9" ...
9
votes
5answers
363 views

Most efficient way of making pair list from a list

I have a bunch of datasets which looks like: 3 7 1 6 5 8 2 4 1 2 8 1 5 2 5 ... and I need to make a list of pairs such that the first element makes a pair with ...
4
votes
4answers
110 views

Creating a new list from other two lists using for loops

I have two lists 'ups' and 'downs' where they are composed of positions of an element in a matrix and their weight. For example, ...
4
votes
4answers
185 views

How to highlight the elements in a list that match a pattern?

For example, {{1,2,3},{1,2,3,1,2,3,4,5}}with pattern {1,_,3}is transformed to ...
0
votes
3answers
52 views
1
vote
3answers
48 views

Delete permutations of subtables in a table [closed]

I've got a table of tables: $A=\{\{a,b\},\{b,a\},...,\{a,b,c,d,e\},\{e,d,c,a,b\},...\}$. How do I do to remove backward duplicates, or more generally permutations of duplicates in the table? For ...