Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9394 > unrolled thread
| Started by | Jesse Perla <jesseperla@gmail.com> |
|---|---|
| First post | 2012-04-04 08:31 +0000 |
| Last post | 2012-04-08 08:16 +0000 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
How to generate ``nice'' algebra output from command-line mathematica? Jesse Perla <jesseperla@gmail.com> - 2012-04-04 08:31 +0000
Re: How to generate ``nice'' algebra output from command-line mathematica? Jesse Perla <jesseperla@gmail.com> - 2012-04-05 09:51 +0000
Re: How to generate ``nice'' algebra output from command-line mathematica? A Retey <awnl@gmx-topmail.de> - 2012-04-09 09:32 +0000
Re: How to generate ``nice'' algebra output from command-line mathematica? David Bailey <dave@removedbailey.co.uk> - 2012-04-06 10:05 +0000
Re: How to generate ``nice'' algebra output from command-line mathematica? Jesse Perla <jesseperla@gmail.com> - 2012-04-07 09:55 +0000
Re: How to generate ``nice'' algebra output from command-line mathematica? David Bailey <dave@removedbailey.co.uk> - 2012-04-08 08:16 +0000
| From | Jesse Perla <jesseperla@gmail.com> |
|---|---|
| Date | 2012-04-04 08:31 +0000 |
| Subject | How to generate ``nice'' algebra output from command-line mathematica? |
| Message-ID | <jlh0t3$t9d$1@smc.vnet.net> |
I have a .m file that I am running mathematica on the command line (using a linux cluster, qsub, and piping the output to a file). The generated algebra gets extremely complicated. I would love to be able to see the output formatted in a familiar mathematica form (e.g. with the lambda symbol instead of \[Lambda], integrals, etc.). 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 don't need to resulting file to be an interactive workbook, so if there is some way to generate Latex or some static output, then I would be happy with that approach. Thanks, Jesse
[toc] | [next] | [standalone]
| From | Jesse Perla <jesseperla@gmail.com> |
|---|---|
| Date | 2012-04-05 09:51 +0000 |
| Message-ID | <jljpv4$crc$1@smc.vnet.net> |
| In reply to | #9394 |
On Wednesday, April 4, 2012 4:31:31 AM UTC-4, Jesse Perla wrote: > 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?
[toc] | [prev] | [next] | [standalone]
| From | A Retey <awnl@gmx-topmail.de> |
|---|---|
| Date | 2012-04-09 09:32 +0000 |
| Message-ID | <jluac0$ron$1@smc.vnet.net> |
| In reply to | #9429 |
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
[toc] | [prev] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2012-04-06 10:05 +0000 |
| Message-ID | <jlmf4s$mhf$1@smc.vnet.net> |
| In reply to | #9394 |
On 04/04/2012 09:31, Jesse Perla wrote: > I have a .m file that I am running mathematica on the command line > (using a linux cluster, qsub, and piping the output to a file). The > generated algebra gets extremely complicated. I would love to be able > to see the output formatted in a familiar mathematica form (e.g. with > the lambda symbol instead of \[Lambda], integrals, etc.). > > 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 > don't need to resulting file to be an interactive workbook, so if > there is some way to generate Latex or some static output, then I > would be happy with that approach. > > Thanks, > Jesse > It sounds as though you are not using the notebook interface - i.e. starting Math rather than Mathematica. This will open in a window, rather than at the Linux command line, but you will be surprised at how beautiful the output is! BTW, you can also open .m files in the notebook interface (also known as the FrontEnd) and they will edit and execute nicely. I assume you are using the latest Mathematica - 8.0 or maybe 7.0, if you are using anything less than 3.0, I'd definitely suggest that you upgrade! To answer your other question, I would not use DumpSave routinely to save your work. There are far better ways - such as notebooks (.nb suffix) that can store both input and output in a readable form. David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Jesse Perla <jesseperla@gmail.com> |
|---|---|
| Date | 2012-04-07 09:55 +0000 |
| Message-ID | <jlp2uk$12j$1@smc.vnet.net> |
| In reply to | #9480 |
On Friday, April 6, 2012 6:05:16 AM UTC-4, David Bailey wrote: > It sounds as though you are not using the notebook interface - i.e. > starting Math rather than Mathematica. I am in fact using: math < myfile.m Alas, I don't have any other options as this is running as a job on a cluster.
[toc] | [prev] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2012-04-08 08:16 +0000 |
| Message-ID | <jlrhgb$enj$1@smc.vnet.net> |
| In reply to | #9493 |
On 07/04/2012 10:55, Jesse Perla wrote: > On Friday, April 6, 2012 6:05:16 AM UTC-4, David Bailey wrote: >> It sounds as though you are not using the notebook interface - i.e. >> starting Math rather than Mathematica. > > I am in fact using: math< myfile.m > > Alas, I don't have any other options as this is running as a job on a cluster. > Assuming you have a Mathematica available locally to read the output, I'd use Save (not DumpSave, which produces a version-dependant format) to save the output and then read it locally. David Bailey http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web