# Converting a quantity to a decimal form [closed]

I have a function giving me this:

(5 Coulomb)/(6 Second)


as output. I want this in decimal form and would like to have the variables taken off the end for unit analysis. How would I do this? I have tried NumberForm, but I think that the unassigned variables I am using for units are throwing it off.

EDIT: Here is what I have for code

In[1]: f[P_, V_] := P/V
In[2]: f[100 W, 120 V]
Out[2]:(5 Coulomb)/(6 Second)


In[1]: f[P_, V_] := P/V
In[2]: f[100 W, 120 V]//N[#]&


And got:

Out[2]:(0.833333 Coulomb)/(Second)

• N[(5 coulomb)/(6 second)] gives me (0.833333 coulomb)/second. You could add /. {coulomb -> 1, second -> 1} at the end to get rid of the coulomb and second.
– user484
Commented Jul 6, 2015 at 19:49
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Commented Jul 6, 2015 at 19:49
• When I do Quantity[5, "Coulombs"]/Quantity[6, "Seconds"], then I don't get what you have. Could you make a small example and include code? More importantly, can you say what you mean by variables? I only see numbers and units.. Commented Jul 6, 2015 at 19:50
• You have asked the same exact question again only 8 min after this one: How do I extract variables from an expression. You should not spam the site with duplicate questions. Commented Jul 6, 2015 at 20:08
• @MarcoB, read what I said in my post. I asked two separate questions, one per post, which is what you are supposed to do on StackExchange sites. One was about converting a number to decimal form and the other was about extracting units from an expression. Commented Jul 6, 2015 at 20:13

To be a bit more systematic, I would suggest declaring the units you want to work with in a global variable, and then defining a function unitsToUnity that sets all of those units to unity as follows:
$myUnits = {Coulomb, Second}; unitsToUnity[expression_] := expression /. Thread[$myUnits -> 1]