Introduce 'nullCombination' and 'affineCombination' - #3935
Conversation
|
We need to discuss this at the next meeting. An alternative, which I believe MapleSoft had implemented at least for affine combination, would be to support this without any new functions. E.g., stating that Thus, one question is how users view having a new special function Another is how complicated it is to detect such special cases for tools. Note that finding those special cases is important even if we introduce In many (almost all?) cases the affine combination will be a convex combination; should that be noted? For media there are a number convex combinations where we for species concentrations have two different formulations, either Looking at However, Media also have more normal cases like:
Extra: Note that we be should be that using |
Driven by #3748, this PR introduces two new built-in functions which we are quite far from being possible to express as user-defined functions. By having these in the language, the discussion about how to infer
absoluteValuecan avoid getting stuck on the issues that these two functions solve cleanly.The concepts captured by these functions are well established in mathematics, and represented in several other software environments where the distinction between absolute and relative quantities is of importance. Adding them to the language as a preparation for #3748 is similar to how we have recently added language features to prepare for good unit checking rules, such as semantics for raising to an integer power, rational exponents of units, the
nthRoot, and unitful literals.The examples demonstrate how the functions can be used with (non-coherent) absolute Celsius temperatures, but in principle they are equally important when working with absolute quantities of any unit, coherent or not.
When combined with future unit semantics, these functions will provide a powerful combination of features I didn't see in any of the other softwares in my survey:
Possible extension: homothety
The PR currently does not include a related operation in the same family, namely homothety, which could be defined as a syntactic sugar:
The form of an operator where the center of the transformation is required to be given as a named argument would clarify intent when expressing things like "today the temperature is twice as warm as yesterday":
(I refuse to use the ridiculously named
Constants.T_zero; theT_iceis just an alternative name which makes the expression above look more meaningful.)In case the name
homothetywould be rejected because it sounds too similar tohomotopy, alternative name candidates includedilationandscale. With these less specific names, it could be argued that the operator should also allow scaling a relative quantity, and then the presence ofcenterwould mark the difference between operating on relative or absolute quantities.