In[]:=
ClearAll["Global`*"]
I first define a function with an argument that has some (implied) units. Here, the logarithm will only work if the argument is unitless.
In[]:=
testFunction[a_]=Quantity[Log[a*Quantity[1,"molar"]^(-1)],"volt"]
Out[]=
If I perform symbolic operations on this function, without other units involved in the operations, the output is as expected.
In[]:=
testFunction[testArgument]
Out[]=
If I use an argument with units, I get exactly what I want.
In[]:=
testFunction[testArgument]/.testArgument->Quantity[1,"molar"]
Out[]=
(a) If I nondimensionalize the function with its exact units and use an argument with units, I get exactly what I want: I recover the above result without units.
In[]:=
testFunction[testArgument]/Quantity[1,"volt"]/.testArgument->Quantity[1,"molar"]
Out[]=
0
(b) However, if I perform an operation using equivalent units, the transcendental part of testFunction has inconsistent behavior and the units are lost. Note that this can no longer be evaluated.
In[]:=
testFunction[testArgument]/Quantity[1,"joule/coulomb"]/.testArgument->Quantity[1,"molar"](*NotethattheLog[]intestFunctionhaslostitsdimensions*)
Out[]=
-3Log[2]-3Log[5]+Log[]
To reiterate, “joule/coulomb” is equivalent to “volt” and the outputs of (a) and (b) should be the same.
In[]:=
Quantity[1,"joule/coulomb"]==Quantity[1,"volt"]
Out[]=
True