0
$\begingroup$

Many of the equations I deal with involve powers of quantities which contain units. However, when the exponent contains units (e.g., E^Quantity[3, "Joules"]), Mathematica will not evaluate it "fully." For example,

enter image description here

This stays unevaluated. On some level, it makes sense, but I'd like to be able to get a numerical value to this without having to remove the units beforehand. Is there any way to do this?

I would also totally be okay with a solution that allows it to evaluate without taking into account the units (i.e., by ignoring them). I'm just trying to avoid removing the units manually from each quantity.

$\endgroup$
5
  • $\begingroup$ what is R above? Better post plain text minimal Mathematica code that shows the problem that one can copy (ok to post images, but also need the code itself). May be you need to use QuantityMagnitude on these? $\endgroup$
    – Nasser
    Commented May 1, 2023 at 1:21
  • 1
    $\begingroup$ As Nasser suggested already, people here expect the code to be posted in a form that is easy to copy and paste. Please, edit your post and include the code in an appropriate format. Thanks and welcome to Mma.S.E. $\endgroup$
    – bmf
    Commented May 1, 2023 at 1:54
  • 4
    $\begingroup$ Arguments to exponential functions (probably all transcendental functions) should be dimensionless. E.g. $e^{1 \text{m}} \ne e^{100 \text{cm}}$. I don't think I'd trust a model that said I needed to compute E^Quantity[3, "Joules"]. Another example: $dy/dx = y$ implies $x$ is dimensionless and not Joules. $\endgroup$
    – Michael E2
    Commented May 1, 2023 at 2:24
  • 3
    $\begingroup$ To elaborate a bit on Michael E2's comment, the E^x can be expanded in a power series: 1 + x + x^2 +x^3 +... Each term has a different unit, and you can't add things having different units sensibly. If x were a length, the first term is a number, added to a length, added to an area, added to a volume etc. The sum makes no sense. So there seems to be a more basic problem with what you're doing and the exponents do indeed need to be dimensionless. $\endgroup$
    – user87932
    Commented May 1, 2023 at 2:25
  • $\begingroup$ Inhomogenous functions wrt. physical units are mathematical objects in the space of powers of the units, E.g (1 - 1 Volt) lives in (Real, Real* V), and its inverse (1- 1V)^-1 = sum V^n live in space of all V^n. In physics, expressions have a common momial of units. If a number and a unit are added, you can be absolutely sure, that the number has the same monomial of units. Except for Numerology. Planck succeded in numerology by introducing a fictional constant "h" of dimension time*energy in order to give e^(time * energy) the mathematical sense e^(time * energy / h). See tensor calculus. $\endgroup$
    – Roland F
    Commented May 1, 2023 at 8:22

1 Answer 1

0
$\begingroup$

I opine that you may be "shooting yourself in your own foot." But, that experience might help your education.

E^Quantity[3., "Joules"] /. Quantity[x_, _] :> x
E^Quantity[3., "Joules"] + E^Quantity[5., "Watts"] /. 
  Quantity[x_, _] :> x
20.085536923187668
168.49869602576427
$\endgroup$

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.