Make Units Work for You - Comments

In summary, Greg Bernhardt submitted a new PF Insights post titled "Make Units Work for You" where he discusses the fundamental and useful trick of using dimensional analysis in mathematical calculations. He shares his own experience of learning this technique in his university engineering class and praises it as an "epiphany". The post also includes additional comments and insights from other users, with some suggesting alternative methods and preferences for using dimensional analysis. The article aims to appeal to a broad readership and highlights the practical application of these techniques in solving complex problems in fields like electromagnetism.
  • #1
scottdave
Science Advisor
Homework Helper
Insights Author
Gold Member
1,978
961
Greg Bernhardt submitted a new PF Insights post

Make Units Work for You
unitsworkforyou.png


Continue reading the Original PF Insights Post.
 

Attachments

  • unitsworkforyou.png
    unitsworkforyou.png
    10 KB · Views: 844
  • Like
Likes QuantumQuest, StoneTemplePython, Asymptotic and 3 others
Mathematics news on Phys.org
  • #2
Such a fundamental and useful trick. I still remember when I learned it in one of my first university basic engineering classes. What an epiphany! :smile:
 
  • #4
Greg Bernhardt said:
Great first Insight @scottdave!
Thanks,
I had fun writing it, and learned a little more about LateX, as well.
 
  • Like
Likes Charles Link and Greg Bernhardt
  • #5
Thanks @scottdave for a great Insight. Dimensional analysis is in my opinion a underrated method/trick to check complicated expressions.
 
  • #6
I have an additional comment or two. I like the way @scottdave shows the conversion by multiplying by 1, as in the example with ## 1=\frac{2.54 \, cm}{1 \, inch} ##. There is one other thing that I find useful in doing some of the more difficult conversions, and that is to write the quantity such as length ## \vec{L} ## as a vector. In that case ## \vec{L}=L_{cm} \hat{cm}=L_m \hat{meter} ##. We can solve for ## L_{cm} ## in terms of ## L_m ## if we know that ## 1 \hat{meter}=100 \hat{cm} ##. In that case ## L_{cm}=100 \, L_m ##. This kind of thing comes in handy, e.g., in converting E&M (electricity and magnetism) quantities in c.g.s. to M.KS. and visa versa. This is a more advanced application, but on occasion, it is useful also on simpler conversions.
 
  • Like
Likes scottdave
  • #7
Charles Link said:
I have an additional comment or two. I like the way @scottdave shows the conversion by multiplying by 1, as in the example with ## 1=\frac{2.54 \, cm}{1 \, inch} ##. There is one other thing that I find useful in doing some of the more difficult conversions, and that is to write the quantity such as length ## \vec{L} ## as a vector. In that case ## \vec{L}=L_{cm} \hat{cm}=L_m \hat{meter} ##. We can solve for ## L_{cm} ## in terms of ## L_m ## if we know that ## 1 \hat{meter}=100 \hat{cm} ##. In that case ## L_{cm}=100 \, L_m ##. This kind of thing comes in handy, e.g., in converting E&M (electricity and magnetism) quantities in c.g.s. to M.KS. and visa versa. This is a more advanced application, but on occasion, it is useful also on simpler conversions.
These techniques can definitely be applied to more complex calculations. It is probably more critical to use these methods in those situations.

I chose to keep my examples fairly simple, so that the article might appeal to a broader readership.
I can't tell how many questions I have seen on PhysicsForums and other sites, where these techniques would have solved the problem for the OP.
 
  • Like
Likes Charles Link
  • #8
I like everything about your article, but there is one point of contention I would like to make. Setting these ratios equal to ##1## is a matter of preference, and I prefer to follow the advice of Arnold Arons and :sedulously avoid" it. I understand the motivation for using it, which is to imply that it's okay to use it as a multiplicative factor in the same way that it's okay to use ##1## as a multiplicative factor. But expressions like $$frac{2.54 mathrm{cm}{1 mathrm{m}}=1$$ can be a source of confusion for learners. I think it better to simply state that multiplying by the factor $$frac{2.54 mathrm{cm}{1 mathrm{m}}$$ is a perfectly acceptable practice. After all, it is not the same thing as multiplying by ##1## because it has the effect of changing the units.

But I realize that this is entirely a matter of preference. I have a colleague who disagrees, stating that students are likely to encounter it presented that way. But I disagree.

Reference https://www.physicsforums.com/insights/make-units-work/
 
  • #9
Let's try getting the LaTeX coding right one more time ...

I meant to say that I prefer not using expressions like $$frac{2.54 mathrm{cm}}{1 mathrm{m}}=1$$

But instead prefer $$frac{2.54 mathrm{cm}}{1 mathrm{m}}$$
 
  • #10
Mister T said:
Let's try getting the LaTeX coding right one more time ...

I meant to say that I prefer not using expressions like $$frac{2.54 mathrm{cm}}{1 mathrm{m}}=1$$

But instead prefer $$frac{2.54 mathrm{cm}}{1 mathrm{m}}$$
Interesting point, @Mister T. I see where you are coming from. The point that I intended was it is easier to figure out if the factor by going through and setting 2.54 cm equal to 1 inch. Then, you can have either (2.54 cm) / (1 in) or (1 in) / (2.54 cm), depending on which way you need to go. I believe this is easier than trying to remember "If I want to convert from centimeters to inches, then divide by 2.54".

