MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Math on Sun..Help!

  • To: mathgroup at christensen.cybernetics.net
  • Subject: Re: Math on Sun..Help!
  • From: Simon Chandler <simonc at hpcpbla.bri.hp.com>
  • Date: Fri, 21 Oct 1994 09:30:09 +0100

21/10/94

Mike,

You asked the MathGroup:

> The question is : How can I run a notebook in the background? and is it
> possible to put the plot in an output postscript file so that when I login
> later the plot would be easily accessible?
> Mike Amer

To answer the first question, here's an excerpt from the init.m file
that we use as standard in my lab (using an HP700 workstation, i.e.,
Unix). You won't need a lot of the information, but the last paragraph
deals with setting up a low priority kernel.

I'm certainly no expert at Unix, so if you've got any detailed
questions about what I say, then I probably won't be able to help. The
following does work for me though.

-===----====-==---==---=-----=-=-=--===--=-====-===--==--==-=-=-=--===

How to Automatically Execute "init.m" on Starting the Kernel
============================================================

This particular init.m notebook will be placed in the directory

   /usr/local/math/StartUp/

so, when the kernel is launched it will be executed by default.  It is 
possible to prevent the default init.m from being executed by using the 
-noinit option when launching the kernel and, if required, have another init.m 
run in its place by using the -run option. These options are now described in 
detail.

If the user makes a modification to this init.m file the 'tailored' version 
should be placed in the users home directory in a suitable location, e.g.,

   /users/usersname/math/StartUp/users_init.m

Note that the initialization file need not be called just init.m.  This 
initialization file may be executed automatically on starting the kernel by 
setting up the kernel to front-end link in the correct way. This is done via a 
dialog box under the menu item

   Action: Kernels and Tasks

Open this dialog and, with communication via MathLink to Local, turn on the 
Advanced Options option. The Arguments passed to MLOpen: line should be should 
be changed from the standard, 

-LinkMode Launch -LinkName "'math' -mathlink"

to

-LinkMode Launch -LinkName "'math' -run
Get['\"/users/username/math/StartUp/sjc_init.m\"'] -mathlink"

The other option (String passed to shell to launch kernel:) should be left as 
standard, i.e., blank.

Note that by default (standard) no -run option is given so that only the 
default init.m file is executed.  The -run option in the modified version 
causes the kernel to automatically run the file users_init.m once the kernel 
is fully operational, just as if the user typed had interactively typed the 
line 

Get["/users/usersname/math/StartUp/users_init.m"]      or equivalently

<< /users/usersname/math/StartUp/users_init.m

Note that the full pathname should be given, and that in the -run command 
line the full pathname needs to be surrounded by both single quotes (single on 
outside) and backslashed double quotes (\").  In addition, to prevent the 
default init.m from being run just before the users users_init.m file, the 
option -noinit should be added, like so

-LinkMode Launch -LinkName "'math' -noinit -run 
Get['\"/users/username/math/StartUp/sjc_init.m\"'] -mathlink"

In each case above, the Unix-like commands are entered into the dialog box as 
single lines (i.e., no returns or linefeeds).

Final point: I think it is possible to make the kernel start with low 
priority. Try setting the startup line to

-LinkMode Launch -LinkName "nice -19 'math' -noinit -run 
Get['\"/users/username/math/StartUp/sjc_init.m\"'] -mathlink"

-===----====-==---==---=-----=-=-=--===--=-====-===--==--==-=-=-=--===

As to your second question, have a look at the standard Display function.
This allows you to write the PostScript form of a graphic to a file. i.e.,

myPlot = Plot[Sin[x],{x,0,10}];
Display["/users/simonc/tmp/myPlot.mps", myPlot];

will produce a PostScript file "myPlot.mps"

This file will need an extra header of PostScript code before it can
be understood by other PostScript devices. To do this use the "psfix"
program distributed with Mathematica for Unix systems.

/usr/local/math/usrbin/psfix myPlot.mps > myPlot.ps

You can then dump "myPlot.ps" to a PostScript printer for hardcopy, or
open it in ghostscript (for example) to view it.

Alternatively, if you have a NoteBook front end, then just open the
myPlot.mps file and change the resulting cell's style to Graphics; the
graph will then be displayed.

My question to the MathGroup is: how can you write Mathematica _code_ to
open the PostScript file and display it to screen?

Hope that helps you Mike,

Simon

-----=----==---=-=--====-=---===--=--=-==-===-==--==-=-=-======--=-==--=

 Dr Simon Chandler
 Hewlett-Packard Ltd			Tel:   0272 228109
 Computer Peripherals Bristol		Fax:   0272 236091
 Filton Road, Stoke Gifford
 Bristol, BS12 6QZ	  		email: simonc at bri.hp.com
 United Kingdom

---==----=-=---====--=---=-==--===-=-=--=====-=----===---=--=--==-==-=-=







  • Prev by Date: PowerExpand etc.
  • Next by Date: [no subject]
  • Previous by thread: Re: Math on Sun..Help!
  • Next by thread: function definition