How about:
"%**%" <- function(x, y)x^y
2%**%3
spencer graves ;-)
On 8/30/25 08:23, avi.e.gr...@gmail.com wrote:
Richard,
As noted, we have had a history of computer languages using a very small number
of symbols to do too many things. A few languages like APL sort of created new
symbols by overwriting. Some simply used functions rather than symbols. And, I
note languages like C used asterisk to mean very different things like
following a pointer in concise but not trivial code as in how to copy a null
terminated character string:
while (*p++ = *q++)
If you had a pointer to a pointer to a pointer to a pointer, you could see code
with many stars and often many parentheses.
As for your suggestion, I think you need to consider the people who have to
create a compiler or interpreter to handle the requirements. I am sure it is
doable in some ways but I suggest care. Many languages accept octal or
hexadecimal notation and thus a number like 2A is allowed but since this can
lead to ambiguous situations, often a x must be prepended as a sort of special
case. In such a language, you might not want to use x or X OR you may insist on
whitespace around it as compared to other operators that need nonw. And, need I
say that x is a very common variable name.
Back to R, it is what it is and if someone designs yet another new language in
x decades, who knows what they will come up with that may be hodgepodge of
features and ways from R and python and ... and will have so many features and
ways that no one person or group knows it all as it will include use of
thousands of symbols from something like UNICODE.
For now, if we use R, we have what we have and we will make mistakes. Anyone
here think there can be problems if someone creates read_csv() as their version
of read.csv() and some people use the wrong one, ...?
-----Original Message-----
From: R-help <r-help-boun...@r-project.org> On Behalf Of Richard O'Keefe
Sent: Saturday, August 30, 2025 3:09 AM
To: Leo Mada <leo.m...@syonic.eu>
Cc: Leo Mada via R-help <r-help@r-project.org>
Subject: Re: [R] The "**" exponentiation operator.
I did mathematics up to University level and finally petered out at
Category Theory, which I never got the hang of.
Here's the fun: I *never* saw the asterisk used for multiplication in
my mathematics or physics courses.
And I never saw any operator at all used for exponentiation.
Asterisk was a superscript operator for conjugation or duals. Had
nothing to do with products.
Fortran COBOL, and PL/I used. and still use, * for multiplication and
** for exponentiation.
APL used × for multiplication and * for exponentiation.
Could I recommend that R allow × as a synonym for * ? It has been the
mathematical sign for
multiplication for >400 years, when a sign is used, and it's been
available on computers for decades.
On Sat, 30 Aug 2025 at 03:05, Leo Mada via R-help <r-help@r-project.org> wrote:
Dear Rolf,
I join this discussion a little bit late.
Indeed, the '**' operator is a very poor choice for exponentiation. I can give
some examples to justify my claim. Notice that '**' and '*' would almost always
get mixed in real mathematics.
Fortunately, I am used to "^"; otherwise, I would have had a very hard time to
debug the *monster*:
https://github.com/discoleo/R/blob/master/Math/Poly.System.S5.Ht.Formulas.Derivation.Coeffs.R
Those are the coefficients of a polynomial of order 7 (see below for further
information). And I have plenty of examples.
Unfortunately, some "programming" languages mix '*' and '**'; which makes any
work with polynomials a nightmare!
I "found" something on this topic - hope everyone gets a little bit amused:
https://github.com/discoleo/R/blob/master/Math.NewTerminology.wiki
Sincerely,
Leonard
===========
Regarding the *Monster*:
It enables to solve a particular system with 5 variables with cyclic symmetry:
x1+x2+x3+x4+x5 = R1
# Note: this is NOT the full E2
x1*x2+x2*x3+x3*x4+x4*x5+x5*x1 = R2
E3 = R3
E4 = R4
E5 (= x1*x2*x3*x4*x5) = R5;
This system can be transformed into a system that can be solved using a
polynomial of lower order than the original system.
Unfortunately, I do not have a methemtical theory yet for the Ht5 System. I
worked it out the hard way; it is almost finished, but I did not have any more
time during the last 2 years.
For some (very) basic details, see:
https://github.com/discoleo/R/blob/master/Math/Poly.System.md
Again, I did not have time to write anything more thoroughly.
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.