Questions tagged [list-manipulation]
Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.
548
questions with no upvoted or accepted answers
1
vote
0
answers
34
views
Fastest way to do repeated subsample/Intersection calls over large set of vectors
In this answer I found I needed to calculate a bunch of intersections of subsets of vectors, like
...
1
vote
0
answers
43
views
Generation of nested list
Does anyone know a better way get the output generated by this code:
Table[Table[{b-a,b},{b,7}]{a,7}]
1
vote
0
answers
61
views
Custom Table, for iterating over permutations
It is common that I iterate over all permutations of 1,2...,n, either by making a table or performing a sum.
Instead of creating the set of all permutations, it would be better to iterate over them.
...
1
vote
0
answers
36
views
How can I create a ParallelTable with finer resolution at certain points?
For example, say I have a function testfunc already defined to take one argument $x$. This command would create a table of ...
1
vote
0
answers
44
views
How to confirm the list of plot unique
I have a list of plot in a list called modes. I am interested in knowing whether this list is unique or not, meaning all the plots are different from one another. ...
1
vote
0
answers
40
views
Using the Line command with a bound on distance between points
Suppose I use the Line command applied to a list (or more accurately apply Graphics[Line[list]] or ...
1
vote
0
answers
58
views
Evaluate For Loop for a fixed number of iterations
a = Table[Prime[n], {n, PrimePi[i]}]; b = Delete[a, 1]; p =
IntegerPartitions[i, 4, b]; Total[
Times @@ Values[1/Factorial@#] & /@ Counts /@ p];
I need to ...
1
vote
0
answers
63
views
finding primes using chebyshev bias
Using the problem from my previous question link. For each n, that is n= $10^3$ to $10^6$ with a ten-fold increase, how do I use Chebyshev Bias to display the number of primes (which are in the ...
1
vote
0
answers
55
views
1
vote
0
answers
37
views
Solving a system of differential equations whose one of the coefficients is imported data
Suppose we have a coupled system of differential equations:
\begin{equation}
\frac{db}{dt}=(- \gamma_b -i\omega_b)b-i\frac{g}{2}p;\quad
\frac{dp}{dt}=i\frac{g}{2}\Delta N(t) b-(\gamma_a+\gamma_b+2iJ)p....
1
vote
0
answers
59
views
Find parameter ranges of a function whose value is within a window by sampling points
Problem:
I want to find the ranges of the parameters for a function $f(x,y,z)$ when $0.9 < f(x,y,z) < 1.1$. All parameters are bounded $x , y, z \in [0,1]$. In the real problem the function ...
1
vote
0
answers
76
views
Problems with using Riffle, Grid and TableForm
I have the following Table:
...
1
vote
0
answers
68
views
Importing multiple files setting the name with tostring
I'm trying to import several matrices, which contain a pattern in the name. I create first their names in a table
...
1
vote
0
answers
53
views
Closest number between two lists within a given tolerance
If I have two large list with numbers such as:
list1={number1,number2,number3..........etc} list2={number1,number2,number3..........etc}
Question:
How can I find ...
1
vote
0
answers
61
views
Apply DateObject to a whole list
I'm trying to apply DataObject to a whole list.
It looks something like this.
...
1
vote
0
answers
37
views
Generating a list of the degree-$n$ Kronecker polynomials
A Kronecker polynomial is a polynomial such that
Its coefficients are integers,
Its roots are on the unit circle or $0$,
Its leading coefficient is $1$.
From here, there are finitely many Kronecker ...
1
vote
0
answers
94
views
List of arrays in Mathematica
How would I declare a list of arrays and treat them as single objects? For example, I may have the Pauli matrices:
$$
\sigma_0 = \begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}, \sigma_1 = \begin{...
1
vote
0
answers
36
views
Using Select for lattice points
I know how to use Select to generate a list of numbers which satisfy a certain condition. However, I am not sure how to do this for points (specifically 2-tuples) ...
1
vote
0
answers
61
views
Finding the domain in which a function is analytic with no imaginary part
I was wondering if it is easy to see if a given expression evaluates to a real number in a given domain? Let e.g. f(x,y,z) be some function depending on three ...
1
vote
0
answers
363
views
Thread::tdlen: Objects of unequal length in {{a,b,e},{c,d,f}} {x,y,z} cannot be combined
When I do the Times operation among list like this {{a, b, e}, {c, d, f}}*{x, y, z}, the error message is given as Thread::tdlen: Objects of unequal length in ...
1
vote
0
answers
68
views
Making Table with nested SetDelay functions is very slow
I am trying to write a function which returns a list of lists of eigenenergies available for a quantum well. The code is here:
...
1
vote
0
answers
44
views
Very large list with sublists of varying dimension
I have a very large list of events,Evin, grouped into sublists. All these sublists have 15 elements each and the large list has about 1 - 2 million of these sublists. I now want to regroup that large ...
1
vote
0
answers
57
views
How can I convert the Defer result to a String
I have created a package.wl where I am building a simple interface with input fields and buttons to generate and solve some simple integer logarithms.
There is a button [show solution] that explains ...
1
vote
0
answers
60
views
How to define more general boundary conditions for ConvolutionLayer?
In Mathematica 12, I only see the option to define "PaddingSize" for a ConvolutionLayer in order to get Dirichlet boundary ...
1
vote
0
answers
42
views
Remove braces from AppendTo output
If I have the following inside a loop:
tts={};
AppendTo[tts, p] where p is just a number at each iteration so that in the first iteration I get: ...
1
vote
0
answers
82
views
LeviCivitaTensor contraction indices
My computer has problems when I try to perform a calculation with TensorContract.
In particular, with the second answer to my previous question Contracting indices ...
1
vote
0
answers
53
views
ListPoinPlot3D works but ListPlot3D does not
I don't understand what is going on. The same table, plotted with the tool ListPointPlot3D gives the desired output. But plotted with ...
1
vote
0
answers
95
views
Faster methods for performing repeated list manipulations?
I've done my best to pore over the other posts on this site, and to the best of my ability I can't seem to find a good solution to my problem, so I apologize in advance if elements of my question are ...
1
vote
0
answers
102
views
Loop over variable sized arrays
I would like to build an Encoder/Decoder to export my Data from Mathematica to Julia. From Mathematica I get arrays of variable dimensions, these arrays contain variables that don't have a fixed value ...
1
vote
0
answers
152
views
How to delete random elements with RandomChoice?
I have a list of prices and a list of dates, but I have 154 more prices than dates. So I want to delete random prices to match both lists, however, every time I run the block of code I get a different ...
1
vote
0
answers
44
views
Apply SequenceReplace with a fixed shift
How can I apply SequenceReplace with a fixed prespecified shift instead of a shift equal to the length of the pattern, on a given list? E.g. ...
1
vote
0
answers
37
views
MapAT and GeoPosition
I just experienced a problem applying GeopPosition via MapAt. Here a MWE. Given a list of data:
...
1
vote
0
answers
50
views
Loss layer for vectors with component mixing or non-trainable number array in NN layer
Suppose we need to construct an unconventional loss function for my neural network: vector MSE but taking into account the "similarity" of variables.
My network takes data vectors ($m=40$ D) and ...
1
vote
0
answers
28
views
Distribute function - Limiting Possibilities
I have a very large list of lists of which I am applying the Distribute function to. Because of this, there are more than 10^9 combinations and my computer cannot handle that.
I was wondering if it ...
1
vote
0
answers
44
views
Coordinate transformation of a table of multi-variable function values
I've created a table in Mathematica for a function dependent on r and phi of the form
...
1
vote
0
answers
98
views
Measuring Degree Correlations of Networks
I'm trying to write a program that will measure the degree correlation of the network. The theory is here (page 8).
I've written something like this up to now:
...
1
vote
0
answers
186
views
How to compute the multiplicative order of an element in a finite field
I want to find the multiplicative order of say the element {0,1,0} in GF[8].
I made a list:
b = Map[GF[8][#] &, Tuples[{0, 1}, 3]]
I tried:
NestWhileList[b[[3]]*# &, b[[3]], # != b[[5]] &...
1
vote
0
answers
73
views
How to assign a nested list indices for later use
In an attempt to calculate a summation dependent upon a nested list it appears that a simple use of [[{n,k}]] does not yield the desired result. For example with ...
1
vote
0
answers
85
views
Correctly Evaluating the existence of Large Solutions
I'm trying to correctly evaluate
$$D(S\cap[a,b])=\lim_{n\to\infty}\frac{\left|S\cap{F_n\cap[a,b]}\right|}{\left|F_n\cap[a,b]\right|}$$
where $D$ is the density of $S\cap[a,b]$ (in $A\cap[a,b]$), $[...
1
vote
0
answers
39
views
Replacing factors that are only dependent on a single specific variable
I have expressions with terms that are products of factors. Some of the factors are expressions that depend on a single specific variable. I would like to replace those factors with constants and ...
1
vote
0
answers
76
views
Problems with the parametric Recurrence Table
I am trying to construct a minimization program where I have to minimize a function with respect to a matrix. This matrix enters into the optimization program in a convoluted manner together with data....
1
vote
0
answers
29
views
Solve, store, and access eigenvalues and eigenstates of M[x,y], for various points {x,y}
I'm interested in solving a position dependent eigenvalue problem for matrix M[x,y], where {x,y} is some discretized set of points. I may need to access the eigenstates and eigenvalues multiple times ...
1
vote
0
answers
245
views
Visualizing a huge weighted graph
Consider a weighted graph 'net':
...
1
vote
0
answers
117
views
Transform the data, and fitting it with a Lambert function
I got a list of numbers $x$:
...
1
vote
0
answers
232
views
Monitoring the Training Progress through PutAppend
I would like to export the round loss during my model training for each training round. Currently, I am using the way shown in the Documentation Center around TrainingProgressFunction and PutAppend:
<...
1
vote
0
answers
123
views
Understanding Maps and slot
Going through some old code I found this line:
...
1
vote
0
answers
65
views
Mapping over array/matrix the efficient(compact) way
Update
In short, I have myCAans[[1 ;; 5]] like this:
{{0, 0, 0, True, 0, 0, 0, 0, True, 0, "T0", 39}, {0, 0, 0, True, 0, 0, 0, 1, True, 1, "B", 101500}, {...
1
vote
0
answers
58
views
Inserting a table data inside the function
Consider a table with n columns and function f[x] depending on n coordinates, $x = x_{1},...,x_{n}$. I want to interpret the table as a set of points in n-dimensional space and calculate the function ...
1
vote
0
answers
61
views
Reconstructing a partition from its character
Given a solid partition $\rho=\{\pi_1, \pi_2, ..\}$, where $\pi_a$ are plane partitions such that $\pi_{a+1} \subset \pi_a$, we can compute its character, which is a sum of monomials with non-negative ...
1
vote
0
answers
457
views
ParametricPlot - Several curves by different parameters
I am trying to plot a set of curves f(a,b,t) along t with a,b = -10, -9, ..., 9, 10.
I can use Manipulate to draw 1 curve, and then change the curve shape by ...