Message Boards Message Boards

0
|
6607 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to avoid duplicated units in the results?

Posted 8 years ago

As you can see below, i'm trying to make a function. But how can I avoid that the unit in the result is duplicated? I would like it to just calculate the result with one unit (GJ/t)

POSTED BY: Benny Bomstærk
4 Replies

Thanks Marco, it makes sence.

POSTED BY: Benny Bomstærk

Hi,

no it should not be shown as you say. Note that $m$ has no units. You have the value of 0.1 and you subtract it from 1, which has no units. that means the the second term of $H_v$ does not have any units either, just as the $(1-m)$ expression in the first term. The thinh his that the first term is multiplied by $t$, which does have units. That means that your equation is inconsistent and should not simplify as you say.

It would also be useful if you typed in the equations instead of using a screenshot.

pille = Quantity[19.0, "Gigajoules"/"MetricTons"];
Subscript[Hnew, v][m_, t_] :=  t*(1 - m) - Quantity[2.442, "Gigajoules"/"MetricTons"] * m
Subscript[Hnew, v][0.1, pille]

gives the result that you expect.

Cheers, Marco

POSTED BY: Marco Thiel

Nor does this way do the right thing

POSTED BY: Benny Bomstærk

As you can see in the screenshot i'm trying to make a function. But how can I avoid that the unit in the result is duplicated?

POSTED BY: Benny Bomstærk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract