Questions tagged [units]
Questions about using, converting, or interpreting units of measurement in Mathematica.
304
questions
2
votes
3
answers
365
views
How to handle units of measurement?
I'm trying to understand how Mathematica handles units of measurement.
That is I expect that a calculation should return a certain unit, but I don't succeed. Let's consider this example:
...
5
votes
3
answers
223
views
How to find all InformationUnits by code method?
As I know, the "Megabytes" and "Gigabits" both are ...
4
votes
3
answers
138
views
Cases syntax when expression sought is a Quantity
From the following list I wish to extract those cases for which the magnitude of a quantity is greater than zero for which I would like to then create a DateListPlot.
...
2
votes
1
answer
56
views
Create by hand a formatted form of quantities
If I evaluate the following cell:
Quantity["PlanckConstant"]
I get as an output a very concise format of this quantity:
Also, compare the legibility of ...
0
votes
0
answers
21
views
Why is ExternalEvaluate running the command Quantity[471.04`, "Kilobytes"] on RaspberryPi
Raspberry Pi 4B with 32 bit Raspberry Pi OS Full:
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
Mathematica for Raspberry Pi 13.1
The command
...
0
votes
0
answers
68
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 ...
0
votes
0
answers
35
views
quantity of `Around` with "DimensionlessUnit"
Quantity[1, "DimensionlessUnit"]
gives pure number
1
However,
...
4
votes
1
answer
99
views
How can the units of the "AtomCoordinates" in a Molecule be changed while keeping the resulting MoleculePlot3D consistent?
Mathematica provides the Molecule function that can be visualized with MoleculePlot3D since version 12.0. Before, importing "XYZ" files would produce a ...
2
votes
2
answers
56
views
ToPolarCoordinates not working with units
I am trying to convert some quantities with units from rectangular to polar coordinates (to get the magnitude and angle). It seems that ToPolarCoordinates command does not calculate the angle when ...
0
votes
1
answer
79
views
Dealing with exponents that contain units?
Many of the equations I deal with involve powers of quantities which contain units. However, when the exponent contains units (e.g., ...
3
votes
2
answers
86
views
Issue with unit conversion
I am getting an error converting energy unit Pa*m^3 (Pascal * Meters^3) to J (Joules).
...
3
votes
1
answer
67
views
Solve not working with cross product with units
I recently asked this question about using Solve with cross product.
Solve not working when doing cross-product
When I use the units in the definition of the variables, I am not able to get an answer.
...
2
votes
0
answers
66
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}...
3
votes
2
answers
132
views
Importing scientific data with uncertainties and units
I want to import scientific data from a CSV file. The data are length measurements in centimeters with uncertainties. I want to import the data with uncertainties and units into a vector - please see ...
5
votes
1
answer
59
views
mesh / region creation in unit meters or mm:
How can we know the unit of mesh or create a mesh in specified length units:
such as, for example I have:
...
1
vote
1
answer
50
views
A problem about the integration of blackbody radiation law using FormulaData. QuantityVariable limits
I am trying to integrate blackbody radiation law under 1500 Kelvin using the FormulaData command.
The integration seems not to work properly after I designate the ...
4
votes
0
answers
83
views
MixedUnit in Fractions
Is there a way to have a more common output format on MixedUnit?
...
2
votes
3
answers
153
views
Accuracy and precision control for a simple calculation [closed]
Consider a very simple calculation: $231 \times (2.54) ^ 3$, which is the number of cubic cm in a US gallon.
On my phone app calculator I got the exact answer, which is $3785.411784$.
On Mathematica, ...
0
votes
1
answer
65
views
How to convert units from percent per year to real number with CountryData? [closed]
I have CountryData coming in via e.g.
...
1
vote
0
answers
66
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." :
...
3
votes
1
answer
89
views
Plotting a function with units gives two different results
With the following code block, I plot a function with units in it in two different ways. Both ways should do the same in my understanding of the documentation.
...
4
votes
1
answer
94
views
Getting Molecular Weight for Stoichiometry Calculations
I love the units system in Mathematica, it's an extremely useful addition to the language. Unfortunately there are still some sharp corners that I run into on a daily basis. For example, if I want to ...
1
vote
2
answers
89
views
Incompatible Units Problem
I am trying to use quantities with physical units to calculate my result, but I encountered the "Incompatible units" problem. I don't know what is going on. Here is my code, could I have ...
0
votes
0
answers
68
views
Extending Dimensional Analysis?
Is there some way to extend Mathematica's dimensional analysis? For example, I'd like to be able to provide it with dimensional equations like energy=mass with units scalings like c^2 and have it ...
12
votes
0
answers
107
views
Differences of Quantities gives different result in different Mathematica version
In Mathematica 12.2
Differences[{Quantity[1, "mm"], Quantity[1, "mm"]}]
gives
...
2
votes
2
answers
321
views
Why does System`Private`ConstructNoEntry[Quantity, 1, "kg"] enter a Recursion?
System`Private`ConstructNoEntry[BesselJ, 0, x]
works fine, and outputs
BesselJ[0, x]
However,
...
3
votes
1
answer
68
views
How to make Quantity remember interpretation?
Units with micro μ prefix needs internet connection to interpret. For example,
Quantity[1, "μm"]
Though after one ...
6
votes
1
answer
193
views
Exporting results containing Entities to JSON?
I am looking for a straightforward way to export results from functions like ImageContents, FacialFeatures, and WolframAlpha - symbols that return stuff containing knowledgebase content.
Aside from ...
14
votes
3
answers
682
views
Dimensionless units like Percent are not treated consistently by functions like Exp or Log. How can pitfalls be avoided?
There are so many false calculations out there that working with Quantity und units—at least initially—should be mandatory in many applications.
Alas, ...
2
votes
1
answer
91
views
Why does the following RegionPlot command not evaluate?
I have some trouble understanding the RegionPlot command. I have defined the following input
...
4
votes
2
answers
87
views
Format Time Reported by AbsoluteTiming
I am trying to format the timing reported by AbsoluteTiming so that it states the hours minutes and seconds of the result. However, probably because ...
0
votes
0
answers
63
views
Why RegionPlot does not work in this example?
I have some trouble understanding the RegionPlot command. I have defined the following input
...
1
vote
1
answer
104
views
Why does RegionPlot show an empty plot?
Problem Setting
I have defined the following functions.
...
14
votes
1
answer
342
views
How to have the units for energy show as kW h instead of h kW?
I observe the following in Wolfram Language:
Quantity[ 1, "Kilowatt hours" ] (* or "Kilowatts" * "Hours" *)
(* 1 h kW *)
That looks ...
4
votes
1
answer
197
views
Why do expressions with physical units not get simplified?
I am trying to calculate precise values for certain expressions, see the image below.
The output testZPF of the function $\Delta$Fn should be a single output. I am ...
1
vote
1
answer
27
views
Evaluating combinations of variables in a table, produces inconsistent results
I am trying to evaluate a combination of pairs of variables and then print them in a table, at the beginning it evaluates totally fine, but when reaching the last rows something strange happens
...
2
votes
0
answers
67
views
Why will a Log expression with Quantity expressions not get simplified? [closed]
I'm having trouble with numerically evaluating some functions. The problem essentially comes down to
...
6
votes
2
answers
209
views
`AccelerationOfFreeFall` has wrong units
Fixed in 13.0
On earth, the acceleration of free fall is around $9.81\,\text{m}/\text{s}^2$. In Mathematica,
...
0
votes
0
answers
29
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
...
3
votes
1
answer
110
views
How to use `Quantity` to convert Degrees of Latitude into Kilometers?
I want to convert 0.018 Degrees of Latitude into kilometers using the Quantity function in Mathematica. Unfortunately I do not know what Degrees of Latitude are ...
1
vote
1
answer
93
views
Currency Interpretation for VND
Bug introduced in v12.2.0 or earlier, persisting through v13.2.1. Case number: 4973722
As I was helping an OP with a question involving Vietnamese currency, I didn't realize at the time that the ...
0
votes
1
answer
57
views
Get Real Solutions works in Solve but PositiveReals don't (Quantities)
I'm trying to get the R+ Solutions to a school problem with solve. Everything works fine with Dom -> Reals but when I try ...
5
votes
1
answer
99
views
How to make Tooltip work with Quantity?
When I execute the code below:
Tooltip[Quantity[1, "Month"], "how to make it works?"]
The tooltip that is automatically generated by ...
0
votes
0
answers
70
views
Mathematica not performing simplifications with units with ScientificForm
I've run into a little problem, and I think in my research I've run into a dead end. I'm trying to perform some basic calculations with units, but Mathematica refuses to simplify the most basic ...
0
votes
0
answers
107
views
How to use the autocomplete for built-in function's argument for a user defined symbol?
Suppose I have myFunction as follows:
ClearAll[myFunction];
myFunction[unitName_,somethingElse_]:=...definition...;
I want to ...
0
votes
1
answer
397
views
How to convert a Quantity to a simple Integer or Float? [closed]
How can I convert a quantity, such as:
Quantity[3, "Euros"]
To the simple number that represents it, in that case 3 ?
...
3
votes
2
answers
543
views
How do I get a numerical value for a physical constant in Mathematica 12.1 [closed]
I've been working on some optics problems and regularly need to use constants like the charge of an electron, vacuum permittivity, etc. I'd like to be able to call these constants in Mathematica as ...
2
votes
0
answers
96
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'...
0
votes
1
answer
59
views
How can I create a PasteButton that changes its "contents" dynamically?
I'm trying to make a units palette to help with my various engineering courses. I thought about creating a "meta-palette" of sorts, maybe one that changes on the fly, or one where I can ...
1
vote
1
answer
62
views
UnitSimplify for unit multiples and submultiples
Is there any way to automatically rewrite units so that they display more naturally looking magnitudes? By this I mean that
...