It seems that LaTeX works differently in the comment section than in regular posts? At least on this browser.
 
  • Like
Likes Mister T
  • #11
Mister T said:
I like everything about your article, but there is one point of contention I would like to make. Setting these ratios equal to ##1## is a matter of preference, and I prefer to follow the advice of Arnold Arons and :sedulously avoid" it.
Mister T said:
I understand the motivation for using it, which is to imply that it's okay to use it as a multiplicative factor in the same way that it's okay to use ##1## as a multiplicative factor. But expressions like $$frac{2.54 mathrm{cm}{1 mathrm{m}}=1$$ can be a source of confusion for learners.
What you wrote would be a source of confusion for anyone.
I think you meant ##\frac{2.54 \text{ cm}}{1 \text{ inch}} = 1##, which to me is perfectly fine. Since 2.54 cm = 1 in, divide both sides by "inch" to produce the equation I wrote, or even ##2.54~\frac{\text{ cm}}{\text{ inch}} = 1##.
Mister T said:
I think it better to simply state that multiplying by the factor $$frac{2.54 mathrm{cm}{1 mathrm{m}}$$ is a perfectly acceptable practice.
Except that 2.54 cm is NOT equal to 1 m.
Mister T said:
After all, it is not the same thing as multiplying by ##1## because it has the effect of changing the units.
If you accept, say, that 2.54 cm represents the same lengh as 1 inch, then we can write 2.54 cm = 1 in, recognizing that we're talking about the same length measure, but with different units. It follows that the ratio ##\frac{2.54 \text{ cm}}{1 \text{ inch}}## is dimensionless and equal to 1. Being 1, we can multiply whatever we want by it without changing the underlying value of what it is multiplying.
Mister T said:
But I realize that this is entirely a matter of preference. I have a colleague who disagrees, stating that students are likely to encounter it presented that way. But I disagree.

Reference https://www.physicsforums.com/insights/make-units-work/
 
Last edited:
  • Like
Likes StoneTemplePython
  • #12
This is so useful for me. I've watched a bunch of videos on it and this explains it much better. So are you treating the units like variables essentially?
 
  • #13
scottdave said:
Interesting point, @Mister T. I see where you are coming from. The point that I intended was it is easier to figure out if the factor by going through and setting 2.54 cm equal to 1 inch. Then, you can have either (2.54 cm) / (1 in) or (1 in) / (2.54 cm), depending on which way you need to go. I believe this is easier than trying to remember "If I want to convert from centimeters to inches, then divide by 2.54".

Yes, I agree completely. Teaching students to multiply by the appropriate ratio is the way to go. My point is that it's not necessary, and adds to student confusion, when you set those ratios equal to 1. While I agree that it's valid in the sense that it's being used, its only utility is to justify the practice of multiplying by ratios. There's no need for a student to ever see an expression like 2.54 cm = 1 in. Some people like to instead write 2.54 cm ##\hat{=}## 1 in. to make the distinction clear that the two quantities represent the same length and in that sense are equivalent rather than being equal.

It seems that LaTeX works differently in the comment section than in regular posts? At least on this browser.

Well, I buggered that up pretty good, didn't I? Especially when I wrote m instead of in.
 
  • #14
DS2C said:
This is so useful for me. I've watched a bunch of videos on it and this explains it much better. So are you treating the units like variables essentially?
That would be a way to think about it, or as vectors of certain lengths, as @Charles Link stated in his post.
 
  • Like
Likes Charles Link

Related to Make Units Work for You - Comments

What does "Make Units Work for You - Comments" mean?

"Make Units Work for You - Comments" refers to the practice of using comments in programming code to clearly indicate the units of measurement being used within the code. This helps to ensure accuracy and consistency in calculations and conversions.

Why is it important to use comments for units?

Using comments for units helps to avoid confusion and errors in programming code. It also makes the code more readable and easier to understand for other developers who may need to work with the code in the future.

What are some common units used in programming?

Some common units used in programming include length (e.g. inches, meters), time (e.g. seconds, minutes), mass (e.g. grams, kilograms), and temperature (e.g. Celsius, Fahrenheit). There are also many other specialized units used in different fields and industries.

How do you properly format units in comments?

Units should be written in all capital letters and enclosed in curly braces, with a space between the value and the unit. For example, {5 METERS} or {100 KILOGRAMS}.

Are there any tools or resources available to help with using units in code comments?

Yes, there are various online tools and libraries that can assist with converting units and formatting them in comments. Some popular ones include the Units.js library and the ConvertUnits website.

Similar threads

Replies
25
Views
5K
Replies
1
Views
2K
  • General Math
4
Replies
105
Views
11K
  • General Math
Replies
8
Views
2K
  • General Math
Replies
5
Views
2K
Replies
3
Views
320
  • General Math
Replies
26
Views
4K
  • General Math
Replies
12
Views
2K
  • General Math
Replies
2
Views
1K
  • General Math
Replies
7
Views
2K
Back
Top