In programming or mathematics, a variable can take any value.
Due to some reason, now I have to determine a variable to a specific value, say 3.14, and users/callers cannot freely change it.
How would I describe this?
"I fix the variable pi to 3.14"?
It sounds like to me that pi had something wrong, for example pi was 3.13, a typo, and I have to repair to 3.14.
Besides, "fix" has too many meanings.
"I pin the variable pi to 3.14"?
I feel pin fits the context. https://www.oxfordlearnersdictionaries.com/definition/english/pin_2
- to attach something onto another thing
- to make somebody unable to move by holding them or pressing them against something
But I searched StackOverflow, people seem not to say "pin a variable".
"I freeze the variable pi to 3.14"?
Are there any better word choices?
When you read "fix a to b", do you feel a had something wrong?
How do I say to express giving a definite value/choice to a variable/possibilities in math or physics? The answer is to use fix or set, but the context is a bit different. In that question, it just so happens that I choose Lorentz frame to evaluate the problem. It's ok to use other frames. But in my context, although there is a blank, I must fill in Lorentz frame, otherwise it will cause catastrophic failure.