Closed vsht closed 6 years ago
Hi,
The bracket statement does not work for dollar expressions. If you use %e instead, at least for me it works. As in: S a,b,c; L F = (a+b+c)^10; B b; .sort
.end What goes wrong in your code is also that the preprocessor gets to do its thing before the ‘algebra’ run. Hence, the #write gets executed before your expression has passed the running and hence the bracketting.
Cheers
Jos
On 8 Feb 2018, at 07:31, Vladyslav Shtabovenko notifications@github.com wrote:
I would like to use brackets to simplify the output of FORM before passing it to other programs. However, it seems that the brackets do not survive a #write instruction, even if there is no intermediate sort inbetween. Consider for example
off statistics; S a,b,z,y; L exp = ay^2 + 3a + zb+ z^3b; .sort bracket a, b; print exp;
$a1 = exp;
write
"%$",$a1; .end the print statement produces
exp =
b * ( z + z^3 )
a * ( 3 + y^2 ); which is exactly what I want, but the content of my exp.frm is nevertheless
bz+bz^3+3a+ay^2 A naive workaround is to use a "fake" collect
off statistics; S a,b,z,y; CF head; L exp = ay^2 + 3a + zb+ z^3b; .sort bracket a, b; .sort collect head; .sort print exp;
$a1 = exp;
write
"%$",$a1; .end and remove head in a later step. However, this probably would not work for very large expressions and in general appears to be an ugly hack. I believe that I'm not the first person to encounter this complication, so I wonder what is the recommended workaround.
Cheers, Vladyslav
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/262, or mute the thread https://github.com/notifications/unsubscribe-auth/AFLxEibrvQW50SrSkIfOybiNmCF_AJbCks5tSpS5gaJpZM4R93Vk.
Perfect, many thanks!
I would like to use brackets to simplify the output of FORM before passing it to other programs. However, it seems that the brackets do not survive a
#write
instruction, even if there is no intermediatesort
inbetween. Consider for examplethe
print
statement produceswhich is exactly what I want, but the content of my
exp.frm
is neverthelessA naive workaround is to use a "fake" collect
and remove
head
in a later step. However, this probably would not work for very large expressions and in general appears to be an ugly hack. I believe that I'm not the first person to encounter this complication, so I wonder what is the recommended workaround.Cheers, Vladyslav