Is it a good idea to begin a sentence with a number or a variable name?
Is it acceptable to have the following sentences in formal writing?
2.5 years have already been completed.
or
n shows the number of something.
Solution 1:
Contrary to the other answers, I see no reason not to use the forms shown.
If Abraham Lincoln could say:
"Four score and seven years ago, ..."
... and I can say ...
"15 cars overtook me on the way to work today"
then you can say:
"2.5 years is ..."
Some publications use the convention that single digit numbers are written in full ("One") while larger numbers are written as numberals ("100","15,234").
Likewise, a variable is effectively a noun, and can be used to begin a sentence.
i represents the iteration number.
There is a problem here with capitalisation. Do you capitalise the i to comply with normal English writing conventions? Do you leave the i lower case, because the upper case version would not work in your case-sensitive programming language?
That's a matter of house style. I would personally not capitalise it. Avoiding the issue by always phrasing the sentence differently is a valid strategy.
The variable i represents the iteration number.
The iteration number is represented by i.
Solution 2:
It is generally not recommended in formal prose, because it makes it harder to see where a new sentence begins, as dots are also used for abbreviations. In a technical manual or academic article, I would try to avoid it as well. A new line may provide extenuating circumstances for numbers, though probably not for variables.
Solution 3:
No it is not.
In 4th grade I was taking exam to be accepted in Math High School (one of top 3 in our country). I had to solve some sort of a puzzle problem - deduce what numbers correspond to letters in an equation. It was some sort of a rebus.
My proof was immaculate, but they deducted half of the marks for something like:
"Because of the above conclusions in the equation for A stays 7.6 is the corresponding number for the letter B because ...".
They had read it as 7 times 6.
The alignments and the formats of different types of formal texts have its own rules with the general purpose of allowing the people concerned to read it and to understand it better. So it is not a good idea.