Re: Some questions: built-in operators and exponent markers
Astrea Drifter <[email protected]> Sat, 25 Jul 2026 12:19:28 -0600
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CADZFxcnCp1NtSpnOnWku=obAK4E_4u8J4ybPXzYrtB31fBFmnQ@mail.gmail.com> |
--===============1002827652679075197==
Content-Type: multipart/alternative; boundary="0000000000002998a5065773a968"
--0000000000002998a5065773a968
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
>
> The printing (and scanning?) of bigfloats is done by code in
> src/float.lisp
> It is not likely that searching for #\b will do the job, since the file
> seems to
> have |b|, also. It may be possible to wrap up one program, fpformat so
> that
> after it produces a list of characters you can substitute p for b in that
> list. I don't know
> if all the front ends use the same formatting program. I hope they do..
> It is possible that some of this code was copied into displa.lisp. I
> haven't checked.
> RJF
>
I actually discovered src/float.lisp some weeks ago, while looking through
the files on my own, and after editing that as well as src/nparse.lisp it
seems I've been able to replace the exponent markers without any trouble!
Funnily enough I discovered an issue with my exclamation mark operator,
which earlier I thought was working perfectly, and it seemed interesting
enough to mention here:
If you are open to an option to redefining "!", you might experiment with
> (or replace "~" with your favorite character)
>
> (%i1) prefix("~")$
>
> (%i2) "~"(x) :=3D %i*x$
>
> (%i3) 5 + ~7;
> (%o3) 7 %i + 5
>
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
After I had removed "!" from the list of builtin operators, I lost the
ability to call factorial() as well as related functions like erf() and
gamma(), which I imagine is because all of these functions call on each
other in various circumstances and because the (now undefined)
exclamation mark seems to be in the source code itself:
(%i5) infix("!");
(%o5) !
(%i6) "!"(x):=3D x*%i;
(%o6) ("!"(x)) :=3D x %i
(%i7) factorial(1b0);
C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrec=
t
syntax: Illegal use of delimiter )
/bfloat(%pi*(s-1)!)
^
(%i8) prefix("!");
(%o8) !
(%i9) factorial(1b0);
C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrec=
t
syntax: Illegal use of delimiter )
/bfloat(%pi*(s-1)!)
^
(%i10) erf(1b0);
C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrec=
t
syntax: Illegal use of delimiter )
/bfloat(%pi*(s-1)!)
^
(%i11) gamma(1b0);
C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrec=
t
syntax: Illegal use of delimiter )
/bfloat(%pi*(s-1)!)
There's no definiton of factorial built in with Common Lisp as near as I
can tell, which makes me think it must be defined in numeric/bffac.mac with
the use of the exclamation mark. Perhaps then my "problem" here could be
fixed if I were familiar enough with Lisp to be able to mess around with
the file really confidently. I haven't reached that point though, so using
another character for my operator should work well enough, at least for the
time being.
Thanks again for all the help!
Astrea
On Tue, Jul 21, 2026 at 7:01=E2=80=AFPM Richard Fateman <[email protected]>=
wrote:
> The printing (and scanning?) of bigfloats is done by code in
> src/float.lisp
> It is not likely that searching for #\b will do the job, since the file
> seems to
> have |b|, also. It may be possible to wrap up one program, fpformat so
> that
> after it produces a list of characters you can substitute p for b in that
> list. I don't know
> if all the front ends use the same formatting program. I hope they do..
> It is possible that some of this code was copied into displa.lisp. I
> haven't checked.
> RJF
>
>
>
> On Tue, Jul 21, 2026 at 3:35=E2=80=AFPM Robert Dodier <robert.dodier@gmai=
l.com>
> wrote:
>
>> Glad to hear the bit about the "!" operator is working for you. About
>> changing the bigfloat parser, I looked at src/nparse.lisp and I
>> believe that is indeed the file which contains the bigfloat parser, so
>> that is the one to modify.
>>
>> I guess you would also want to make the corresponding changes for the
>> display code. Maxima has two display modes, one is called the 2-d
>> pretty printer and the other is the 1-d non-pretty-printer. The pretty
>> printer is in src/displa.lisp (note that's displa, not display) and
>> the non-pretty printer is in src/grind.liap. Again, you would search
>> for #\B and/or #\b and replace them with #\P or #\p.
>>
>> Hope this helps,
>>
>> Robert
>>
>>
>> _______________________________________________
>> Maxima-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>>
>
--0000000000002998a5065773a968
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div cla=
ss=3D"gmail_default" style=3D"font-family:arial,sans-serif">The printing (a=
nd scanning?)=C2=A0 of bigfloats is done by code in src/float.lisp</div><di=
v class=3D"gmail_default" style=3D"font-family:arial,sans-serif">It is not =
likely that searching for #\b=C2=A0 will do the job, since the file seems t=
o</div><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif">=
have |b|, also.=C2=A0 =C2=A0It may be possible to wrap up one program,=C2=
=A0 fpformat so that</div><div class=3D"gmail_default" style=3D"font-family=
:arial,sans-serif">after it produces a list of characters you can substitut=
e p for b in that list.=C2=A0 =C2=A0I don't know</div><div class=3D"gma=
il_default" style=3D"font-family:arial,sans-serif">if all the front ends us=
e the same formatting program.=C2=A0 I hope they do..</div><div class=3D"gm=
ail_default" style=3D"font-family:arial,sans-serif">It is possible that som=
e of this code was copied into displa.lisp.=C2=A0 I haven't checked.</d=
iv><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif">RJF<=
/div></blockquote><div><br>I actually discovered src/float.lisp some weeks =
ago, while looking through the files on my own, and after editing that as w=
ell as src/nparse.lisp it seems I've been able to replace the exponent =
markers without any trouble!<br>Funnily enough I discovered an issue with m=
y exclamation mark operator, which earlier I thought was working perfectly,=
and it seemed interesting enough to mention here:<br><br><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div style=3D"color:rgb(0,0,0)"><font face=
=3D"arial, sans-serif" style=3D"">If you are open to an option to redefinin=
g "!", you might experiment with (or replace "~" with y=
our favorite character)</font></div><div style=3D"color:rgb(0,0,0)"><font f=
ace=3D"arial, sans-serif"><br></font></div><div style=3D"color:rgb(0,0,0)">=
<font face=3D"arial, sans-serif">(%i1) prefix("~")$</font></div><=
div style=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif"><br></font>=
</div><div style=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif">(%i2=
) "~"(x) :=3D %i*x$</font></div><div style=3D"color:rgb(0,0,0)"><=
font face=3D"arial, sans-serif"><br></font></div><div style=3D"color:rgb(0,=
0,0)"><font face=3D"arial, sans-serif">(%i3) 5 + ~7;</font></div><div style=
=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif" style=3D"">(%o3) =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A07 %i + 5</font></div></blockquote><div><br><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">=C2=A0<span style=3D"backgroun=
d-color:transparent">You might consider using an otherwise-undefined operat=
or, such as "i".</span></blockquote><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex"><br></blockquote><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex">postfix ("i");</blockquote><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex">x i :=3D x * %i;</blockquote><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><br></blockquote><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex">x i;</blockquote><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex">=C2=A0=3D> x*%i</blockquote><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex"><br></blockquote><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">100;</blockquote><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x">=C2=A0=3D> 100*%i</blockquote><div><br>After I had removed "!&qu=
ot; from the list of builtin operators, I lost the ability to call <font fa=
ce=3D"monospace">factorial()</font><font face=3D"arial, sans-serif">=C2=A0a=
s well as related functions like </font><font face=3D"monospace">erf()</fon=
t><font face=3D"arial, sans-serif">=C2=A0and </font><font face=3D"monospace=
">gamma()</font><font face=3D"arial, sans-serif">, which I imagine is becau=
se all of these functions call on each other in various circumstances and b=
ecause the (now undefined) exclamation=C2=A0mark seems to be in the source =
code itself:<br><br></font><font face=3D"monospace">(%i5) infix("!&quo=
t;);<br>(%o5) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!<br>(%i6) "=
;!"(x):=3D x*%i;<br>(%o6) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("!"(x)) :=3D x %=
i<br>(%i7) factorial(1b0);<br>C:/maxima-5.49.0/share/maxima/5.49.0/share/nu=
meric/bffac.mac:30:29:incorrect syntax: Illegal use of delimiter )<br>=C2=
=A0/bfloat(%pi*(s-1)!)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 ^<br><br>(%i8) prefix("!");<br>(%o8) =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!<br>(%i9) factorial(1b0);<br>C:/maxima-5.49=
.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrect syntax: Ille=
gal use of delimiter )<br>=C2=A0/bfloat(%pi*(s-1)!)<br>=C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br><br>(%i10) erf(1b0);<br>C:/=
maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30:29:incorrect s=
yntax: Illegal use of delimiter )<br>=C2=A0/bfloat(%pi*(s-1)!)<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br><br>(%i11) gam=
ma(1b0);<br>C:/maxima-5.49.0/share/maxima/5.49.0/share/numeric/bffac.mac:30=
:29:incorrect syntax: Illegal use of delimiter )<br>=C2=A0/bfloat(%pi*(s-1)=
!)</font><font face=3D"arial, sans-serif"><br><br>There's no definiton =
of factorial built in with Common Lisp as near as I can tell, which makes m=
e think it must be defined in numeric/bffac.mac=C2=A0with the use of the ex=
clamation mark. Perhaps then my "problem" here could be fixed if =
I were familiar enough with Lisp to be able to mess around with the file re=
ally confidently. I haven't reached that point though, so using another=
character for my operator should work well enough, at least for the time b=
eing.<br><br>Thanks again for all the help!<br>Astrea</font></div></div></d=
iv></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"l=
tr" class=3D"gmail_attr">On Tue, Jul 21, 2026 at 7:01=E2=80=AFPM Richard Fa=
teman <<a href=3D"mailto:[email protected]">[email protected]</a>> wr=
ote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D=
"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:ar=
ial,sans-serif;font-size:small">The printing (and scanning?)=C2=A0 of bigfl=
oats is done by code in src/float.lisp</div><div class=3D"gmail_default" st=
yle=3D"font-family:arial,sans-serif;font-size:small">It is not likely that =
searching for #\b=C2=A0 will do the job, since the file seems to</div><div =
class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:sma=
ll">have |b|, also.=C2=A0 =C2=A0It may be possible to wrap up one program,=
=C2=A0 fpformat so that</div><div class=3D"gmail_default" style=3D"font-fam=
ily:arial,sans-serif;font-size:small">after it produces a list of character=
s you can substitute p for b in that list.=C2=A0 =C2=A0I don't know</di=
v><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-s=
ize:small">if all the front ends use the same formatting program.=C2=A0 I h=
ope they do..</div><div class=3D"gmail_default" style=3D"font-family:arial,=
sans-serif;font-size:small">It is possible that some of this code was copie=
d into displa.lisp.=C2=A0 I haven't checked.</div><div class=3D"gmail_d=
efault" style=3D"font-family:arial,sans-serif;font-size:small">RJF</div><di=
v class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:s=
mall"><br></div><div class=3D"gmail_default" style=3D"font-family:arial,san=
s-serif;font-size:small"><br></div></div><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr" class=3D"gmail_attr">On Tue, Jul 21, 2026 at 3:35=E2=80=AFPM =
Robert Dodier <<a href=3D"mailto:[email protected]" target=3D"_bla=
nk">[email protected]</a>> wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex">Glad to hear the bit about the "!" ope=
rator is working for you. About<br>
changing the bigfloat parser, I looked at src/nparse.lisp and I<br>
believe that is indeed the file which contains the bigfloat parser, so<br>
that is the one to modify.<br>
<br>
I guess you would also want to make the corresponding changes for the<br>
display code. Maxima has two display modes, one is called the 2-d<br>
pretty printer and the other is the 1-d non-pretty-printer. The pretty<br>
printer is in src/displa.lisp (note that's displa, not display) and<br>
the non-pretty printer is in src/grind.liap. Again, you would search<br>
for #\B and/or #\b and replace them with #\P or #\p.<br>
<br>
Hope this helps,<br>
<br>
Robert<br>
<br>
<br>
_______________________________________________<br>
Maxima-discuss mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">M=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/maxima-discuss" rel=
=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi=
nfo/maxima-discuss</a><br>
</blockquote></div></div>
</blockquote></div>
--0000000000002998a5065773a968--
--===============1002827652679075197==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============1002827652679075197==
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
--===============1002827652679075197==--