[Numpy-discussion] numpy grant update

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Fri Oct 27 17:52:23 EDT 2017


Hi Peter,

When using units, if `a` is not angular (or dimensionless), I don't
see how one could write code in which your example wouldn't fail...
But I may be missing something, since for your example one would just
realize that cos(ka)+i sin(ka) = exp(ika), in which case the log is
just ika and one can the whole complexity...

All the best,

Marten

On Fri, Oct 27, 2017 at 3:24 PM, Peter Creasey
<p.e.creasey.00 at googlemail.com> wrote:
>> Date: Thu, 26 Oct 2017 17:27:33 -0400
>> From: Marten van Kerkwijk
>>
>> That sounds somewhat puzzling as units cannot really propagate without
>> them somehow telling how they would change! (e.g., the outcome of
>> sin(a) is possible only for angular units and then depends on that
>> unit). But in any case, the mailing list is probably not the best case
>> to discuss this - rather, I look forward to  -- and will most happily
>> give feedback on -- a NEP or other more detailed explanation!
>>
>
>
> So whilst it’s true that trigonometric functions only make sense for
> dimensionless quantities, you might still want to compute them for
> dimensional quantities for reasons of computational efficiency. Taking
> your example of sin(a) in a spectral density identity:
>
> log(cos(ka) + i sin(ka)) = k log(cos(a) + i sin(a))
>
> so if you are computing the LHS for many k and a single a (i.e k the
> wavenumber and ka dimensionless) then you might prefer the RHS, which
> actually uses sin(a).
>
> Peter
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list