Re: Some questions: built-in operators and exponent markers
Astrea Drifter <[email protected]> Tue, 21 Jul 2026 11:33:21 -0600
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CADZFxcnMnF9kH5FiQtBr+quM7rrObkXF79mjxfDqVFXs66KbJQ@mail.gmail.com> |
--===============6945438727114872985==
Content-Type: multipart/alternative; boundary="0000000000007e74670657228c9a"
--0000000000007e74670657228c9a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Sorry for the late response, it's been a busy week!
To redefine the built-in operator "!", try this in your Maxima session:
>
> :lisp (remprop '$! 'mheader)
> :lisp (remprop '$! 'led)
>
> and then
>
> postfix ("!");
> x ! :=3D x * %i
I added the lisp commands into my maxima-init.lisp file and it works
perfectly! Thank you so much for this, it's exactly what I was hoping for
on the exclamation mark thing.
Probably, but you probably also want to type =E2=80=9C3.14p0=E2=80=9D and b=
e read it in
> correctly. That=E2=80=99s more work.
Yeah, on the bigfloat exponent marker thing, I was hoping to be able to
type in say 1p0+2p0; and get back either a 3.0p0 or a 3.0b0 (in the latter
case I could just write a function to stringify the output and do a
character substitution on it).
I don't think it's possible to change the exponent marker for
> bigfloats from b to p except for searching the source code (probably
> src/nparse.lisp but possibly elsewhere) for the place where bigfloats
> are parsed, and look for an instance of the characters #\B and #\b,
> and replace them with #\P and #\p. I haven't tried it.
> Maxima already as a compiler builtin, so put your changes in a file and d=
o
> something like:
:lisp (load "/path/new-code.lisp")
If I make an edited copy of src/nparse.lisp where I replace those
characters (or whatever file is responsible for parsing the bigfloats, if
nparse isn't it... I'll assume for now that if a file contains #\B and #\b
it's probably the one I'm looking for, but don't hesitate to enlighten me!)
and then if I include a command in my maxima-init.lisp to load the edited
file, might that work?
Thanks again,
Astrea
On Mon, Jul 13, 2026 at 9:39=E2=80=AFAM Robert Dodier <robert.dodier@gmail.=
com>
wrote:
> To redefine the built-in operator "!", try this in your Maxima session:
>
> :lisp (remprop '$! 'mheader)
> :lisp (remprop '$! 'led)
>
> and then
>
> postfix ("!");
> x ! :=3D x * %i;
>
> Then I get:
>
> x!;
> =3D> %i*x
>
> 100!;
> =3D> 100*%i
>
> etc.
>
> You might consider using an otherwise-undefined operator, such as "i".
>
> postfix ("i");
> x i :=3D x * %i;
>
> x i;
> =3D> x*%i
>
> 100;
> =3D> 100*%i
>
> I don't think it's possible to change the exponent marker for
> bigfloats from b to p except for searching the source code (probably
> src/nparse.lisp but possibly elsewhere) for the place where bigfloats
> are parsed, and look for an instance of the characters #\B and #\b,
> and replace them with #\P and #\p. I haven't tried it.
>
> Hope this helps,
>
> Robert
>
--0000000000007e74670657228c9a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Sorry for the late response, it's been a busy week!<br=
><br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">To redefine the buil=
t-in operator "!", try this in your Maxima session:<br><br>:lisp =
(remprop '$! 'mheader)<br>:lisp (remprop '$! 'led)<br><br>a=
nd then<br><br>postfix ("!");<br>x ! :=3D x * %i<span style=3D"ba=
ckground-color:transparent">=C2=A0</span></blockquote><br>I added the lisp =
commands into my maxima-init.lisp file and it works perfectly! Thank you so=
much for this, it's exactly what I was hoping for on the exclamation m=
ark thing.<br><br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px=
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Probabl=
y, but you probably also want to type =E2=80=9C3.14p0=E2=80=9D and be read =
it in correctly. That=E2=80=99s more work.</blockquote><div><br>Yeah, on th=
e bigfloat exponent marker thing, I was hoping to be able to type in say <f=
ont face=3D"monospace">1p0+2p0;</font><font face=3D"arial, sans-serif">=C2=
=A0and get back either a=C2=A0</font><font face=3D"monospace">3.0p0</font><=
font face=3D"arial, sans-serif">=C2=A0or a=C2=A0</font><font face=3D"monosp=
ace">3.0b0</font><font face=3D"arial, sans-serif">=C2=A0(in the latter case=
I could just write a function to stringify the output and do a character s=
ubstitution on it</font><font face=3D"arial, sans-serif">).</font></div><br=
><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border=
-left:1px solid rgb(204,204,204);padding-left:1ex">I don't think it'=
;s possible to change the exponent marker for<br>bigfloats from b to p exce=
pt for searching the source code (probably<br>src/nparse.lisp but possibly =
elsewhere) for the place where bigfloats<br>are parsed, and look for an ins=
tance of the characters #\B and #\b,<br>and replace them with #\P and #\p. =
I haven't tried it.</blockquote><div>=C2=A0</div><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204=
,204,204);padding-left:1ex"><span style=3D"background-color:transparent">Ma=
xima already as a compiler builtin, so put your changes in a file and do so=
mething like:</span></blockquote><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex"><font face=3D"arial, sans-serif" style=3D"background-color:rgb(255,=
255,255)"><span style=3D"white-space:pre-wrap">:lisp (load "/path/new-=
code.lisp")</span>=C2=A0</font></blockquote><div><br>If I make an edit=
ed copy of src/nparse.lisp=C2=A0where I replace those characters (or whatev=
er file is responsible for parsing the bigfloats, if nparse isn't it...=
I'll assume for now that if a file contains #\B and #\b it's proba=
bly the one I'm looking for, but don't hesitate to enlighten me!)=
=20
and then if I include a command in my maxima-init.lisp to load the edited =
file, might that work?<br><br>Thanks again,<br>Astrea</div><br></div><br><d=
iv class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gm=
ail_attr">On Mon, Jul 13, 2026 at 9:39=E2=80=AFAM Robert Dodier <<a href=
=3D"mailto:[email protected]">[email protected]</a>> wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">To redefine the =
built-in operator "!", try this in your Maxima session:<br>
<br>
:lisp (remprop '$! 'mheader)<br>
:lisp (remprop '$! 'led)<br>
<br>
and then<br>
<br>
postfix ("!");<br>
x ! :=3D x * %i;<br>
<br>
Then I get:<br>
<br>
x!;<br>
=C2=A0=3D> %i*x<br>
<br>
100!;<br>
=C2=A0=3D> 100*%i<br>
<br>
etc.<br>
<br>
You might consider using an otherwise-undefined operator, such as "i&q=
uot;.<br>
<br>
postfix ("i");<br>
x i :=3D x * %i;<br>
<br>
x i;<br>
=C2=A0=3D> x*%i<br>
<br>
100;<br>
=C2=A0=3D> 100*%i<br>
<br>
I don't think it's possible to change the exponent marker for<br>
bigfloats from b to p except for searching the source code (probably<br>
src/nparse.lisp but possibly elsewhere) for the place where bigfloats<br>
are parsed, and look for an instance of the characters #\B and #\b,<br>
and replace them with #\P and #\p. I haven't tried it.<br>
<br>
Hope this helps,<br>
<br>
Robert<br>
</blockquote></div>
--0000000000007e74670657228c9a--
--===============6945438727114872985==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============6945438727114872985==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
--===============6945438727114872985==--