## Extracting number from argument of a function, then use the number as a subscript building a replace rull to replace the function call

for example:

Cos[[Phi]1] -> c_1 , Sin[[Phi]1] -> s_1,Cos[[Phi]2] -> c_2 , Sin[[Phi]2] -> s_2

thus this can be simplified

with
{Cos[[Phi]i] -> c_i , Sin[[Phi]1] -> s_i}

## How to replace the number of each element of a matrix with a subscript?

I want to get the matrix as Figure 2. There should be two ways to achieve the result.

1. There is a matrix as Figure 1, and change it to the form of Figure 2.

2. Generating the matrix as Figure 2 directly.

How can I do it? Thanks.

Note：The matrix in Figure 2 is a symmetric matrix

Figure 1

Figure 2

Codes

``````{{C11,C12,C13,C14,C15,C16},{0,C22,C23,C24,C25,C26},{0,0,C33,C34,C35,C36},{0,0,0,C44,C45,C46},{0,0,0,0,C55,C56},{0,0,0,0,0,C66}}
``````

## Extract subscript of variable in product

My input is a product of the variable `x` with index:

``````x[1]^2 x[5] x[7]
``````

How do I extract the indices of the above product to get the list `{1,1,5,7}` as an output? Note 1 appears twice in the list since `x[1]` is squared.

I would like this code to work for any product of `x[j]^n`, where both j and n will be given integers.

## filtering – How to delete certain terms in a polynomial with variables in subscript?

I have a polynomial in the following style,

``````polynomialdata= Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0] + Subscript[xy, 1, 1][0]*Subscript[xy, 2, 1][0] +  Subscript[xy, 1, 2][0]*Subscript[xy, 2, 2][0] +  Subscript[xy, 2, 1][0]*Subscript[xy, 2, 2][0] + Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0]*Subscript[xy, 2, 1][0]*Subscript[xy, 2, 2][0] + Subscript[xy, 2, 1][0]*Subscript[xy, 3, 1][0] + Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0]*Subscript[xy, 2, 1][0]*Subscript[xy, 3, 1][0]
``````

I wonder how to remove certain terms in the `polynomialdata` such as `Subscript[xy, 2, 1][0] Subscript[xy, 3, 1][0]` or keeping terms such as ` Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0]*Subscript[xy, 2, 1][0]*Subscript[xy, 3, 1][0]`.

Probably one stupid way is to do the following

``````Keep[expr_] :=
expr /. {Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0]-> 0, Subscript[xy, 1, 1][0]*Subscript[xy, 2, 1][0]-> 0, Subscript[xy, 1, 2][0]*Subscript[xy, 2, 2][0]-> 0, Subscript[xy, 2, 1][0]*Subscript[xy, 2, 2][0] -> 0, Subscript[xy, 2, 1][0]*Subscript[xy, 3, 1][0]-> 0}

Keep[data]
``````

the result gives `0`; which is not I expected.

I want the outcome to be `Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0]*Subscript[xy, 2, 1][0]*Subscript[xy, 2, 2][0] + Subscript[xy, 1, 1][0]*Subscript[xy, 1, 2][0]*Subscript[xy, 2, 1][0]*Subscript[xy, 3, 1][0]`. Maybe I could use `DeleteCases` function.

However, if the data has many terms, it will be very inefficient to do the above removing. Is there any way to solve it? Thank you very much in advance!

## options – Subscript keyboard shortcut not working on Mac OSX

The keyboard shortcut `ctrl+_` for subscript does not work on Mac OSX (Swiss keyboard layout). If I use German layout, I can make subscript but no fraction. I’ve tested on different machines. It always gives a fraction instead, for which the shortcut is `ctrl+-`.

## macbook pro – Subscript, super script, and special symbols as Keyboard shortcuts

I need to write a statistical paper. So I need to use subscripts and superscripts, often with in the same alphabet. For example X^2 at time “t”, time “t-1” etc. I also need to type special symbols like beta, theta, alpha etc.
This is possible in Microsoft Word I am aware, but i often use a note taking app like notability to jot down my notes before transferring them into the final draft.

For apps like that you need to harcode the symbol and the keyboard shortcut in the “keyboards” in system preferences.

1. Is there a way to add these subscripted and superscripted versions of alphabets and numbers to that window?
2. If the above is fulfilled, Is there a way I can do this without having to type out each in the characters in the keyboard window, and instead upload everything from a previously created file?

## plotting – Variable subscript in AxesLabel

I am calling $$y_{n}=x^{n}$$ and I want to plot $$ln(y_{n})$$ for a number of different integer values of $$n$$ (I know this is very simple- it’s actually a much simpler version of what I’m actually trying to do). If I execute

``````Table(Plot(Log(x^n), {x, 0, 1},
AxesLabel -> {"x", "ln(" Subscript(y, n) ")"}), {n, 1, 3})
``````

the final part of the $$y$$ axis label moves to the front. Is there any way to avoid this whilst also properly displaying the subscript. Thanks in advance for any help.

## c++ – error: invalid types ‘int[int]’ for array subscript

I keep receiving this error in some of my functions, how can I fix it?

“error: invalid types ‘float(float)’ for array subscript
99 | avg(i) = sum(static_cast(i)) / 5;
| ^”

void count (int s(), float avg(), int size)
{
float sum = 0.0;
for (int i = 0; i < size; i++)
{
//sum of test scores of students
cin >> s(i);
{
sum += s(i);
// calculate average
avg(i) = sum(static_cast(i)) / 5;

``````}
``````

}
}

## macos – Why can’t I see subscript “s” (Unicode Character “ₛ” (U+209B)) even though I can see lots of other unicode characters?

So you can copy paste even if you can’t see it – subscript “s” (Unicode Character “ₛ” (U+209B))

My main meta question Should I edit the squares in this title? Is it just me who’s seeing them? explains that when I view the site https://www.compart.com/en/unicode/U+209B

Question: I use unicode characters from compart.com and elsewhere frequently (greek letters, arrows, degrees symbol) and I’ve never had a problem, what is suddenly so challenging about this subscript s?

I see this in MacOS 10.11 and Chrome on a late 2012 MacBook Air

and this in MacOS 10.15 and Safari on a brand new 2020 MacBook Air

## Format math formulas in Google Docs – nest multiple superscript and subscript levels

Does anyone know if Google Docs supports nested superscripts and subscripts like the following?

Ax3rd

C.x2nd

When I try the Format-> Text menu options, everything is formatted relative to the main line. If the same formatting is applied to text that already has this attribute, this option is disabled instead of allowing embedding in text.