# Questions tagged [indexed-variable]

Questions about indexed variables and related alternative methods to allow assigning indexed names to objects.

49 questions
Filter by
Sorted by
Tagged with
323 views

### Would it be poor advice to assign roman numerals as top variables?

For example like so. x = 10; xi = 11; xv = 15; Is there an automated way to spit these numbers out maybe 1-1000.
• 7,489
1 vote
51 views

### xAct: How to identify and split module dummy indices?

Hi I'm using the package xAct but I'm running into an issue. It seems that before using //ChristoffelToGradMetric the christoffel connection has indices (which can ...
• 21
1 vote
78 views

• 21
848 views

### List of letters longer than the alphabet

I would like to create a list of the first $n$ letters of the english alphabet. Importantly, I would like that in case $n$ is bigger than the size of the alphabet, the letters will start repeating in ...
76 views

### Handling dummy variables 2

This is a detailed exploration of my previous post, There was some comment by @Nasser and @yarchik, I post my module in detail ...
• 367
59 views

### Creating and defining a family of functions with indexed variables?

I am trying to do the following: Create a list as Table[Subscript[\[Beta], i] _, {i, 1, dim}] And then use this list to define a function: ...
• 4,911
147 views

### Listing all Index Possibilities Given a Vector and Indexed Set

Let's say I am given a vector $v=(5,2,-2,-4,3)^T$ and $\alpha \in \{-1,1\}$. I want to find all indices $(\alpha,i)$ such that $\alpha v_i >0$, where $v_i$ is the $i$th entry of the vector $v$ ...
62 views

### Avoiding For loops to perform an assignment to a variable with indices of user-choice [duplicate]

I am looking for an efficient way to perform the following operation without For loops ...
134 views

1 vote
49 views

### Manipulating variables indexed by a list

I have a variable g, indexed by a list: g[{1,1}]=11; g[{1,2}]=12; g[{2,1}]=21; g[{2,2}]=22; I would like to move things around as follows: ...
• 847
1k views

### Best way to write an equation with subscripts and superscripts

This post is not about a specific Mathematica problem but about to develop the best way to enter mathematical equations with subscripts and superscripts. I have a ...
• 4,411
687 views

### xAct, xTensor: How to avoid clash of indices?

Please refer to the picture below. In the first line, I define the angular momentum vector $\vec{L} = \vec{R} \times \vec{P}$ using the Levi-Civita tensor $\epsilon^{i}_{jk}$. The definition relies on ...
1 vote
196 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 ...
• 115
43 views

### Getting named functions from an sequence of parameter values applied to a parametric function [closed]

The general question is how can I loop on names and indices? An example: I have pfun = ParametricNDSolveValue[{y'[t] == a y[t], y == b}, y, {t, 0, 10}, {a,b}] ...
• 1,235
415 views

### Summation over an index and a set

I have an index CC and a set of values CM, and c is an element of CM and ...
• 4,411
101 views

### Loop with indexed function not defined for some index values [duplicate]

If anyone cares, this is supposed to be a very simple implementation of a Metropolis algorithm for a uniform distribution. I want to plot the variance of the sampled values as a function of an ...
795 views

### Einstein summation convention for symbolic vector calculus

I am trying to do some vector calculus in Mathematica in index notation form because it gives a clear result that can be compared to pen and paper calculations. Since there is no built in Einstein ...
• 765
210 views

### Sum over integer partition with variable function argument

Define $$\hat{X}(Y) = [X,Y]$$ I have known matrices $S_i$ and $V$. I am trying to use Mathematica to define a function which calculates  \sum_{\substack{n_1, \ldots, n_k>1\\ n_1+\ldots n_k = ...
• 253
1 vote
176 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. ...
66 views

### Taking a Part of a Part of a Variable

Say I have Part of a variable x. Part[x, 1] Then, I'll get an error message, as the ...
• 1,535
62 views

### Naming indexed output streams

I need to write into multiple files in a Do loop. Hence, I tried to open multiple streams: ...
53 views

### How to truncate equation with multivariables

I am trying to set certain terms zero. How to set terms with greater than 'a3' and 'an3' zero in the following equation: ...
92 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 ...
1 vote
68 views

### Symbolic summation with variable bounds and variable number of indices

I wish to compute compute terms like Sum[f[t[j],t[j],...],{j,m},{j,n},...] for arbitrary positive integer n and any ...
• 21
1 vote
210 views

### Multivariable functions symmetric in their arguments/representing indexed coefficients

Context: I have equations for indexed coefficients $C_{ij}$ which I have represented using 2-variable functions in Mathematica. e.g., ...
• 123
1 vote
149 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, <...
1 vote
69 views

### How do we input powers of indexed variables?

I have tried (a[i])^2 and alternatively (a^2)[i] Apparently both seem to work, but I was wondering what was the right way ...
• 79
174 views

### How do I get Mathematica to invert a matrix with subscripts involved? (Subscript usage)

I want Mathematica to invert a matrix in which all variables are symbolic including Subscript. Now I am guessing this has something to do with the method I'm ...
• 79
934 views

### Combining Multiple Lists

Let's say I have 4 lists: list1 = {a,b,c,d}; list2 = {e,f,g,h}; list3 = {i,j,k,l}; list4 = {m,n,o,p}; I can combine them using Join ...
2k views

### What are the requirements for a well behaved indexed variable? Subscript, ToExpression, Downvalue?

On writing this answer I needed to call a function, (NonlinearModelFit) with an unknown number of parameters. We have learned that we should not use ...
• 31.2k