Questions tagged [index]

Questions about functions with intrinsic part index such as SparseArray, Part and Indexed or iteration variable indexes such as MapIndexed, Sum and Product.

Filter by
Sorted by
Tagged with
1 vote
2 answers
71 views

Can't use iterative variable as part specification [closed]

I've got the following mathematica code: ...
Sebastian 's user avatar
2 votes
1 answer
64 views

Problem with integration with indexed variable

I wonder why I can not have a correct integration form on Mathematica with some indexed variables. Indeed, when I write : ...
Nathan Gege's user avatar
3 votes
2 answers
152 views

How to use Position to select based on absence of a pattern?

I need to use Position to obtain positions of entries in list of lists that do not contain a certain pattern. The problem is that ...
Nasser's user avatar
  • 137k
5 votes
3 answers
142 views

Substituting the element of a list into a list that contains the index position

I see similar questions for lists and indexes and manipulating with Thread, MapIndexed,etc., but I do not see how to do a substitution. I have a list of coordinates for a geometric object and a list ...
jacobian's user avatar
1 vote
1 answer
138 views

Is there a builtin command or a workaround to generate a nested sum (of apropriate level) from an expanded expression?

I have the following output from some Mathematica manipulation of nested sums. Does Mathematica have a command or combination of commands that recovers nested sums from the expanded form? $$\begin{...
Neves's user avatar
  • 153
0 votes
0 answers
39 views

One as Subscript and Supersripts

I am trying writing code with a lots of symbols and their products. There is an issue with the appearance of "1" as an index. e.g. Subscript[[Delta], 1 n] Why "1" does not appear ...
SciJewel's user avatar
  • 331
0 votes
1 answer
70 views

Replace elements of indexed list by list of rules

I have an array bs that contains many indexed elements b[ ]. I want to define the values of bs by a list of replacement rules. ...
granular bastard's user avatar
4 votes
3 answers
352 views

How to replace the element in list of list by its ordering index

I have a list of list: res={{9, 1, 5}, {3, 6, 12}} I want to change it to res={{5, 1, 3}, {2, 4, 6}} by following their ordering ...
mmmm's user avatar
  • 95
6 votes
4 answers
647 views

Find min and max indices of highest and lowest elements in sorted list

I have a list of integers of the form ...
az123p's user avatar
  • 239
0 votes
1 answer
38 views

index as an attribute for a function containing data frame

Two questions. I have created a sample problem, and would be glad to have your help. I have 2 functions, fun1 and fun2, and one ...
Rupesh's user avatar
  • 877
2 votes
3 answers
183 views

How to include index for the coefficients in series or sequence

I am trying to use the "Summation" command for the exponent and for the corresponding subscript of the coefficient, but it fails. See the example below: ...
SciJewel's user avatar
  • 331
2 votes
0 answers
345 views

Part::partd: Part specification is longer than depth of object (Simple list) [closed]

I know that this question has already been asked (I searched for answers), but in every thread I saw the code was much more complicated than what I'm trying to do, and I can't understand why this ...
Sara Munafò's user avatar
2 votes
0 answers
168 views

Map a function that uses the lists indices as arguments

Suppose I have a function f[x_] that I want to Map over somelist (assumed to be one ...
duality's user avatar
  • 65
4 votes
2 answers
112 views

RSolve solves only one of two equivalent recurrences

I am having an issue with the RSolveValue/RSolve function. Specifically, Mathematica is able to correctly evaluate ...
B. Freeman's user avatar
3 votes
2 answers
77 views

Solve with a non-numerical-index constant

I have 4 different constants in a given expression. Due to their physical interpretation, it makes sense to label them with non numerical indices, such as $r_+$. The problem is that they prevent even ...
Sergio Jorás's user avatar
3 votes
1 answer
91 views

Summing list elements for given index tuple

Is there a more compact way of summing certain elements of lists together when given a tuple of which elements to sum. For example if I am given the list of size 8: ...
John Doe's user avatar
  • 295
0 votes
0 answers
27 views

How to define an index list of local variables for arbitrarily long

Suppose initially I have a list that looks like list1 = {A, B, C} where the elements A, B, C are all matrices. I want to substitute all the three elements by list1 ...
Songbo Xie's user avatar
0 votes
2 answers
164 views

Indexed variable - Function that contains summation

I have the following problem: I have a function that looks like $f(c_1 , c_2 ) = c_1 + c_2 + c_3$. The variables are $c_1$ and $c_2$, $c_3$ is a known constant. I would like to define a function in ...
MegAmaNeo1's user avatar
3 votes
2 answers
128 views

Re-defining the built-in `CharacterRange` for a range of 1500 or more

I have the following function (developed by @kglr), and now I need to use the same function with a list of 1043 characters rather than a limited number from A to <...
Tugrul Temel's user avatar
  • 5,470
6 votes
1 answer
266 views

Undefined Indexed Variable

I searched already a lot about indexed Variables, and it tends to be the most applicable way to use tensor notation. But I am having a hard time to solve for undefined indexed variables: Here my ...
oyy's user avatar
  • 187
1 vote
1 answer
123 views

Can I overload Part for specific heads (a la overloaded array subscripting)? [closed]

Mathematica/Wolfram Language newbie here. The behavior I am after is to be able to "overload" the subscripting of me-defined objects/Heads and thereby use them as if they were ...
user avatar
3 votes
2 answers
84 views

Index of item inside StructuredArray

How do I extract position of item in StructuredArray without converting using Normal? The following code finds the position of ...
azerbajdzan's user avatar
  • 9,578
2 votes
3 answers
182 views

Split matrix expression into multiple lines

Given a matrix expression testm = {a + b, c + d, e}; {# , testm[[ # ]] // Simplify} & /@ Range[ Length[testm] ] // MatrixForm \begin{equation}\begin{pmatrix} ...
MrDerDart's user avatar
  • 201
2 votes
1 answer
80 views

Fancy Indexing of a 4D array (tensor)

I'm trying to mimic the CoefficientArrays function, which I can't get to work for my symbolic equations. The CoefficientList ...
NathanRL's user avatar
  • 127
4 votes
1 answer
335 views

How to get the class of neighbors in a 2D periodic matrix?

I'm trying to analyze the spatial structure of some rectangular arrays by counting the number and class/type of neighboring points around every point in the arrays, with periodic boundaries. For ...
TumbiSapichu's user avatar
  • 1,593
3 votes
2 answers
264 views

Labeling elements of a table

I have a table of the form(the table is very long, i put an example): tab1={{{1,10,30},{1,20,54},{1,30,65}},{{2,10,35},{2,20,65},{2,30,70}}} How can I give ...
Orion's user avatar
  • 97
1 vote
1 answer
690 views

How do I evaluate my functions over a range of values? [closed]

I want to use the list of data which will come from MapData1 (in code); the first element is θ and second is Action(I). I want to use this Action(I) and Angle(θ) in ...
user68207's user avatar
3 votes
0 answers
149 views

Efficiently get positions of Query results

I have some very large Datasets. Is there any efficient method of getting the positions of results found in a Query? That is, without using ...
user5601's user avatar
  • 3,581
0 votes
2 answers
47 views

Arrange exceptions in a list by some criteria

I have some dataset, which is supposed to have $30000$ in the last column, and I want to find the elements that break this, and arrange them numerically while mantaining the index. What I'm currently ...
Renan Nobuyuki Hirayama's user avatar
2 votes
1 answer
337 views

how to add labels of points next to it based on index in ListPlot

I have a list of some points. I plotted each point and its closest surrounding points. ...
Erfi's user avatar
  • 111
6 votes
2 answers
1k views

Defining a function of arguments with sub- and superscripts

I want to define a function that takes, several, let's say two arguments, both of which have several sub- and suberscripts. For example a function might have the signature $$ f(x_i,q_{j,k}) = \mathrm{...
HerpDerpington's user avatar
7 votes
1 answer
119 views

How would you explain Nothing[] weirdness? [duplicate]

I would like to use Nothing[] to make some elements of a list invisible. (The intended use is to remove a few unwanted points from a ...
Niel Malan's user avatar
1 vote
1 answer
113 views

How does Indexed work in terms of sparse array

I want to use indexed given that s is an element [0,500] but I am unsure how to write that without getting a format error or a tensor error. ...
Cherry's user avatar
  • 11
0 votes
1 answer
124 views

Integer functions indices in a sum

I have some troubles with plotted A versus p, especially for the function F(s,l,p), I don´t know how deal with the integer functions indices of the sum. How can I input such a sum to Mathematica?. ...
yhiel's user avatar
  • 19
14 votes
2 answers
1k views

Map vs. Table for index-specific operations on 2D arrays

Many experienced users on this site tend to use Map (and its variants, MapAt, MapIndexed, etc.) rather than Table. When applying the same operation to every element of an array, Map does seem more ...
theorist's user avatar
  • 3,603
10 votes
3 answers
249 views

Function over a list that depends on the index

Suppose I have a list {a, b, c, d} I want to operate on this list with a function which depends on the index of the element, e.g. I want to add the index ...
Merk Zockerborg's user avatar
3 votes
3 answers
889 views

Is there an easy way to index by a binary vector / mask?

I would like to be able to extract elements from a list where indices are specified by a binary mask. To provide an example, I would like to have a function ...
user1747134's user avatar
1 vote
2 answers
244 views

Collecting terms from expression with indexed functions

Say I have an expansion of terms containing functions y[j,t] and its derivatives, indexed by j with the index beginning at 0 ...
Decebalus's user avatar
  • 115
2 votes
0 answers
113 views

Typography of Mixed Tensor Index Notation

How can one properly and quickly write a mixed "tensor" such as $\Gamma{}_{1}{}^{2}{}_{3}$? Shortcuts such as esc Gamma esc, Ctrl+^, Ctrl+_ are prefered. I intendd to use this in an inline equation ...
Miladiouss's user avatar
  • 1,853
1 vote
1 answer
236 views

Create list of values with arbitrary index and the use it in a function

I have the following generating functions: $l_{2i-1}=l_{1}-(i-2)(w+s)$ with $i\geq 2$ and $l_{2i}=l_{2}-(i-1)(w+s)$ with $i\geq 2$, so the first one is for odd index and the second for even index. ...
Felipe Gonzalez's user avatar
1 vote
0 answers
660 views

Sum over multiindex

I would like to calculate a sum over some multi-indices, that follow a specific pattern. $$\sum\limits_{1\le i_1<i_2<...<i_k\le N} A(k,i_1, i_2, ..., i_k).$$ $A$ is a fix expression of the ...
guest2718's user avatar
0 votes
0 answers
20 views

Why do I have to index my covariance matrix as if it has 3 dimensions [duplicate]

The language reference for getting parts of a matrix seems to make sense. I'm wondering why my covariance matrix behaves differently. ...
David Wurtz's user avatar
2 votes
0 answers
113 views

ParallelDo with doubly-indexed iterators

What is the reason that ParallelDo works with singly-indexed iterators, but not doubly- or more-indexed iterators? For example, the code ...
Andrew Patrick Turner's user avatar
0 votes
0 answers
48 views

Defining list of data

I need to define a list of parameters A[i] where i runs from 1 to some integerN. The ...
Physics Moron's user avatar
0 votes
2 answers
123 views

Algorithm for Swapping indices and simplifying the summand in a double sum [closed]

Say we have something like $$ \sum_{p}^N\sum_{q}^N \cos(p) \sin(q) - \cos(q)\sin(p) $$ usually, in the case like this, the indices p and q can be swapped, and the sum simplifies to 0. I have an ...
Tom's user avatar
  • 121
3 votes
2 answers
659 views

Indexing nested list with another list

So I'm wanting to index the sublists within a list using another list. So I have x = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} And I want the 2nd term of the first ...
H94's user avatar
  • 165
1 vote
2 answers
1k views

Finding the x-value corresponding to a y-value found using Nearest [closed]

I have a large 2d array of infinite precision named "data" of x values and y values. I am using Nearest to find the y-value closest to a specified number, say 0....
Zack Carson's user avatar
1 vote
1 answer
177 views

subscript index notation select certain value [closed]

I have an indexed variable Subscript[p, s, m, t] established using the Notation method. There are various expressions where s, <...
Rupert Gillyweed's user avatar
3 votes
0 answers
73 views

Part[] for multi-index array [duplicate]

If I want to set element (i,j) of two-dimensional array X to 0, I can write X[[i,j]] = 0. My question is how can I achieve this if I have the indices i and j in a ...
Ivan's user avatar
  • 41
8 votes
2 answers
906 views

Add Index to All Elements of a List

My goal is to add an index to all elements of a list in the form {"a", "b", "c", ... }, so it becomes ...
Androvich's user avatar
  • 243