vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
1.16k stars 138 forks source link

Encoding problem when opening a file #543

Closed lastpks closed 4 months ago

lastpks commented 4 months ago

Hi!

I have an encoding problem that is connected to opening a file with any extension (.txt, .sav or .res). First I do some calculations:

* Settings:
Off statistics;
Format mathematica;

* Definitions:
Symbols n, FF;
CFunctions vert, F;

Dimension n;
AutoDeclare Index  i, e, mu;
AutoDeclare CFunction Vertex;

Global expr = F(e6) * F(e7) * Vertex0(e6, e7, i8, i9) * Vertex1(i8, i9, e10, e11) * F(e10) * F(e11);

* Identification:
id Vertex?(mu1?, mu2?, mu3?, mu4?) = vert(mu1, mu2, mu3, mu4);
.sort

id vert(mu1?,mu2?, mu3?, mu4?) = (d_(mu1,mu2)*d_(mu3,mu4) + d_(mu1,mu3)*d_(mu2,mu4) + d_(mu1,mu4)*d_(mu2,mu3)) / 3;
.sort

id F(mu?)*F(mu?) = FF;
id FF = 1;
.sort

Print expr;
.store
save my_example.txt expr;
.end

After that I try to open my_example.txt and want to see smt like expr = ( 8/9 + 1/9*n) but I see smt else (see the screen at the end). I know that if I load the data from the my_example.txt to any other .frm file all will be okay. Is the problem connected with encoding? How is it possible to solve the problem?

Screenshot_20240628_181607

jodavies commented 4 months ago

Save creates binary format files that are readable only by FORM. For plaintext output there is the #write command. Something like:

#write <my_example.txt> "expr = (%E);", expr
lastpks commented 4 months ago

Thanks a million!