为什么std::assoc_laguerre的第二个参数是unsigned int?
Why is the second parameter of std::assoc_laguerre an unsigned int?
在C++17中,标准库中加入了很多特殊函数。一个函数是 associated Laguerre polynomials. The second argument requires an unsigned int
, but the mathematical definition 也对实数有效。有什么理由说它只限于非负整数吗?仅仅是因为 binomial(n,k) 是 easier/faster/simpler 来计算 n 和 k 都是正整数的时候吗?
据我所知,C++ 特殊函数之父 Walter E. Brown 从未明确回答过您的拉盖尔问题。然而,当阅读 what Brown did write, 时,一个可能的动机变得清晰:
Many of the proposed Special Functions have definitions over some or all of the complex plane as well as over some or all of the real numbers. Further, some of these functions can produce complex results, even over real-valued arguments. The present proposal restricts itself by considering only real-valued arguments and (correspondingly) real-valued results.
Our investigation of the alternative led us to realize that the complex landscape for the Special Functions is figuratively dotted with land mines. In coming to our recommendation, we gave weight to the statement from a respected colleague that “Several Ph.D. dissertations would [or could] result from efforts to implement this set of functions over the complex domain.” This led us to take the position that there is insufficient prior art in this area to serve as a basis for standardization, and that such standardization would be therefore premature....
当然,你问的是实数而不是复数,所以我无法证明原因是一样的,但是Abramowitz和Stegun(Brown的提案主要基于其手册)为一些特殊功能提供了额外的支持整数阶的。奇怪的是,在我的 Abramowitz 和 Stegun 副本的第 13 章中,我没有看到任何额外的支持,所以你说得有道理,不是吗?也许 Brown 只是出于谨慎,不希望一下子将太多内容推入 C++ 标准库,但在我看来,没有任何明显的理由说明为什么在这种情况下不应该支持浮点参数。
并不是说我会猜测布朗。
您可能知道,您可能可以使用 Abramowitz 和 Stegun 的第 13 章来轻松获得您想要的效果。也许布朗自己会这样说:你可以毫不费力地得到你想要的效果。可以肯定的是,这需要问布朗本人。
有关信息,Brown 的提案(较早链接)明确将 C++ 的 assoc_laguerre
引用到 Abramowitz 和 Stegun,节。 13.6.9.
总而言之,在 C++ 首次获得特殊功能支持时,需要谨慎行事。图书馆不想推进得太远,太快。这个因素似乎很可能是造成您注意到的缺失的主要原因。
我知道一个事实,即人们非常关注实际和感知的可实施性。此外,必须证明新的库功能是合理的。功能必须对多个社区有用。整数阶 assoc_laguerre 是物理学家最常使用的类型。有符号整数或实数顺序可能被认为过于抽象。事实上,特殊的数学函数几乎没有进入 C++17。事实上,我认为他们加入的部分原因是人们认为 17 是一个轻量级的发行版,人们想要支持它。
众所周知,订单参数没有理由是无符号的,甚至是整数。我放在 libstdc++ ( gcc ) 中的底层实现有一个真正的顺序 alpha。例如,实阶 assoc_laguerre 在正交规则中很有用。
除了放宽要签名的无符号整数之外,我可能会建议委员会为真实订单重载。
在C++17中,标准库中加入了很多特殊函数。一个函数是 associated Laguerre polynomials. The second argument requires an unsigned int
, but the mathematical definition 也对实数有效。有什么理由说它只限于非负整数吗?仅仅是因为 binomial(n,k) 是 easier/faster/simpler 来计算 n 和 k 都是正整数的时候吗?
据我所知,C++ 特殊函数之父 Walter E. Brown 从未明确回答过您的拉盖尔问题。然而,当阅读 what Brown did write, 时,一个可能的动机变得清晰:
Many of the proposed Special Functions have definitions over some or all of the complex plane as well as over some or all of the real numbers. Further, some of these functions can produce complex results, even over real-valued arguments. The present proposal restricts itself by considering only real-valued arguments and (correspondingly) real-valued results.
Our investigation of the alternative led us to realize that the complex landscape for the Special Functions is figuratively dotted with land mines. In coming to our recommendation, we gave weight to the statement from a respected colleague that “Several Ph.D. dissertations would [or could] result from efforts to implement this set of functions over the complex domain.” This led us to take the position that there is insufficient prior art in this area to serve as a basis for standardization, and that such standardization would be therefore premature....
当然,你问的是实数而不是复数,所以我无法证明原因是一样的,但是Abramowitz和Stegun(Brown的提案主要基于其手册)为一些特殊功能提供了额外的支持整数阶的。奇怪的是,在我的 Abramowitz 和 Stegun 副本的第 13 章中,我没有看到任何额外的支持,所以你说得有道理,不是吗?也许 Brown 只是出于谨慎,不希望一下子将太多内容推入 C++ 标准库,但在我看来,没有任何明显的理由说明为什么在这种情况下不应该支持浮点参数。
并不是说我会猜测布朗。
您可能知道,您可能可以使用 Abramowitz 和 Stegun 的第 13 章来轻松获得您想要的效果。也许布朗自己会这样说:你可以毫不费力地得到你想要的效果。可以肯定的是,这需要问布朗本人。
有关信息,Brown 的提案(较早链接)明确将 C++ 的 assoc_laguerre
引用到 Abramowitz 和 Stegun,节。 13.6.9.
总而言之,在 C++ 首次获得特殊功能支持时,需要谨慎行事。图书馆不想推进得太远,太快。这个因素似乎很可能是造成您注意到的缺失的主要原因。
我知道一个事实,即人们非常关注实际和感知的可实施性。此外,必须证明新的库功能是合理的。功能必须对多个社区有用。整数阶 assoc_laguerre 是物理学家最常使用的类型。有符号整数或实数顺序可能被认为过于抽象。事实上,特殊的数学函数几乎没有进入 C++17。事实上,我认为他们加入的部分原因是人们认为 17 是一个轻量级的发行版,人们想要支持它。
众所周知,订单参数没有理由是无符号的,甚至是整数。我放在 libstdc++ ( gcc ) 中的底层实现有一个真正的顺序 alpha。例如,实阶 assoc_laguerre 在正交规则中很有用。
除了放宽要签名的无符号整数之外,我可能会建议委员会为真实订单重载。