Ilya Zakharevich on Wed, 13 Dec 2023 03:37:01 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: The GP command “?” |
On Sat, Dec 09, 2023 at 07:49:50PM -0800, Ilya Zakharevich wrote: > The GP calculator accepts input in the PARI language, as well as > special commands starting with \ or with ? or with #. The PARI > language has unary and binary operators (among them + - * / % << >> > && || < > == <= >=) “with the usual meaning” (and the assignment > flavors such as +=) and other operators (inspect the output of ?19 > or ?_\_ or ?_! or ?_===_ etc. for details). The command separator > is “;”. > > Thousands of available functions are split into “topics” (inspect > them via the list emitted by the command ?sections). User-defined > functions (listed by ?0) are stored in variables (like f below) and > are defined as: > f(mandatory_arg, optional_arg=default) = N++; mandatory_arg+optional_arg > or equivalently (omit parentheses if this terminates a command): > (f = (mandatory_arg, optional_arg=default) -> N++; mandatory_arg+optional_arg) > Flow control is via functions if(), while() etc. (inspect ?if > etc. — and output of ?1). Another important thing which should better be mentioned is variables vs. “ring generators” (is there a proper PARI's nomenclature?). Like “Free variables” for polynomials/series/rational functions etc. are denoted as 'z etc. As a shortcut, this is the default value of the corresponding unassigned global variables (so they behave as if after z='z). Should not there be a warning about variables? Warning: polynomials in several variables are treacherous (see ????polynomials). "????" since I do not know where to refer the reader to… Yours, Ilya