[swift-evolution] TrigonometricFloatingPoint/MathFloatingPoint protocol?

Nicolas Fezans nicolas.fezans at gmail.com
Thu Aug 3 12:53:49 CDT 2017

I do agree and this even though I am a control scientist, i.e. one of those
who use the "mathematician" sine, cosine, exponential, etc. of matrices all
the time.
I personally find that specialists can be told to write expm(A) instead of
exp(A) when they really mean the matrix exponential. I would however not
try to explain to every "regular" developer that exp(A) is not what they
expect because mathematicians could define it differently for square

On Thu, Aug 3, 2017 at 6:57 PM, Taylor Swift <kelvin13ma at gmail.com> wrote:

> I don’t think we should be designing interfaces based off of what pure
> mathematicians write. Scientists aren’t the only people who use sin(x).
> It’s better to go with the “common sense” behavior than the esoteric
> academic notation. And for the record, I think Matrix.map(sin(_:)) is the
> best and most clear interface for elementwise sin.
> On Thu, Aug 3, 2017 at 7:00 AM, Stephen Canon via swift-evolution <
> swift-evolution at swift.org> wrote:
>> On Aug 2, 2017, at 6:37 PM, Nicolas Fezans via swift-evolution <
>> swift-evolution at swift.org> wrote:
>> I am of course not talking about a syntax sugar to call a sin or cos
>> function, but rather to manipulate other objects such as N-dimensional
>> matrices, defining maths functions that can take such matrices as argument
>> e.g. sin(A) with A as matrix produces a matrix of the same size where all
>> elements are the sinus values of the elements of A (sorry but things like
>> this calling map() with 'sin' looks quite ugly for scientists).
>> You’re on very shaky ground here. It is not at all obvious that sin(A)
>> should be the “elementwise” sine that you suggest, and not the matrix sine
>> (defined by plugging A into the power series for sine, which is globally
>> convergent). Depending on what branch of science/math you come from, one of
>> these is “obviously” the right answer, but I assure you that it’s very much
>> not obvious.
>> Yes, we want libraries to build this sort of thing to exist.
>> No, it’s not clear what the “right” way to expose some of these
>> operations in the language/library are.
>> It is better to be verbose but correct than to be terse and cause bugs.
>> – Steve
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170803/85f85fc7/attachment.html>

More information about the swift-evolution mailing list