Math writing from code- how to write equations? I have written code (in R) for my research project and am trying to publish a paper. Is there a good guide on how to take the concepts in my code and write them in a paper mathematically?
Specifically, I have two questions:


*

*How do I write that a number has to be a divisor? Is it: If a|b, then... where a is one of the divisors of b?

*If I have an array of indices v, how do I define the values of another array, G, at the index values $\bar{v}$? Is it: $G_{v}= \ $ or maybe $G_{\bar{v}}= \ $?


For example, in my project, objects exist along an axis Z. They occur only when a value is a divisor of the maximum value of an object along Z. Therefore, if $v_{max}$ occurs on Z, then vector $\bar{v}$ is all divisors of $v_{max}$. Also $\bar{v}$ represents the occurrences of all objects along the Z axis. The G values depend on the location of the occurrences, $\bar{v}$. G in the code is defined at these locations. In R, v is a vector and G is a vector. Defining G in R would read as:
G[seq(1,length(v)] = function(v)

G is therefore a function of v, but how would I reference G at a particular v?
 A: In response to your very specific questions

1) 

One would indeed write $a \mid b$ for $a$ divides $b$. However as a general rule, you can find common notation just by searching the English aspect in a search engine.
For instance, searching "Divisor mathematics" gets you to the wiki, which 4 lines down in the definition part says $a \mid b$. After that, deciphering the correct $\LaTeX$ code can be done by Detexify. 

2)

Ultimately you can choose the notation you like. Personally, it would depend on the number of times and density I use the character. If it is dense at a particular page or few then maybe the latter $G_{ \bar v}$. However, if I have to use the symbol often, then I would prefer $G_v$ purely because it looks less squashed. If I refer to $\bar v$ a lot and then have to refer to $G_v$, I might the first time use $G_{ \bar v}$ and explain that I'll also use $G_v$. 
It would appear, from the above paragraph at least, that you have some rigorous construction for this $G_v$. So, you might want to start off with an introduction as to why your paper is worth my half-day of reading and digesting the material. This could include a problem that is initially unsolved that the new $G_v$ solves. Then you might want to define standard terms and then construct the $G_v$ giving lemmas of various properties that $G_v$ might hold. You don't need to give every step, but at various points just reference an algorithm you use and say "Using the Gram-Schmidt algorithm, we can find a vector $w$ which has a bunch of cool properties" (or something along those lines). Other examples would be "From methods discussed in [CoolGuy15], we can find $H_v$ which acts as an intermediate step for finding $G_v$." 
One author that comes to mind is Dan Yasaki, with these particular papers Perfect Forms and Bianchi Forms. Particularly in the second paper, there is a problem discussed and solved by work done in chapter 2 and 3, relying on algorithmic work done in Gunnels' papers.
