next up previous contents index
Next: 3 Structure and Syntax of Up: 2 The Basics of IFEFFIT Previous: 2.2 A Sample Run


2.3 The show() and print() Commands

Two important commands were left out of the above example that will greatly help you learning about and interacting with IFEFFIT. These are the show() and print() commands, which will write out information about Program Variables, including their values. The show() command takes a simple list of program variables, like this:

 Ifeffit>  show e0, kmin, $title1, cu.chi
and will print something like
 
 e0            =  8982.315 
 kmin          =  2.000000
 $title1       = Test: writing out  k, chi, chi*k
 cu.chi        = 302 pts [ -0.3232080 : 1.233829 ]
show() doesn't print out entire arrays but gives just enough information (the number of points, and the minimum and maximum value) to convince you that an array exists. The show() command can also be used to show all current scalars, arrays, and strings. You can read more about the show() command in section 9.41.

Whereas the show() command will only report about existing variables, and will not do any processing, the print() command is a bit more literal, printing out the values of variables or expressions. That is, print(e0) will just print the numerical value of e0 to the screen:

 Ifeffit>  print e0
      8982.315
 Ifeffit>  print "sqrt(25) + 1.001"
       6.00100
Note that in the last example, the math expression was enclosed in double quotes. This (or equivalently, enclosing braces ``{}'') tells IFEFFIT to evaluate the expression, instead of printing it literally, and tells IFEFFIT where the expression ends. Using single quotes would print the expression literally:
 Ifeffit>  print 'sqrt(25) + 1.001 = ', "sqrt(25) + 1.001"
   sqrt(25) + 1.001 =  6.00100
You can also print() out several expressions at once:
 Ifeffit>  print "sqrt(25) + 1.001", "pi / 2"
       6.001000      1.570796
Using print() for arrays (or an expression that gives an array) will print all the values of the arrays:
 Ifeffit>  print indarr(4)/5
     0.2000000     0.4000000     0.6000000     0.8000000

Section 3.7 gives a more complete description of all the ways of getting information back from IFEFFIT. We'll come back to show() and print() in section 3.8, where the ability to change where these outputs are printed will be discussed.

At this point, you may find it useful to go through the example session mixing in show() or print() commands and plotting some of the other arrays. That should give you enough of a feel for IFEFFIT to be able to use it for simple data processing and allow you to use the rest of this document as a reference guide.


next up previous contents index
Next: 3 Structure and Syntax of Up: 2 The Basics of IFEFFIT Previous: 2.2 A Sample Run
Matt Newville
2004-02-09