2
$\begingroup$

I need to take the units off of this expression:

(5 Coulomb)/(6 Second)

In order to do some unit simplification. Is there any way to do this? I have tried Case, but could not get it to work properly. Because I cannot use these if they are put in a table, this is not helpful to me, so please do not mark this as duplicate; in order to be able to use them, I need them to remain one divided by the other.

EDIT: This question was marked as duplicate. Whoever did this misread my other question. This one is about extracting units from an expression and the other is about expressing a fraction in decimal form.

$\endgroup$
2
  • $\begingroup$ Exact duplicate of your other question: Converting a quantity to a decimal form $\endgroup$
    – MarcoB
    Commented Jul 6, 2015 at 20:06
  • $\begingroup$ No it's not. Read what the question is about before marking it as duplicate. If you had done this, you would not have marked this as duplicate. $\endgroup$ Commented Jul 6, 2015 at 20:17

1 Answer 1

3
$\begingroup$

I think QuantityMagnitude and QuantityUnit are the functions you need. In your case,

a = Quantity[5, "Coulombs"]/Quantity[6, "Seconds"];
QuantityMagnitude[a]

Yields 5/6. If you want the units, use

QuantityUnit[a]

Which yields Coulombs/Seconds

$\endgroup$
1
  • $\begingroup$ Is there a way to do the reverse of this? I want to end up with Coulombs/Seconds. $\endgroup$ Commented Jul 6, 2015 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.