File: Runtime.texi

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (337 lines) | stat: -rw-r--r-- 10,669 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
@menu
* Introduction for Runtime Environment::  
* Interrupts::                  
* Functions and Variables for Runtime Environment::  
@end menu


@node Introduction for Runtime Environment, Interrupts, Runtime Environment, Runtime Environment
@section Introduction for Runtime Environment
@c THIS DISCUSSION OF maxima-init.mac REPLACES AN EARLIER WRITE-UP. !!!
@c HOWEVER IT SEEMS THAT THIS TEXT REALLY WANTS TO BE UNDER A DIFFERENT HEADING. !!!
@code{maxima-init.mac} is a file which is loaded automatically when Maxima starts.
You can use @code{maxima-init.mac} to customize your Maxima environment.
@code{maxima-init.mac}, if it exists, is typically placed in the
directory named by @code{maxima_userdir},
although it can be in any directory searched by the function @code{file_search}.

Here is an example @code{maxima-init.mac} file:

@example
setup_autoload ("specfun.mac", ultraspherical, assoc_legendre_p);
showtime:all;
@end example

In this example, @code{setup_autoload} tells Maxima to load the
specified file
(@code{specfun.mac}) if any of the functions (@code{ultraspherical},
@code{assoc_legendre_p}) are called but not yet defined.
Thus you needn't remember to load the file before calling the functions.

The statement @code{showtime: all} tells Maxima to set the @code{showtime} variable.
The @code{maxima-init.mac} file can contain any other assignments or
other Maxima statements.

@opencatbox
@category{Session management}
@closecatbox

@node Interrupts, Functions and Variables for Runtime Environment, Introduction for Runtime Environment, Runtime Environment
@section Interrupts

The user can stop a time-consuming computation with the
^C (control-C) character.
The default action is to stop the computation
and print another user prompt.
In this case, it is not possible to restart a stopped computation.

If the Lisp variable @code{*debugger-hook*} is set to @code{nil}, by executing

@example
:lisp (setq *debugger-hook* nil)
@end example

@noindent
then upon receiving ^C, Maxima will enter the Lisp debugger,
and the user may use the debugger to inspect the Lisp environment.
The stopped computation can be restarted by entering
@code{continue} in the Lisp debugger.
The means of returning to Maxima from the Lisp debugger
(other than running the computation to completion)
is different for each version of Lisp.

On Unix systems, the character ^Z (control-Z) causes Maxima
to stop altogether, and control is returned to the shell prompt.
The @code{fg} command causes Maxima
to resume from the point at which it was stopped.

@opencatbox
@category{Console interaction}
@closecatbox

@c end concepts Runtime Environment
@node Functions and Variables for Runtime Environment,  , Interrupts, Runtime Environment
@section Functions and Variables for Runtime Environment

@c NEEDS EXPANSION AND CLARIFICATION
@defvr {Declaration} feature
Maxima understands two distinct types of features,
system features and features which apply to mathematical expressions.
See also @code{status} for information about system features.
See also @code{features} and @code{featurep} for information about mathematical features.
@c PROPERTIES, DECLARATIONS FALL UNDER THIS HEADING AS WELL
@c OTHER STUFF ??

@code{feature} itself is not the name of a function or variable.

@end defvr

@c NEEDS CLARIFICATION, ESPECIALLY WRT THE EXTENT OF THE FEATURE SYSTEM
@c (I.E. WHAT KINDS OF THINGS ARE FEATURES ACCORDING TO featurep)
@deffn {Function} featurep (@var{a}, @var{f})
Attempts to determine whether the object @var{a} has the
feature @var{f} on the basis of the facts in the current database.  If so,
it returns @code{true}, else @code{false}.

Note that @code{featurep} returns @code{false} when neither @var{f}
nor the negation of @var{f} can be established.

@code{featurep} evaluates its argument.

See also @code{declare} and @code{features}.

@example
(%i1) declare (j, even)$
(%i2) featurep (j, integer);
(%o2)                           true
@end example

@opencatbox
@category{Predicate functions} @category{Declarations and inferences}
@closecatbox
@end deffn

@defvr {System variable} maxima_tempdir

@code{maxima_tempdir} names the directory in which Maxima creates some temporary files.
In particular, temporary files for plotting are created in @code{maxima_tempdir}.

The initial value of @code{maxima_tempdir} is the user's home directory,
if Maxima can locate it; otherwise Maxima makes a guess about a suitable directory.

@code{maxima_tempdir} may be assigned a string which names a directory.

@opencatbox
@category{Global variables}
@closecatbox

@end defvr

@defvr {System variable} maxima_userdir

@code{maxima_userdir} names a directory which Maxima searches to find Maxima and Lisp files.
(Maxima searches some other directories as well;
@code{file_search_maxima} and @code{file_search_lisp} are the complete lists.)

The initial value of @code{maxima_userdir} is a subdirectory of the user's home directory,
if Maxima can locate it; otherwise Maxima makes a guess about a suitable directory.

@code{maxima_userdir} may be assigned a string which names a directory.
However, assigning to @code{maxima_userdir} does not automatically change
@code{file_search_maxima} and @code{file_search_lisp};
those variables must be changed separately.

@opencatbox
@category{Global variables}
@closecatbox

@end defvr

