Message Boards Message Boards


[?] Why does "1 per week" not correctly handled with "1 month"?

Posted 4 years ago
3 Replies
2 Total Likes

I want to use this function to express that the number of event managers acquired is growing 1 per week. If you look at my evaluation result mathematica does what I like to express.

growtheventmanager[number_, pertime_] := number / pertime
growtheventmanager[1, Quantity[1, "Week"]]
Out[1]=1 per week

Next I want to calculate the number of event managers after 4 weeks. The calculation is done like expected.

Quantity[4, "Week"] * growtheventmanager[1, Quantity[1, "Week"]]

Next i tried what happens if trust Mathematicas ability to handle Units correctly.

Quantity[1, "Month"] * growtheventmanager[1, Quantity[1, "Week"]]

I have no idea what this is all about? Do you have an idea?

3 Replies

There are very clearly 7 days in a week by its definition. There are 12 months in a year. If we said there were 4 weeks in a month, then the unit system would claim that there are 7 * 4 * 12 = 336 days in a year. So we can't do that.

I suppose you could create your own Units with different names like "SimplifiedDay", "SimplifiedWeek", "SimplifiedYear". But that might be a fair amount of work and not worth it.

Posted 4 years ago

Dear Sean,

thanks for helping!

Quantity[1, "Week"] / Quantity[1, "Day"]

evaluates to 7. Why does

Quantity[1, "Month"] / Quantity[1, "Week"]

not evaluate to 4 with respect to the above. I want to do calculations where I just enter growth like 8 per month or 100 per year and are able to compute the count in a weekly base.

This result seems correct to me. Your calculation is basically asking for how many weeks in a month:

Quantity[1, "Month"]/Quantity[1, "Week"]

Since both of these have a dimension of time, we expect their ratio should be dimensionless. Additionally, we expect that the result should be around 4. More specifically, it should be close to 52/12 since there are 52 weeks in a year and 12 months in a year. Mathematica returns a result that's consistent with all of these.

What kind of result were you expecting from the calculation above? There's probably a different way of doing it.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract