Questions tagged [subscript]

A subscript is a number, figure, symbol, or indicator that is smaller than the normal line of type and is set slightly below the baseline.

Subscripts are common in mathematical notation (generally indicating position, such as the index of a variable in a vector) and chemistry formulas (e.g. H2O).

Subscript and superscript (Wikipedia)

625 questions
6
votes
3 answers

Char array subscript warning

when I use char array subscript as in this example: int main(){ char pos=0; int array[100]={}; for(pos=0;pos<100;pos++) printf("%i\n", array[pos]); return 0; } I am getting warning that I am using char array…
Mihalko
  • 563
  • 2
  • 5
  • 14
6
votes
3 answers

Overloading operator [] for a sparse vector

I'm trying to create a "sparse" vector class in C++, like so: template class SparseVector { ... } Internally, it will be represented by an std::map (where V is the type of value stored). If an element is not…
Thomas
  • 174,939
  • 50
  • 355
  • 478
6
votes
1 answer

About the array subscripting operator

Quoting from the C11 standard : Array subsripting (§ 6.5.2.1) The definition of the subscript operator [] is that E1[E2] is identical to (*((E1)+(E2))). I would like to know why are the brackets around E1 necessary (they were missing in the C89…
md5
  • 23,373
  • 3
  • 44
  • 93
5
votes
1 answer

How to fix Erreur : Subscript `AMr1.orig` is a matrix, the data `x.imp[, -possibleFactors][AMr1.orig]` must have size 1

I'm trying to run Amelia to impute some missing data on several variables with the following code: set.seed(1) zz[,c("id", "sex", "team", "minsSocial", "satisTravail", "performance")] <- Amelia::amelia(zz[,c("id", "sex", "team", "minsSocial",…
Marina
  • 53
  • 5
5
votes
6 answers

Inquiry about class variable declarations in C++

I have a class to represent a 3D vector of floats: class Vector3D { public: float x, y, z; float * const data; Vector3D() : x(0.0), y(0.0), z(0.0), data(&x) {} } My question is: are x, y, and z going to be allocated sequentially…
milesleft
  • 51
  • 3
5
votes
2 answers

Python: How to deal with non-subscriptable objects?

I've read a thread on what a (non)subscriptable object is but it doesn't tell me what i can do about it. I have a code calling a mypost private module. The aim is to set up mail accounts and to do this i create MailAccounts() objects defined in the…
neydroydrec
  • 6,973
  • 9
  • 57
  • 89
5
votes
1 answer

How to type subscripts in geom_text labels in ggplot

I have timeseries data plotted and separated by timepoints that I'd like to label with subscripts. Below is the code I'm using to generate the figure and timepoint labels. I'd like for the -1, 3 and 6 to be subscripts. Thanks in…
user10495589
5
votes
1 answer

How to declare "throws" for `subscript(dynamicMember:)`in @dynamicMemberLookup in swift?

When using @dynamicMemberLookup in swift, subscript cannot declare a "throws". subscript(dynamicMember member: String) -> Any This is OK. subscript(dynamicMember member: String) throws -> Any This will give a compile error.
leavez
  • 2,119
  • 2
  • 27
  • 36
5
votes
1 answer

contentEditable superscript & subscript in Chrome

The following DHTML formatting commands each work fine on a div with contentEditable=true in IE, Firefox and Chrome: document.execCommand("superscript", false, null); document.execCommand("subscript", false, null); However, calling the command…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
5
votes
2 answers

R ggplot2 annotate with subscript and tilde

I'm trying to annotate a ggplot2 plot with a label that states the distribution for X1 ~ N(mu=10,sigma=3), where the 1 is meant to be subscript, like this: label1<-"X[1] ~ N( \U03bc = 10, \U03c3 = 3)" When I use label1 like…
MartineJ
  • 591
  • 5
  • 16
5
votes
2 answers

Google sign in ambiguous reference to member 'subscript'

application:openURL:options: method of app delegate. The method should call the handleURL method of the GIDSignIn instance, which will properly handle the URL that your application receives at the end of the authentication process. Directly…
Manish Ojha
  • 515
  • 1
  • 8
  • 26
5
votes
1 answer

Setting subscript and superscript for specific character in the TextView?

Is there a way to set subscript and superscript for specific character in the TextView? I want to display a text that looks like this: So,I tried this code: TextView tv1 = ... ; String latex = "\u222E"; tv1.setText(Html.fromHtml(latex +…
hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
5
votes
1 answer

Subscripting text in matplotlib labels

this is my first question and I am a noob at python. So probably more to follow... I would like to create a figure with matplotlib. In the labels, I would like to include a chemical formula, which involves subscripts (I think the same would work for…
SKchem
  • 51
  • 1
  • 2
5
votes
2 answers

Use a vector to index a matrix without linear index

G'day, I'm trying to find a way to use a vector of [x,y] points to index from a large matrix in MATLAB. Usually, I would convert the subscript points to the linear index of the matrix.(for eg. Use a vector as an index to a matrix) However, the…
David_G
  • 1,127
  • 1
  • 16
  • 36
5
votes
1 answer

Error in *tmp*[[j]] : subscript out of bounds

Apologies for long post! I'm new to R and have been working hard to improve my command of the language. I stumbled across this interesting project on modelling football results:…
Clatty Cake
  • 719
  • 4
  • 8
  • 16