Re: Some questions: built-in operators and exponent markers
Astrea Drifter <[email protected]> Sat, 25 Jul 2026 13:09:36 -0600
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CADZFxcmw2eRNKiJ+QDFT8fsAD+t=upB95eNzRqG1X3ukjnkYFg@mail.gmail.com> |
--===============6024730702327107572==
Content-Type: multipart/alternative; boundary="000000000000694b1e0657745c61"
--000000000000694b1e0657745c61
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I've managed to confirm that the problem is in the edited src/nparse.lisp
and not in the edited src\float.lisp.
On Sat, Jul 25, 2026 at 1:04=E2=80=AFPM Astrea Drifter <astreadrifter@gmail=
.com>
wrote:
> An update:
> After some investigation, I've discovered it's not only the redefinition
> of the exclamation mark that makes factorial() and related functions
> unusable. The files I edited to replace the exponent markers have the sam=
e
> effect, and this time I have no idea what could be causing it. This effec=
t
> is less widespread (affects bigfloats only, I can use factorial() with
> integers and regular floats) but since I never do calculations with
> anything other than bigfloats the net effect is the same for me.
> The only changes I made to the files was to replace #\B with #\P, #\b wit=
h
> #\p (in src\nparse.lisp) and |b| with |p| (in src\float.lisp)
> I wonder what could be going wrong here?
> Astrea
>
> On Sat, Jul 25, 2026 at 12:19=E2=80=AFPM Astrea Drifter <astreadrifter@gm=
ail.com>
> 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 fil=
e
>>> 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 wit=
h
>>> (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:incor=
rect
>> 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:incor=
rect
>> 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:incor=
rect
>> 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:incor=
rect
>> 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 w=
ith
>> 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 usi=
ng
>> 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]=
om>
>> 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 fil=
e
>>> 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@gm=
ail.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
>>>>
>>>
--000000000000694b1e0657745c61
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I've managed to confirm that the problem is in the edi=
ted src/nparse.lisp and not in the edited src\float.lisp.</div><br><div cla=
ss=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_at=
tr">On Sat, Jul 25, 2026 at 1:04=E2=80=AFPM Astrea Drifter <<a href=3D"m=
ailto:[email protected]">[email protected]</a>> wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">An u=
pdate:<br>After some investigation, I've discovered it's not only t=
he redefinition of the exclamation mark that makes <font face=3D"monospace"=
>factorial()</font><font face=3D"arial, sans-serif">=C2=A0and related funct=
ions unusable. The files I edited to replace the exponent markers have the =
same effect, and this time I have no idea what could be causing it. This ef=
fect is less widespread (affects bigfloats=C2=A0only, I can use=C2=A0</font=
><font face=3D"monospace">factorial()</font><font face=3D"arial, sans-serif=
">=C2=A0with integers and regular floats) but since I never do calculations=
with anything other than bigfloats=C2=A0the net effect is the same for me.=
<br>The only changes I made to the files was to replace #\B with #\P, #\b w=
ith #\p (in src\nparse.lisp) and |b| with |p| (in src\float.lisp)<br>I wond=
er what could be=C2=A0going wrong here?<br>Astrea</font></div><br><div clas=
s=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Jul 25, 202=
6 at 12:19=E2=80=AFPM Astrea Drifter <<a href=3D"mailto:astreadrifter@gm=
ail.com" target=3D"_blank">[email protected]</a>> wrote:<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"><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
solid rgb(204,204,204);padding-left:1ex"><div class=3D"gmail_default" styl=
e=3D"font-family:arial,sans-serif">The printing (and scanning?)=C2=A0 of bi=
gfloats is done by code in src/float.lisp</div><div 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 to</div><div class=3D"gmai=
l_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 substitute p for b in that list.=C2=
=A0 =C2=A0I don't know</div><div class=3D"gmail_default" style=3D"font-=
family:arial,sans-serif">if all the front ends use the same formatting prog=
ram.=C2=A0 I hope they do..</div><div class=3D"gmail_default" style=3D"font=
-family:arial,sans-serif">It is possible that some of this code was copied =
into displa.lisp.=C2=A0 I haven't checked.</div><div class=3D"gmail_def=
ault" 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 well as src/nparse.lisp it =
seems I've been able to replace the exponent markers without any troubl=
e!<br>Funnily enough I discovered an issue with my exclamation mark operato=
r, 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 rgb(204,204,204);padding-lef=
t:1ex"><div style=3D"color:rgb(0,0,0)"><font face=3D"arial, sans-serif">If =
you are open to an option to redefining "!", you might experiment=
with (or replace "~" with your favorite character)</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">(%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"a=
rial, sans-serif">(%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><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
=C2=A0<span style=3D"background-color:transparent">You might consider using=
an otherwise-undefined operator, such as "i".</span></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"><br></blockquote><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex">postfix ("i");</blockq=
uote><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">x i :=3D x * %i;</bl=
ockquote><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"><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">x i;</blockquote><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex">=C2=A0=3D> x*%i</blockquote><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote><blockquo=
te 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"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">=C2=A0=3D> 100*%i</blockquote><div><br>=
After I had removed "!" from the list of builtin operators, I los=
t the ability to call <font face=3D"monospace">factorial()</font><font face=
=3D"arial, sans-serif">=C2=A0as well as related functions like </font><font=
face=3D"monospace">erf()</font><font face=3D"arial, sans-serif">=C2=A0and =
</font><font face=3D"monospace">gamma()</font><font face=3D"arial, sans-ser=
if">, which I imagine is because all of these functions call on each other =
in various circumstances and because the (now undefined) exclamation=C2=A0m=
ark seems to be in the source code itself:<br><br></font><font face=3D"mono=
space">(%i5) infix("!");<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/numeric/bffac.mac:30:29:incorrect syntax: Illeg=
al 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("!&quo=
t;);<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) facto=
rial(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)!)<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 syntax: Illegal use of delimiter )<br>=C2=A0/bfl=
oat(%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) gamma(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 me think it must be defined in numeric/bffac.mac=
=C2=A0with the use of the exclamation mark. Perhaps then my "problem&q=
uot; 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 po=
int though, so using another character for my operator should work well eno=
ugh, at least for the time being.<br><br>Thanks again for all the help!<br>=
Astrea</font></div></div></div></div><br><div class=3D"gmail_quote"><div di=
r=3D"ltr" class=3D"gmail_attr">On Tue, Jul 21, 2026 at 7:01=E2=80=AFPM Rich=
ard Fateman <<a href=3D"mailto:[email protected]" target=3D"_blank">fate=
[email protected]</a>> wrote:<br></div><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"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default"=
style=3D"font-family:arial,sans-serif;font-size:small">The printing (and s=
canning?)=C2=A0 of bigfloats is done by code in src/float.lisp</div><div cl=
ass=3D"gmail_default" style=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:small">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_def=
ault" style=3D"font-family:arial,sans-serif;font-size:small">after it produ=
ces a list of characters you can substitute p for b in that list.=C2=A0 =C2=
=A0I don't know</div><div class=3D"gmail_default" style=3D"font-family:=
arial,sans-serif;font-size:small">if all the front ends use the same format=
ting program.=C2=A0 I hope they do..</div><div class=3D"gmail_default" styl=
e=3D"font-family:arial,sans-serif;font-size:small">It is possible that some=
of this code was copied into displa.lisp.=C2=A0 I haven't checked.</di=
v><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-s=
ize:small">RJF</div><div class=3D"gmail_default" style=3D"font-family:arial=
,sans-serif;font-size:small"><br></div><div class=3D"gmail_default" style=
=3D"font-family:arial,sans-serif;font-size:small"><br></div></div><br><div =
class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jul 21,=
2026 at 3:35=E2=80=AFPM Robert Dodier <<a href=3D"mailto:robert.dodier@=
gmail.com" target=3D"_blank">[email protected]</a>> wrote:<br></di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde=
r-left:1px solid rgb(204,204,204);padding-left:1ex">Glad to hear the bit ab=
out the "!" operator 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>
</blockquote></div>
</blockquote></div>
--000000000000694b1e0657745c61--
--===============6024730702327107572==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============6024730702327107572==
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
--===============6024730702327107572==--