I A matter of style? Algebra, Arithmetic, Variables

AI Thread Summary
The discussion centers on the tendency of some professionals in engineering and physics to avoid using variables in solving mathematical problems, despite their education in algebra and calculus. Participants note that using variables can enhance clarity and reduce errors, particularly in programming, where named constants improve code maintainability. There is debate over the necessity of assigning variables to all numbers in simpler problems, with some arguing that certain constants do not require variable representation. The conversation highlights the importance of self-documenting expressions and the advantages of using variables for complex calculations, including unit management. Overall, the preference for variable use in both mathematics and programming is emphasized for its benefits in problem-solving and clarity.
symbolipoint
Homework Helper
Education Advisor
Gold Member
Messages
7,561
Reaction score
2,003
TL;DR Summary
Different people like to or are forced to choose variables and some do not. I wonder if this is a matter of style or how a person was taught.
When people graduate and have their degrees in engineering or physics or mathematics or what they may have done, some of these people will use some mathematics, very often which is some-what complicated (or not) arithmetic. Why will some people choose to strictly avoid using variables in the numeric problems they solve? Why would these people not choose variables for what they are looking for? Further, why so rarely anyone give variables to all numbers involved in a problem situation (assuming only rational or linear or maybe quadratic relationships) and solve for what is wanted, all in variables like to have a formula as a result; and then to use that formula for any example which fits the situation? Seems strange to me that a person would go through their courses Algebra 1 through Calc&AnalyticGeometry 3, several different science or engineering courses, and then later when on the job never use some variables to solve some multi-step numeric problems. Did anybody of the group recall like in first learning Physics: Assign variables to everything, and then solve all in variables, and to substitute the values last?
 
Mathematics news on Phys.org
symbolipoint said:
Did anybody of the group recall like in first learning Physics: Assign variables to everything, and then solve all in variables, and to substitute the values last?
I heard it. Did not always agree w/ it.
 
Yes, I tended to work that way anyway because I would make simple arithmetic mistakes and doing it at the end made it easier to find.

In programming you get a lot more flexibility using variables over literal constants. Choosing the right variable names can self-document your expressions and help you spot errors before they drive you crazy.

I know the time I've used the quick expedient of a literal constant I'd regret it later when I had to locate usages and change them struggling over whether the constant I'm looking at with the same value is the one I need to change.
 
  • Like
Likes Stephen Tashi and symbolipoint
Emphasis added
symbolipoint said:
Further, why so rarely anyone give variables to all numbers involved in a problem situation
I have a problem with 'all' in the sentence above. The generalization here should not be taken to extremes, as in the following example.
Problem:
I have a small garden whose dimensions are 10 ft. by 20 ft. How much fencing do I need to buy to fully enclose this garden.
Solution:
Let two = 2
Let width = 10
Let length = 20
Perimeter = two * (width + length) = 2 * (10 + 20) = 60

Because it is not likely that the formula for the perimeter of a rectangle is likely to change in the next few years, there is need to define a variable for the constant 2 in this formula.
 
  • Like
Likes SammyS
Mark44 said:
Emphasis added
I have a problem with 'all' in the sentence above. The generalization here should not be taken to extremes, as in the following example.
Problem:
I have a small garden whose dimensions are 10 ft. by 20 ft. How much fencing do I need to buy to fully enclose this garden.
Solution:
Let two = 2
Let width = 10
Let length = 20
Perimeter = two * (width + length) = 2 * (10 + 20) = 60

Because it is not likely that the formula for the perimeter of a rectangle is likely to change in the next few years, there is need to define a variable for the constant 2 in this formula.
Understood.
The intent of the question is about more involved number-situations, using or needing ratios, rational expressions, volumes, compositions of mixtures.
 
One other thing folks can do with variables is to carry the units of measure (UoM) so that once again you've self documented the data in a way to at least spot a UoM error. In my field, we are constantly worried about converting english to metric and back again or radian measure to degrees and back. The scientific side prefers the metric units by the enduser prefers english measure.

There are guidelines for variable naming that some folks use or used to use. One such example was Symonyi notation where variable prefixes told you the datatype or usage of the variable. It was kind of cool to use until you realized that each programmer might extend it using their own personal conventions and then it got harder to read.

Early FORTRAN had some builtin conventions where variables starting with the letters I thru N where considered INTEGERs and anything else was a REAL. FORTRAN did allow you to override the convention but then that would confuse other programmers maintaining your code.
 
symbolipoint said:
Did anybody of the group recall like in first learning Physics: Assign variables to everything, and then solve all in variables, and to substitute the values last?

I don't recall being taught it explicitly, but it's probably the approach my professors used and certainly the approach I prefer myself. The symbols give the equation meaning, and it's much easier to see at a glance what's going on.

I definitely use this approach in computer programming as well, and I think that's recommended in computer science. That is, to use named variables or constants rather than numerical values. For instance if you are writing code for something that uses 72 pixels per inch you'd define a constant PIXELSPERINCH to be 72. There may be other constants that depend on that value, so they'd be given as formulas in terms of PIXELSPERINCH.

In coding this has the practical advantage that you can change PIXELSPERINCH to be a different value and it automatically corrects all code that depends on that value. But it also includes the readability when values have a meaningful name, not just a number.
 
Back
Top