How to save output of commands like Solve

Hello,

I have a notebook which at the end produces an output of ‘Solve’ command. Now this output is huge and takes enormous time to be
calculated. Thus I need to save this output in a file for subsequent uses without running the whole notebook again and again. May I
ask you for a recommendation. Just be aware, that since this is not a definition, I can not use ‘Dumpsave’ or ‘Put’.

Thanks.

A semicolon (:wink: after a command will perform the operation and store the result without showing the output.

Dear Mr. Blinder

I believe I did not make myself clear. What I intend to do is to save the output of Solve in a file, so that I could read it from the file instead of running the ‘Solve’ command again. I believe I am correct if I say after the kernel is shut down, all the data is lost, SO a simple semicolon would not do any good! Semicolon is a totally different command, as you have put it correctly.

Thanks.

Maybe this is what you are looking for, take a look at this command and see if you can adapt it.

PutAppend (>>>)

Paul.

Dear Mr. Cleary,

Thanks for your response, but may had noticed, I noted that the ‘Put’ command is not a solution for this problem, since output of ‘Solve’ is not a symbol, nor a definition. It is a list which makes for this somehow. Hence this is not a solution.

Thanks.

solution = Solve[…];
Save[“solution.m”, solution];

Thanks Llian, but have you actually tried it before, for it does not work, and the error is:

“solution must be a symbol, a string, or a list of symbols and strings”

Could you please verify this?

Yes, I have tried it.

In[188]:= solution = Solve[x^2 == 1, x];
          Save["solution.m", solution];
          Clear[solution];
          Get["solution.m"]

Out[191]= {{x -> -1}, {x -> 1}}

You can try AppendTo[]

AppendTo[SaveSolution,Solution]

Each time you run your model, your final result will be save in SaveSolution in a list.