Using this equation, I’d like to create a function to calculate the velocity of the Solar Wind.

The equation has three inputs: mp (the mass of a photon), n (number of particles per cubic cm), and V (velocity in kilometers per second).

I’d like to use Unitful.jl to type the arguments. For example, I’m using the following to type Velocity:

V::typeof(1.0u"km/s")

The mass of photon is easy to represent, in fact there’s a Unitful constant for it.

What I can’t figure out is how to represent n, the number of particles per cm^3.

Unitful defines an “amount” dimension, 𝐍 (\bfN), but you don’t appear to be able to use it in units, so I can’t say 7u"𝐍/cm^3". There don’t appear to be any amount unit types other than moles, which doesn’t seem like the right choice.

I tried defining a new unit, but using the macros to do so in Pluto doesn’t work.

I’d prefer to type the variable with Unitful because, I think, you get conversions for free. So, for example, if the inputs were particles per cubic meter they’d automatically be converted.

@Mason - Ah, very interesting! I had tried to create a unit that way, but not in a module. Thank you!

@DNF - Very elegant and, I bet, what the authors had in mind. It seems to work. I’ll fiddle with it a bit more to confirm that there aren’t side effects. Love that your intuition took you right to the answer!