0
$\begingroup$

The problem is the following: I want to export a list of equations I have set up with Mathematica such that I am able to import it back to Mathematica and continue to work with it, i.e. as if I had just set the equations up and never exported/imported them. The equations are of the following form:

F[0,1,1,2][1,1]^3+F[0,0,0,1][2,3]*F[2,2,2,1]^2==F[3,4,1,1][0,0]*F[0,1,0,1][2,2]*F[1,1,2,3][3,2]

Here, the $F[0,1,1,2][1,1]$ etc. are the variables; this does not refer to any other list or something, it is just a naming scheme. Now I have a list of approximately 60.000 of these equations. I have tried several options of the Export/Import-function in Mathematica, but I always encounter the following problem:

After importing the equations again, Mathematica does not recognize the $F[0,1,1,2][1,1]$ as variables anymore, especially I am not able to let a replace pattern like $/.F[0,1,1,2][1,1]\rightarrow1$ act on the list.

Does anyone of you have a suggestion how to export/import a list of equations like this?

$\endgroup$
1
$\begingroup$
eq = F[0, 1, 1, 2][1, 1]^3 + F[0, 0, 0, 1][2, 3]*F[2, 2, 2, 1]^2 == 
   F[3, 4, 1, 1][0, 0]*F[0, 1, 0, 1][2, 2]*F[1, 1, 2, 3][3, 2];
Export["a.m", eq];
Import["a.m"]
$\endgroup$
  • $\begingroup$ Thank you very much! I didn't know there was such an elegant way to do this! $\endgroup$ – Ramona Wolf Apr 17 '18 at 9:55
  • $\begingroup$ You're welcome. $\endgroup$ – Henrik Schumacher Apr 17 '18 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.