Is the article usage in these examples correct:

1. "Given a mesh M, ..."

2. "Given the vertices of a mesh M, ..."

3. "Define a variable X, ..."

This suggests that it's not:


Zohar LeviThis suggests that it's not:https://english.stackexchange.com/questions/386907/articles-before-variables-with-names?rq=1

I don't think so. Their contexts are different from yours. You are setting things up. And they address only the definite article.

Zohar Levi1. "Given a mesh M, ..."

If we already know what mesh M is, no article, but if not, use the article to mean "given a mesh that we will refer to hereafter as 'M'".

Zohar Levi2. "Given the vertices of a mesh M, ..."

Same as 1.

Zohar Levi3. "Define a variable X, ..."

More context is needed, but when I have seen things like that, it meant I should define a variable and call it X, not that I should find the variable X you're talking about and define it. The article is needed for the former interpretation.

You imply that an indefinite article is needed while the definite article isn't. Since I gave examples only of indefinite articles, can you please give an example with the definite article that can be omitted?

(Your second interpretation of my third example didn't sound right.)

One that I can think of:

"The process is probably something like go talk to girl X in the office."

In this example, I'm supposedly referring to a specific girl, but I'm leaving her name open. Normally, I would just say "go talk to X", but here I'm clarifying that X is a girl. It's kind of a weird example, and I don't think it would work with a mesh or a variable: "go multiply the variable X", where I mean: "go multiply X", and omitting the article doesn't sound right.