@deffn {Function} room ()
@deffnx {Function} room (true)
@deffnx {Function} room (false)
Prints out a description of the state of storage and
stack management in Maxima. @code{room} calls the Lisp function of 
the same name.

@itemize @bullet
@item
@code{room ()} prints out a moderate description.
@item
@code{room (true)} prints out a verbose description.
@item
@code{room (false)} prints out a terse description.
@end itemize

@opencatbox
@category{Debugging}
@closecatbox
@end deffn

@c -----------------------------------------------------------------------------
@deffn {Function} sstatus (@var{keyword}, @var{item})
When @var{keyword} is the symbol @code{feature}, @var{item} is put on the list
of system features. After @code{sstatus (keyword, item)} is executed,
@code{status (feature, item)} returns @code{true}. If @var{keyword} is the
symbol @code{nofeature}, @var{item} is deleted from the list of system features.
This can be useful for package writers, to keep track of what features they have
loaded in.

See also @code{status}.

@opencatbox
@category{Programming}
@closecatbox
@end deffn

@c -----------------------------------------------------------------------------
@deffn {Function} status (@code{feature})
@deffnx {Function} status (@code{feature}, @var{item})
Returns information about the presence or absence of certain system-dependent 
features.

@itemize @bullet
@item
@code{status (feature)} returns a list of system features. These include Lisp 
version, operating system type, etc. The list may vary from one Lisp type to 
another.

@item 
@code{status (feature, item)} returns @code{true} if @var{item} is on the
list of items returned by @code{status (feature)} and @code{false} otherwise.
@code{status} quotes the argument @var{item}. The quote-quote operator 
@code{'@w{}'} defeats quotation. A feature whose name contains a special 
character, such as a hyphen, must be given as a string argument. For example,
@code{status (feature, "ansi-cl")}.
@end itemize

See also @code{sstatus}.

The variable @code{features} contains a list of features which apply to 
mathematical expressions. See @code{features} and @code{featurep} for more 
information.

@opencatbox
@category{Programming}
@closecatbox
@end deffn

@deffn {Function} time (%o1, %o2, %o3, ...)
Returns a list of the times, in seconds, taken to compute the output
lines @code{%o1}, @code{%o2}, @code{%o3}, .... The time returned is Maxima's estimate of
the internal computation time, not the elapsed time. @code{time} can only
be applied to output line variables; for any other variables, @code{time}
returns @code{unknown}.

Set @code{showtime: true} to make Maxima print out the computation time 
and elapsed time with each output line.

@opencatbox
@category{Debugging}
@closecatbox
@end deffn

@deffn {Function} timedate ()
Returns a string representing the current time and date.
The string has the format @code{HH:MM:SS Day, mm/dd/yyyy (GMT-n)},
where the fields are
hours, minutes, seconds, day of week, month, day of month, year, and hours different from GMT.

Example:

@c ===beg===
@c d: timedate ();
@c print ("timedate reports current time", d)$
@c ===end===
@example
(%i1) d: timedate ();
(%o1) 08:05:09 Wed, 11/02/2005 (GMT-7)
(%i2) print ("timedate reports current time", d)$
timedate reports current time 08:05:09 Wed, 11/02/2005 (GMT-7)
@end example

@opencatbox
@category{Time and date functions}
@closecatbox
@end deffn

@deffn {Function} absolute_real_time ()

Returns the number of seconds since midnight, January 1, 1900 UTC.
The return value is an integer.

See also @code{elapsed_real_time} and @code{elapsed_run_time}.

Example:

@c ===beg===
@c absolute_real_time ();
@c 1900 + absolute_real_time () / (365.25 * 24 * 3600);
@c ===end===
@example
(%i1) absolute_real_time ();
(%o1)                      3385045277
(%i2) 1900 + absolute_real_time () / (365.25 * 24 * 3600);
(%o2)                   2007.265612087104
@end example

@opencatbox
@category{Time and date functions}
@closecatbox
@end deffn

@deffn {Function} elapsed_real_time ()

Returns the number of seconds (including fractions of a second)
since Maxima was most recently started or restarted.
The return value is a floating-point number.

See also @code{absolute_real_time} and @code{elapsed_run_time}.

Example:

@c ===beg===
@c elapsed_real_time ();
@c expand ((a + b)^500)$
@c elapsed_real_time ();
@c ===end===
@example
(%i1) elapsed_real_time ();
(%o1)                       2.559324
(%i2) expand ((a + b)^500)$
(%i3) elapsed_real_time ();
(%o3)                       7.552087
@end example

@opencatbox
@category{Time and date functions}
@closecatbox
@end deffn

@deffn {Function} elapsed_run_time ()

Returns an estimate of the number of seconds (including fractions of a second)
which Maxima has spent in computations since Maxima was most recently started or restarted.
The return value is a floating-point number.

See also @code{absolute_real_time} and @code{elapsed_real_time}.

Example:

@c ===beg===
@c elapsed_run_time ();
@c expand ((a + b)^500)$
@c elapsed_run_time ();
@c ===end===
@example
(%i1) elapsed_run_time ();
(%o1)                         0.04
(%i2) expand ((a + b)^500)$
(%i3) elapsed_run_time ();
(%o3)                         1.26
@end example

@opencatbox
@category{Time and date functions}
@closecatbox
@end deffn