MathGroup Archive 1998

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

Search the Archive

writing programs

  • To: mathgroup at
  • Subject: [mg13417] writing programs
  • From: john at (John M. Dlugosz)
  • Date: Thu, 23 Jul 1998 03:33:05 -0400
  • Abuse-reports-to: abuse at to report improper postings
  • Organization: at home
  • Sender: owner-wri-mathgroup at

How do you write programs in Mathematica?  I'm asking about the
mechanics  of preparing the files, not the language reference.

I looked at a simple .m file, and see that it's plain text as I would 
input it.  I wonder though why you don't need a ';' on the end of every
line to separate statements.  If it assumes one statement per line, how
do you split a statement accross multiple lines?  Here is an example:

=== begin example ===
Arg[z_] := -Pi/2 /; Re[z] == 0 && NonNegativeQ[-Im[z]]

Arg[z_] := ArcTan[Im[z]/Re[z]] /; Re[z] =!= 0 && Im[z] =!= 0


=== end example ===

My guess is that a blank line is used as a statement separator, and the 
terminating semi's that are present are in fact redundant.  But where
is  this in the documentation?  (assuming my guess is even correct)

Second, typing input text is fine for C++ or Perl, but won't let me get 
all the fancy stuff in Mathematica.  I'd rather use the notebook 

This package I'm looking at says I can rename the .nb file to .m and it 
will work, too.  But I wonder how?  If all the cells are executed in 
order when I load the "package", what happens to all the examples and 

Just what happens when I "load" such a renamed file as a package?


  • Prev by Date: Re: Space between different Cells
  • Next by Date: Re: The "Users" directory under NT
  • Previous by thread: Re: tag Times protected??
  • Next by thread: Re: writing programs