Re: How to generate ``nice'' algebra output from command-line mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg125947] Re: How to generate ``nice'' algebra output from command-line mathematica?
- From: A Retey <awnl at gmx-topmail.de>
- Date: Mon, 9 Apr 2012 05:32:13 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jlh0t3$t9d$1@smc.vnet.net> <jljpv4$crc$1@smc.vnet.net>
Hi,
>> Are there any tricks to generate a mathematica workbook or something
>> equivalent that I can read after my job is complete? If necessary, I
>> don't mind choosing some of the algebraic expressions and saving to a
>> binary file at the end rather than having the whole session stored. I
>
> It appears that I can use the command to dump all globally scoped variables:
> DumpSave["test_save.mx", "Global`"]
>
> and then load it up after execution with:
> << test_save.mx;
>
> Is this the best way to do it?
>
that really depends a lot on how you will use the result. You could save
your expressions to package files as well (see the documentation for
Save and Put), which would be somewhat more portable among different
computers and Mathematica-versions.
You could also directly write Mathematica notebooks containing formatted
expressions from the kernel, e.g. like this:
expr=a^2+b^2;
Put[
Notebook[{Cell[BoxData[ToBoxes[expr]],"Output"]}],
ToFileName[{$HomeDirectory},"result.nb"]
]
It's not too difficult to create more fancy notebooks with sections and
multiple cells containing different expressions. See
tutorial/NotebooksAsMathematicaExpressions if you think this approach is
what you need. Honestly, I think saving the expressions to .mx or
package files will be more useful for most use cases, since it's easier
to load them for any post processing you might want to do with them.
hth,
albert