WeBWorK Main Forum

Units (small issue/bug)

Units (small issue/bug)

by Zak Zarychta -
Number of replies: 7

Can anyone explain to me why when requiring an answer including the units or frequency, that WeBWorK will accept Hz (hertz) but not s^-1 (reciprocal seconds) or vice versa?

In reply to Zak Zarychta

Re: Units (small issue/bug)

by Alex Jordan -
This has come up before. The explanation is that here is where Hz is defined:
https://github.com/openwebwork/pg/blob/37637e2f880bccbbb8781b5d669421849ac81267/lib/Units.pm#L385

For some historical reason I don't know, there is a factor of 2π. It seems like instead of an abstract "1 per second" its "1 cycle per second" and a cycle/rotation is 2π radians.

Any ideas how to make this "better"? It seems conceptually correct to have a numerator unit of some sort (one cycle per second, one iteration per second, etc.) but in my experience that is largely ignored. Maybe in physics or engineering somewhere, it's more common to measure in radians per second?
In reply to Alex Jordan

Re: Units (small issue/bug)

by Danny Glin -

It looks like in WeBWorK radians are defined as a fundamental unit, and 1Hz is defined as 2pi radians/second.

It also appears that a "cycle" is an accepted unit in WW, defined as 2pi radians, so a student could replace Hz with cycle/s and be marked correct.

I see two questions:

  1. As Alex asks, should there be something in the numerator when using 1/s?  I don't know enough about SI units to know whether 1Hz should be equivalent to 1/s.
  2. Are there problems that rely on the current definition of Hz in WeBWorK?  I took a quick look through the OPL and didn't see anything that would break if this definition were changed, but I wasn't overly thorough.

It's also worth noting that kHz and MHz are defined in an analogous way, so if Hz was changed then those would have to be changed to match.

In reply to Danny Glin

Re: Units (small issue/bug)

by Sean Fitzpatrick -
This is not the same issue, but I am wondering if it would be possible to update Units.pm to allow both m^2 and m^(2) for square metres.
The latter is what gets entered for anyone using WeBWorK with MathQuill turned on, which is 99.99% of our students.

Even after editing each question I assign that has units in it to add a little paragraph explaining that for problems with units, you have to click the Text Mode button on the MathQuill toolbar to enter units, I still get about 20% of students hitting the email instructor button over this.
In reply to Sean Fitzpatrick

Re: Units (small issue/bug)

by Glenn Rice -

Sean, this is a change that is coming, although not in the form you suggest.  You will have to wait for the next release of WeBWorK though.

In reply to Glenn Rice

Re: Units (small issue/bug)

by Sean Fitzpatrick -

Thanks Glenn. As long as there's a change that supports entering units with MathQuill turned on I don't think we'll be picky about implementation.

In reply to Sean Fitzpatrick

Re: Units (small issue/bug)

by Glenn Rice -

I just put in pull requests to webwork2 and pg that implement the changes.  See https://github.com/openwebwork/webwork2/pull/1522 and https://github.com/openwebwork/pg/pull/614 (and technically also https://github.com/openwebwork/mathquill/pull/1).

In reply to Zak Zarychta

Re: Units (small issue/bug)

by Michael Gage -

This did come up long ago.  Here is one reference https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4269

and here is a relevant comment from wikipedia. https://en.wikipedia.org/wiki/Hertz  This issue seems to concern the units used for angular velocity and angular frequency. As I recall there was further discussion with engineers about this but I can't find it. (It might have been private communication.)


The occurrence rate of aperiodic or stochastic events is expressed in reciprocal second or inverse second (1/s or s−1) in general or, in the specific case of radioactive decay, in becquerels.[9] Whereas 1 Hz is one cycle per second, 1 Bq is one aperiodic radionuclide event per second.

Even though angular velocity, angular frequency and the unit hertz all have the dimension 1/s, angular velocity and angular frequency are not expressed in hertz,[10] but rather in an appropriate angular unit such as radians per second. Thus a disc rotating at 60 revolutions per minute (rpm) is said to be rotating at either 2π rad/s or 1 Hz, where the former measures the angular velocity and the latter reflects the number of complete revolutions per second. The conversion between a frequency f measured in hertz and an angular velocity ω measured in radians per second is

ω=2πf{\displaystyle \omega =2\pi f\,}\omega =2\pi f\, and f=ω2π{\displaystyle f={\frac {\omega }{2\pi }}\,}f={\frac {\omega }{2\pi }}\,.

The hertz is named after Heinrich Hertz. As with every SI unit named for a person, its symbol starts with an upper case letter (Hz), but when written in full it follows the rules for capitalisation of a common noun; i.e., "hertz" becomes capitalised at the beginning of a sentence and in titles, but is otherwise in lower case.

reference: https://en.wikipedia.org/wiki/Hertz

https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4269