Questions tagged [units]
Questions about using, converting, or interpreting units of measurement in Mathematica.
58
questions with no upvoted or accepted answers
12
votes
0
answers
108
views
Differences of Quantities gives different result in different Mathematica version
In Mathematica 12.2
Differences[{Quantity[1, "mm"], Quantity[1, "mm"]}]
gives
...
8
votes
0
answers
345
views
Spectral Radiance unit Flicks is not correct
Bug introduced in version 10.3 or earlier and fixed in 11.1.
I was pleasantly surprised that Mathematica (10.3, 10.4, 10.4.1, 11.0 and 11.0.1) had the unit $\text{flick}$ until I spent several hours ...
7
votes
0
answers
468
views
Incomplete implementation of units?
I've been playing around with the new units capability in MMA9 and I'm becoming a bit frustrated with what I perceive as an incomplete implementation of this capability and I'm wondering if there are ...
6
votes
0
answers
93
views
Join on QuantityArray
I need to merge two QuantityArray objects of mixed type. My first attempt looks something like:
...
6
votes
0
answers
149
views
Calculations with "Quantities" Run Slow. What am I doing wrong?
This code plots a 1000 point black body radiation curve in 0.7 seconds.
...
5
votes
0
answers
44
views
Any progress on Plots of Quantities?
Plots of quantities still don't seem to work. I've implemented the one suggestion people have: use Evaluate, but now the values of my plots are just completely off ...
5
votes
0
answers
76
views
Plotting InterpolationFunction over Quantities
What's the proper syntax to plot Interpolation functions defined over Quantities?
points = {{0, 0}, {1, 1}, {2, 3}, {3, 4}, {4, 3}, {5, 0}};
Change domain to ...
5
votes
0
answers
83
views
Problem with specifying quantity value in FormulaData
I wanted to use the formulas for KineticEnergy and KineticEnergyRelativistic with specific quantity vaules. The later formula ...
5
votes
0
answers
462
views
Is it possible to use Gaussian cgs units in Mathematica computations?
I was trying to do computations in Gaussian cgs units, and of course I failed due to dimensional issues. For instance, $q_1 q_2/r$ cannot be converted to $\mathrm{erg}$ since Gaussian system uses $4\...
4
votes
0
answers
84
views
MixedUnit in Fractions
Is there a way to have a more common output format on MixedUnit?
...
4
votes
0
answers
102
views
Force Solve to respect unit system
I give Solve quantities in FPS and it returns resulting quantities in SI, necessitating that I add an entire section to my workflow where I pick apart the solution ...
4
votes
0
answers
73
views
Does AroundReplace work with Quantity?
When I try to use AroundReplace with units it issues Around::compat message and outputs something strange:
...
4
votes
0
answers
55
views
Preventing changes in TimeObject's TimeZone with subsequent operations
Is there an option or method to lock TimeZone in TimeObjects? For example,
...
4
votes
0
answers
175
views
Timeout in implicit Wolfram|Alpha calls, but WolframAlpha works
In general we expect this to work:
Quantity["Speed of light"]
Quantity[1, "SpeedOfLight"]
And it does because it can make use of Wolfram|Alpha.
Oddly, though, ...
4
votes
0
answers
324
views
Setting default units for output
Is it possible to set a default set of units for output?
I've just discovered the joys of units and Quantity. Ideally, I'd like to be able to tell Mathematica to ...
4
votes
0
answers
70
views
QuantityForm does not work with MixedRadixQuantity?
Bug introduced after 9.0 and in 10.1 or earlier, and persisting through 11.2 or later
From 10.1 to 10.3.1, QuantityForm[q, "Abbreviation"] outputs
From 10.4 to 11....
4
votes
0
answers
59
views
Unit of output changes when constant quantity is moved over integral
Bug introduced in 9.0 and persisting through 11.0.1 or later
Quantity is new in 9.0.
Why do these two expressions give the same result in different units?
In:
<...
4
votes
0
answers
123
views
Inequality involving Quantity stays unevaluated
Bug introduced in 10.1 and solved in 11.1
An expression like this one
a < x < b
is represented as
Less[a, x, b]
...
3
votes
0
answers
47
views
How to stop Quantity from evaluating
I'm trying to get an expression to display, without it evaluating it's internal arguments, but for some reason, when given the Quantity function, HoldForm doesn't seem to do what I expect:
Code
...
3
votes
0
answers
96
views
UnitConvert having trouble multiplying Boltzmann's Constant with Fahrenheit?
T:=70 Quantity["DegreesFahrenheit"]
kb:=Quantity["BoltzmannConstant"]
UnitConvert[kb UnitConvert[T, "Kelvins"], "Electronvolts"] // N
Returns 0.0253575 eV while
<...
3
votes
0
answers
135
views
Can FindFit be used with units?
I am trying to use the units capabilities of Mathematica throughout a course that I am teaching, but am finding that it isn't uniformly implemented across many functions. In particular, I would love ...
3
votes
0
answers
152
views
How to insert a formula to FormulaData?
Unit Checking Demo
In order to throw a unit error,we run the code
...
3
votes
0
answers
284
views
Physical constants seems broken in 10.3
For example, if I just enter Quantity["GravitationalConstant"], then the result is this
...
3
votes
0
answers
65
views
TimeSeriesInsert issue with Quantity expressions
Solved in Mathematica v10.3
This first sample code works as expected:
...
3
votes
0
answers
115
views
Powers of dimensionless quantities: is this a bug?
Today I came across the following behavior:
Quantity[x, "Minutes"/"Minutes"]^-1
(* Quantity[1/x, (1/#1 &)[("Minutes")/("Minutes")]] *)
It seems that ...
2
votes
0
answers
72
views
Why does different nondimensionalizations give different results? Although the results should be the same
I have some problems with the non-dimensionalization of the Hamiltonian of motion in a Coulomb field.
The Hamiltonian has a following form:
$$H=-\frac{\hbar^2}{2\mu^*} \Delta_r-\frac{e^2}{\epsilon_0 r}...
2
votes
0
answers
99
views
Using units in NBodySimulation function
I'm trying to use NBodySimulation to run a simulation of objects such as stellar masses.
I've tried using the InverseSquare and Newtonian settings on NBodySimulation for this, but InverseSquare doesn'...
2
votes
0
answers
69
views
How to get Integrate to determine units
In a similar fashion to the question asked here, I am having trouble trying to get Integrate to correctly determine the units of the integrand:
Here I have plugged in specific values into the general ...
2
votes
0
answers
112
views
Why aren't radians dimensionless?
α = Quantity[-3, ("Radians")/("Seconds")^2];
ω = Quantity[-4, ("Radians")/("Seconds")];
r = Quantity[2, "Feet"];
at = α r
an = ω^2 r
a = Sqrt[an^2 + at^2]
...
2
votes
0
answers
164
views
How to handle Units when Integrating?
I have some functions defined, which are to use units. Now another function is used to integrate over those, with the integration variable also quantified and the input to said function. I better just ...
2
votes
0
answers
111
views
Mathematica not simplifying expressions with units
Hi I'm having an issue with the Quantity system.
On the guide for units on the wolfram page, there is an example
...
2
votes
0
answers
54
views
Is there a way to include holiday calendar into Quantity system?
Suppose I have a long list of business hours but in different denominations for postings like as follows. If I just use the vanilla UnitConvert it just does a ...
2
votes
0
answers
55
views
SemanticImport changes "string" type to "quantity" type--how to change during import or after import?
This question may overlap with other questions about the quirks of SemanticImport, but I don't see this specific wrinkle on StackExchange and I hope it will be a simple answer to help me and others ...
2
votes
0
answers
157
views
Insert a Quantity Unit literal in TraditionalForm
Is there a keyboard shortcut for creating something like the result of this:
Quantity["Kilograms" * ("Meters")^2 / ("Seconds")^2]
After copying the result to a <...
2
votes
0
answers
89
views
Will aliasing the Quantity and UnitConvert functions to "in" and "to" create problems?
It seems that there is a lot of interest in enhancing the use of units in Mathematica; various solutions in the name of brevity, correctness, and general utility have been demonstrated. I've begun ...
1
vote
0
answers
78
views
How to prohibit automatic DegreesCelsius converting to Kelvins?
On this wiki page, temperature conversion is presented clearly. For example.
It also warns that we should take care of temperature difference conversion which is a different conversion as
It is ...
1
vote
0
answers
96
views
StreamPlot "Part is not a Graphics primitive or directive."
I am trying to use StreamPlot with units. Here is a minimal example to produce the error "Part is not a Graphics primitive or directive." :
...
1
vote
0
answers
36
views
Safely coercing units from Wolfram|Alpha freeform input
How do I coerce unexpected units from free-form input? For instance, if I request the binding energy of hydrogen I expect an answer with dimensions of energy. Instead I get
...
1
vote
0
answers
59
views
Issue displaying units with Quantity[] inside bar legend
Quantity[] is displaying some inconsistent behaviour when used in BarLegend[]. Compare the following two examples:
...
1
vote
0
answers
77
views
Plotting a quantity-based function doesn't work
Creating the function:
...
1
vote
0
answers
44
views
Computing matrix eigenvalues with units
I apologize if this is a basic question or if I am not giving enough detail. I'm trying to solve for the eigenvalues of a matrix with matrix elements that have units.
...
1
vote
0
answers
26
views
What is the reason StandardDeviation doesn't cooperate with Quantity "Percent"?
Consider the following list of numbers
y = {13, 0.2, 11.201};
Turning y into a list of ...
1
vote
0
answers
97
views
UnitSimplify rules?
Code as following:
...
1
vote
0
answers
68
views
Manipulating a ParametricFunction to handle units
I have a pretty nice way to handle units on a result from NDSolve, which basically consists of converting all of the units to SI, stripping them, calling NDSolve, and then putting the units back. I'll ...
1
vote
0
answers
51
views
Buggy IntervalUnion with Quantities?
IntervalUnion can give wrong output when used with Quantity:
...
1
vote
0
answers
95
views
How to get a conversion factor in new system of unit
There is some numerical relation $I = \frac{c}{8\pi} E^2$ between the wave intensity $I$ and the electric field strength $E$ written in CGS (centimetre, gram, second) system of units, where $c$ is ...
1
vote
0
answers
39
views
Using Infinity with AutomaticUnits
I am using the AutomaticUnits package in Mathematica 10, and I am writing some unit checking functions. However, I run into a problem when I have an Infinity, since ...
1
vote
0
answers
122
views
Using Quantity[] units causes errors in my calculation
I have an interpolation function in which I wish to use actual units. If I perform the calculation normally, it works fine and returns a proper FittedModel.
To illustrate my problem, consider the ...
1
vote
0
answers
106
views
Geodesy without units?
Suppose I'm interested in the latitude of Los Angeles and I do the following:
...
0
votes
0
answers
41
views
quantity of `Around` with "DimensionlessUnit"
Quantity[1, "DimensionlessUnit"]
gives pure number
1
However,
...