• Aucun résultat trouvé

Maxima Manual Version 5.45.0

N/A
N/A
Protected

Academic year: 2022

Partager "Maxima Manual Version 5.45.0"

Copied!
1236
0
0

Texte intégral

(1)
(2)

Department of Energy in 1982; that version is now known as DOE Macsyma. A copy of DOE Macsyma was maintained by Professor William F. Schelter of the University of Texas from 1982 until his death in 2001. In 1998, Schelter obtained permission from the Department of Energy to release the DOE Macsyma source code under the GNU Public License, and in 2000 he initiated the Maxima project at SourceForge to maintain and develop DOE Macsyma, now called Maxima.

(3)

Short Contents

1 Introduction to Maxima

. . . .

1

2 Bug Detection and Reporting

. . . .

7

3 Help

. . . .

11

4 Command Line

. . . .

15

5 Data Types and Structures

. . . .

41

6 Expressions

. . . .

85

7 Operators

. . . .

111

8 Evaluation

. . . .

131

9 Simplification

. . . .

143

10 Mathematical Functions

. . . .

161

11 Maxima’s Database

. . . .

189

12 Plotting

. . . .

209

13 File Input and Output

. . . .

241

14 Polynomials

. . . .

257

15 Special Functions

. . . .

287

16 Elliptic Functions

. . . .

313

17 Limits

. . . .

319

18 Differentiation

. . . .

321

19 Integration

. . . .

335

20 Equations

. . . .

357

21 Differential Equations

. . . .

377

22 Numerical

. . . .

381

23 Matrices and Linear Algebra

. . . .

399

24 Affine

. . . .

425

25 itensor

. . . .

429

26 ctensor

. . . .

463

27 atensor

. . . .

491

28 Sums, Products, and Series

. . . .

495

29 Number Theory

. . . .

515

30 Symmetries

. . . .

537

31 Groups

. . . .

555

32 Runtime Environment

. . . .

557

33 Miscellaneous Options

. . . .

565

(4)

35 Sets

. . . .

585

36 Function Definition

. . . .

609

37 Program Flow

. . . .

641

38 Debugging

. . . .

657

39 alt-display

. . . .

665

40 asympa

. . . .

671

41 augmented lagrangian

. . . .

673

42 Bernstein

. . . .

675

43 bitwise

. . . .

677

44 bode

. . . .

681

45 celine

. . . .

685

46 clebsch gordan

. . . .

687

47 cobyla

. . . .

689

48 combinatorics

. . . .

693

49 contrib ode

. . . .

699

50 descriptive

. . . .

705

51 diag

. . . .

739

52 distrib

. . . .

745

53 draw

. . . .

779

54 drawdf

. . . .

897

55 dynamics

. . . .

901

56 engineering-format

. . . .

915

57 ezunits

. . . .

917

58 f90

. . . .

935

59 finance

. . . .

937

60 fractals

. . . .

943

61 ggf

. . . .

947

62 graphs

. . . .

949

63 grobner

. . . .

979

64 hompack

. . . .

987

65 impdiff

. . . .

991

66 interpol

. . . .

993

67 lapack

. . . .

1001

68 lbfgs

. . . .

1009

69 lindstedt

. . . .

1015

(5)

71 lsquares

. . . .

1031

72 minpack

. . . .

1041

73 makeOrders

. . . .

1043

74 mnewton

. . . .

1045

75 numericalio

. . . .

1047

76 odepack

. . . .

1053

77 operatingsystem

. . . .

1057

78 opsubst

. . . .

1059

79 orthopoly

. . . .

1061

80 pytranslate

. . . .

1073

81 ratpow

. . . .

1079

82 romberg

. . . .

1081

83 simplex

. . . .

1085

84 simplification

. . . .

1089

85 solve rec

. . . .

1099

86 stats

. . . .

1105

87 stirling

. . . .

1123

88 stringproc

. . . .

1125

89 to poly solve

. . . .

1149

90 unit

. . . .

1169

91 wrstcse

. . . .

1179

92 zeilberger

. . . .

1183

93 Error and warning messages

. . . .

1187

94 Command-line options

. . . .

1191

A Function and Variable Index

. . . .

1193

(6)
(7)

Table of Contents

1 Introduction to Maxima . . . . 1

2 Bug Detection and Reporting . . . . 7

2.1 Functions and Variables for Bug Detection and Reporting. . . 7

3 Help . . . . 11

3.1 Documentation. . . 11

3.2 Functions and Variables for Help. . . .11

4 Command Line . . . . 15

4.1 Introduction to Command Line. . . 15

4.2 Functions and Variables for Command Line. . . .15

4.3 Functions and Variables for Display. . . .25

5 Data Types and Structures . . . . 41

5.1 Numbers. . . 41

5.1.1 Introduction to Numbers. . . 41

5.1.2 Functions and Variables for Numbers. . . 41

5.2 Strings. . . 47

5.2.1 Introduction to Strings. . . 47

5.2.2 Functions and Variables for Strings. . . 47

5.3 Constants. . . 50

5.3.1 Functions and Variables for Constants. . . 50

5.4 Lists. . . 53

5.4.1 Introduction to Lists. . . .53

5.4.2 Functions and Variables for Lists. . . .53

5.4.3 Performance considerations for Lists. . . 70

5.5 Arrays. . . 72

5.5.1 Functions and Variables for Arrays. . . .72

5.6 Structures. . . .82

5.6.1 Introduction to Structures. . . 82

5.6.2 Functions and Variables for Structures. . . 82

6 Expressions . . . . 85

6.1 Introduction to Expressions. . . .85

6.2 Nouns and Verbs. . . 85

6.3 Identifiers. . . 86

6.4 Inequality. . . 87

6.5 Functions and Variables for Expressions. . . .87

(8)

7.1 Introduction to operators. . . .111

7.2 Arithmetic operators. . . 113

7.3 Relational operators. . . .117

7.4 Logical operators. . . .118

7.5 Operators for Equations. . . .119

7.6 Assignment operators. . . 121

7.7 User defined operators. . . .126

8 Evaluation . . . . 131

8.1 Functions and Variables for Evaluation. . . 131

9 Simplification . . . . 143

9.1 Introduction to Simplification. . . .143

9.2 Functions and Variables for Simplification. . . 145

10 Mathematical Functions . . . . 161

10.1 Functions for Numbers. . . .161

10.2 Functions for Complex Numbers. . . .166

10.3 Combinatorial Functions. . . 170

10.4 Root, Exponential and Logarithmic Functions. . . 173

10.5 Trigonometric Functions. . . .180

10.5.1 Introduction to Trigonometric. . . 180

10.5.2 Functions and Variables for Trigonometric. . . 180

10.6 Random Numbers. . . .187

11 Maxima’s Database . . . . 189

11.1 Introduction to Maxima’s Database. . . .189

11.2 Functions and Variables for Properties. . . .189

11.3 Functions and Variables for Facts. . . .198

11.4 Functions and Variables for Predicates. . . .205

12 Plotting . . . . 209

12.1 Introduction to Plotting. . . .209

12.2 Plotting Formats. . . .209

12.3 Functions and Variables for Plotting. . . .210

12.4 Plotting Options. . . 227

12.5 Gnuplot Options. . . 236

12.6 Gnuplot pipes Format Functions. . . 239

13 File Input and Output . . . . 241

13.1 Comments. . . 241

13.2 Files. . . .241

13.3 Functions and Variables for File Input and Output. . . .242

13.4 Functions and Variables for TeX Output. . . .249

13.5 Functions and Variables for Fortran Output. . . 254

(9)

14.1 Introduction to Polynomials. . . .257

14.2 Functions and Variables for Polynomials. . . .257

15 Special Functions . . . . 287

15.1 Introduction to Special Functions. . . .287

15.2 Bessel Functions. . . 287

15.3 Airy Functions. . . .290

15.4 Gamma and factorial Functions. . . 291

15.5 Exponential Integrals. . . .303

15.6 Error Function. . . .305

15.7 Struve Functions. . . 306

15.8 Hypergeometric Functions. . . .306

15.9 Parabolic Cylinder Functions. . . .307

15.10 Functions and Variables for Special Functions. . . 307

16 Elliptic Functions . . . . 313

16.1 Introduction to Elliptic Functions and Integrals. . . .313

16.2 Functions and Variables for Elliptic Functions. . . 314

16.3 Functions and Variables for Elliptic Integrals. . . 316

17 Limits . . . . 319

17.1 Functions and Variables for Limits. . . .319

18 Differentiation . . . . 321

18.1 Functions and Variables for Differentiation. . . .321

19 Integration . . . . 335

19.1 Introduction to Integration. . . .335

19.2 Functions and Variables for Integration. . . .335

19.3 Introduction to QUADPACK. . . .345

19.3.1 Overview. . . .346

19.4 Functions and Variables for QUADPACK. . . .347

20 Equations . . . . 357

20.1 Functions and Variables for Equations. . . .357

21 Differential Equations . . . . 377

21.1 Introduction to Differential Equations. . . 377

21.2 Functions and Variables for Differential Equations. . . 377

(10)

22.1 Introduction to fast Fourier transform. . . .381

22.2 Functions and Variables for fft. . . .381

22.3 Functions and Variables for FFTPACK5. . . .385

22.4 Functions for numerical solution of equations. . . 387

22.5 Introduction to numerical solution of differential equations. . .389

22.6 Functions for numerical solution of differential equations. . . . .390

23 Matrices and Linear Algebra . . . . 399

23.1 Introduction to Matrices and Linear Algebra. . . .399

23.1.1 Dot. . . 399

23.1.2 Matrices. . . 399

23.1.3 Vectors. . . .400

23.1.4 eigen. . . .400

23.2 Functions and Variables for Matrices and Linear Algebra. . . . .400

24 Affine . . . . 425

24.1 Introduction to Affine. . . .425

24.2 Functions and Variables for Affine. . . .425

25 itensor . . . . 429

25.1 Introduction to itensor. . . 429

25.1.1 New tensor notation. . . .430

25.1.2 Indicial tensor manipulation. . . .430

25.2 Functions and Variables for itensor. . . 433

25.2.1 Managing indexed objects. . . 433

25.2.2 Tensor symmetries. . . 442

25.2.3 Indicial tensor calculus. . . 444

25.2.4 Tensors in curved spaces. . . .448

25.2.5 Moving frames. . . 451

25.2.6 Torsion and nonmetricity. . . .454

25.2.7 Exterior algebra. . . .457

25.2.8 Exporting TeX expressions. . . 460

25.2.9 Interfacing with ctensor. . . 461

25.2.10 Reserved words. . . 462

26 ctensor . . . . 463

26.1 Introduction to ctensor. . . .463

26.2 Functions and Variables for ctensor. . . .465

26.2.1 Initialization and setup. . . .465

26.2.2 The tensors of curved space. . . .468

26.2.3 Taylor series expansion. . . 470

26.2.4 Frame fields. . . .473

26.2.5 Algebraic classification. . . 473

26.2.6 Torsion and nonmetricity. . . .476

26.2.7 Miscellaneous features. . . .477

(11)

26.2.9 Variables used byctensor. . . .485

26.2.10 Reserved names. . . .488

26.2.11 Changes. . . 488

27 atensor . . . . 491

27.1 Introduction to atensor. . . .491

27.2 Functions and Variables for atensor. . . .492

28 Sums, Products, and Series . . . . 495

28.1 Functions and Variables for Sums and Products. . . .495

28.2 Introduction to Series. . . 499

28.3 Functions and Variables for Series. . . .499

28.4 Introduction to Fourier series. . . .511

28.5 Functions and Variables for Fourier series. . . .511

28.6 Functions and Variables for Poisson series. . . 512

29 Number Theory . . . . 515

29.1 Functions and Variables for Number Theory. . . .515

30 Symmetries . . . . 537

30.1 Introduction to Symmetries. . . 537

30.2 Functions and Variables for Symmetries. . . 537

30.2.1 Changing bases. . . .537

30.2.2 Changing representations. . . .541

30.2.3 Groups and orbits. . . .542

30.2.4 Partitions. . . .545

30.2.5 Polynomials and their roots. . . 546

30.2.6 Resolvents. . . .547

30.2.7 Miscellaneous. . . 553

31 Groups . . . . 555

31.1 Functions and Variables for Groups. . . .555

32 Runtime Environment . . . . 557

32.1 Introduction for Runtime Environment. . . 557

32.2 Interrupts. . . .557

32.3 Functions and Variables for Runtime Environment. . . .557

33 Miscellaneous Options . . . . 565

33.1 Introduction to Miscellaneous Options. . . .565

33.2 Share. . . 565

33.3 Functions and Variables for Miscellaneous Options. . . .565

(12)

34.1 Introduction to Rules and Patterns. . . .569

34.2 Functions and Variables for Rules and Patterns. . . .569

35 Sets . . . . 585

35.1 Introduction to Sets. . . .585

35.1.1 Usage. . . .585

35.1.2 Set Member Iteration. . . .587

35.1.3 Authors. . . .588

35.2 Functions and Variables for Sets. . . .588

36 Function Definition . . . . 609

36.1 Introduction to Function Definition. . . .609

36.2 Function. . . 609

36.2.1 Ordinary functions. . . 609

36.2.2 Memoizing Functions. . . .610

36.3 Macros. . . .611

36.4 Functions and Variables for Function Definition. . . .615

37 Program Flow . . . . 641

37.1 Lisp and Maxima. . . 641

37.2 Garbage Collection. . . .642

37.3 Introduction to Program Flow. . . .642

37.4 Functions and Variables for Program Flow. . . .643

38 Debugging . . . . 657

38.1 Source Level Debugging. . . 657

38.2 Keyword Commands. . . 658

38.3 Functions and Variables for Debugging. . . 659

39 alt-display . . . . 665

39.1 Introduction to alt-display. . . .665

39.2 Functions and Variables for alt-display. . . .666

40 asympa . . . . 671

40.1 Introduction to asympa. . . 671

40.2 Functions and variables for asympa. . . .671

41 augmented lagrangian . . . . 673

41.1 Functions and Variables for augmented lagrangian. . . .673

42 Bernstein . . . . 675

42.1 Functions and Variables for Bernstein. . . 675

(13)

43.1 Functions and Variables for bitwise. . . 677

44 bode . . . . 681

44.1 Functions and Variables for bode. . . .681

45 celine . . . . 685

45.1 Introduction to celine. . . 685

46 clebsch gordan . . . . 687

46.1 Functions and Variables for clebsch gordan. . . 687

47 cobyla . . . . 689

47.1 Introduction to cobyla. . . .689

47.2 Functions and Variables for cobyla. . . .689

47.3 Examples for cobyla. . . .691

48 combinatorics . . . . 693

48.1 Package combinatorics. . . .693

48.2 Functions and Variables for Combinatorics. . . .693

49 contrib ode . . . . 699

49.1 Introduction to contrib ode. . . .699

49.2 Functions and Variables for contrib ode. . . 701

49.3 Possible improvements to contrib ode. . . .703

49.4 Test cases for contrib ode. . . 704

49.5 References for contrib ode. . . .704

50 descriptive . . . . 705

50.1 Introduction to descriptive. . . 705

50.2 Functions and Variables for data manipulation. . . .707

50.3 Functions and Variables for descriptive statistics. . . .713

50.4 Functions and Variables for statistical graphs. . . .728

51 diag . . . . 739

51.1 Functions and Variables for diag. . . .739

52 distrib . . . . 745

52.1 Introduction to distrib. . . 745

52.2 Functions and Variables for continuous distributions. . . .747

52.3 Functions and Variables for discrete distributions. . . .767

(14)

53.1 Introduction to draw. . . 779

53.2 Functions and Variables for draw. . . .780

53.2.1 Scenes. . . 780

53.2.2 Functions. . . 781

53.2.3 Plot options for draw programs. . . .785

53.2.4 Graphics objects. . . 854

53.3 Functions and Variables for pictures. . . .884

53.4 Functions and Variables for worldmap. . . .886

53.4.1 Variables and Functions. . . 886

53.4.2 Graphic objects. . . 891

54 drawdf . . . . 897

54.1 Introduction to drawdf. . . .897

54.2 Functions and Variables for drawdf. . . 897

54.2.1 Functions. . . 897

55 dynamics . . . . 901

55.1 The dynamics package. . . .901

55.2 Graphical analysis of discrete dynamical systems. . . .901

55.3 Visualization with VTK. . . .906

55.3.1 Scene options. . . 908

55.3.2 Scene objects. . . .909

55.3.3 Scene object’s options. . . .910

56 engineering-format . . . . 915

56.1 Functions and Variables for engineering-format. . . 915

56.2 Known Bugs. . . 915

57 ezunits . . . . 917

57.1 Introduction to ezunits. . . .917

57.2 Introduction to physical constants. . . .918

57.3 Functions and Variables for ezunits. . . .920

58 f90 . . . . 935

58.1 Package f90. . . .935

59 finance . . . . 937

59.1 Introduction to finance. . . .937

59.2 Functions and Variables for finance. . . .937

(15)

60.1 Introduction to fractals. . . .943

60.2 Definitions for IFS fractals. . . 943

60.3 Definitions for complex fractals. . . .944

60.4 Definitions for Koch snowflakes. . . .945

60.5 Definitions for Peano maps. . . .945

61 ggf . . . . 947

61.1 Functions and Variables for ggf. . . .947

62 graphs . . . . 949

62.1 Introduction to graphs. . . 949

62.2 Functions and Variables for graphs. . . 949

62.2.1 Building graphs. . . 949

62.2.2 Graph properties. . . .955

62.2.3 Modifying graphs. . . .970

62.2.4 Reading and writing to files. . . 972

62.2.5 Visualization. . . .973

63 grobner . . . . 979

63.1 Introduction to grobner. . . 979

63.1.1 Notes on the grobner package. . . .979

63.1.2 Implementations of admissible monomial orders in grobner. .979

63.2 Functions and Variables for grobner. . . 980

63.2.1 Global switches for grobner. . . .980

63.2.2 Simple operators in grobner. . . 981

63.2.3 Other functions in grobner. . . .981

63.2.4 Standard postprocessing of Groebner Bases. . . .983

64 hompack . . . . 987

64.1 Introduction to hompack. . . 987

64.2 Functions and Variables for hompack. . . .987

65 impdiff . . . . 991

65.1 Functions and Variables for impdiff. . . .991

66 interpol . . . . 993

66.1 Introduction to interpol. . . 993

66.2 Functions and Variables for interpol. . . 993

67 lapack . . . . 1001

67.1 Introduction to lapack. . . .1001

67.2 Functions and Variables for lapack. . . 1001

(16)

68.1 Introduction to lbfgs. . . 1009

68.2 Functions and Variables for lbfgs. . . .1009

69 lindstedt . . . . 1015

69.1 Functions and Variables for lindstedt. . . .1015

70 linearalgebra . . . . 1017

70.1 Introduction to linearalgebra. . . 1017

70.2 Functions and Variables for linearalgebra. . . 1019

71 lsquares . . . . 1031

71.1 Introduction to lsquares. . . .1031

71.2 Functions and Variables for lsquares. . . .1031

72 minpack . . . . 1041

72.1 Introduction to minpack. . . .1041

72.2 Functions and Variables for minpack. . . 1041

73 makeOrders . . . . 1043

73.1 Functions and Variables for makeOrders. . . .1043

74 mnewton . . . . 1045

74.1 Introduction to mnewton. . . .1045

74.2 Functions and Variables for mnewton. . . .1045

75 numericalio . . . . 1047

75.1 Introduction to numericalio. . . 1047

75.1.1 Plain-text input and output. . . 1047

75.1.2 Separator flag values for input. . . .1047

75.1.3 Separator flag values for output. . . 1047

75.1.4 Binary floating-point input and output. . . 1048

75.2 Functions and Variables for plain-text input and output. . . . 1048

75.3 Functions and Variables for binary input and output. . . .1050

76 odepack . . . . 1053

76.1 Introduction to ODEPACK. . . 1053

76.1.1 Getting Started with ODEPACK. . . 1053

76.2 Functions and Variables for odepack. . . .1054

77 operatingsystem . . . . 1057

77.1 Introduction to operatingsystem. . . .1057

77.2 Directory operations. . . 1057

77.3 File operations. . . .1057

77.4 Environment operations. . . .1057

(17)

78.1 Functions and Variables for opsubst. . . 1059

79 orthopoly . . . . 1061

79.1 Introduction to orthogonal polynomials. . . .1061

79.1.1 Getting Started with orthopoly. . . .1061

79.1.2 Limitations. . . 1063

79.1.3 Floating point Evaluation. . . 1065

79.1.4 Graphics andorthopoly. . . 1066

79.1.5 Miscellaneous Functions. . . .1067

79.1.6 Algorithms. . . .1068

79.2 Functions and Variables for orthogonal polynomials. . . .1068

80 pytranslate . . . . 1073

80.1 Introduction to pytranslate. . . .1073

80.1.1 Tests for pytranslate. . . 1074

80.2 Functions in pytranslate. . . .1074

80.3 Extending pytranslate. . . .1075

81 ratpow . . . . 1079

81.1 Functions and Variables for ratpow. . . .1079

82 romberg . . . . 1081

82.1 Functions and Variables for romberg. . . .1081

83 simplex . . . . 1085

83.1 Introduction to simplex. . . 1085

83.1.1 Tests for simplex. . . .1085

83.1.1.1 klee minty. . . 1085

83.1.1.2 NETLIB. . . 1085

83.2 Functions and Variables for simplex. . . 1086

84 simplification . . . . 1089

84.1 Introduction to simplification. . . .1089

84.2 Package absimp. . . 1089

84.3 Package facexp. . . .1089

84.4 Package functs. . . .1091

84.5 Package ineq. . . .1094

84.6 Package rducon. . . 1096

84.7 Package scifac. . . .1096

85 solve rec . . . . 1099

85.1 Introduction to solve rec. . . 1099

85.2 Functions and Variables for solve rec. . . .1099

(18)

86.1 Introduction to stats. . . 1105

86.2 Functions and Variables for inference result. . . 1105

86.3 Functions and Variables for stats. . . .1107

86.4 Functions and Variables for special distributions. . . .1122

87 stirling . . . . 1123

87.1 Functions and Variables for stirling. . . .1123

88 stringproc . . . . 1125

88.1 Introduction to String Processing. . . .1125

88.2 Input and Output. . . .1126

88.3 Characters. . . .1132

88.4 String Processing. . . 1137

88.5 Octets and Utilities for Cryptography. . . 1143

89 to poly solve . . . . 1149

89.1 Functions and Variables for to poly solve. . . .1149

90 unit . . . . 1169

90.1 Introduction to Units. . . 1169

90.2 Functions and Variables for Units. . . 1170

91 wrstcse . . . . 1179

91.1 Introduction to wrstcse. . . .1179

91.2 Functions and Variables for wrstcse. . . .1179

92 zeilberger . . . . 1183

92.1 Introduction to zeilberger. . . 1183

92.1.1 The indefinite summation problem. . . .1183

92.1.2 The definite summation problem. . . 1183

92.1.3 Verbosity levels. . . 1183

92.2 Functions and Variables for zeilberger. . . 1184

92.3 General global variables. . . .1185

92.4 Variables related to the modular test. . . .1186

93 Error and warning messages . . . . 1187

93.1 Error messages. . . .1187

93.1.1 apply: no such"list"element. . . .1187

93.1.2 argument must be a non-atomic expression. . . 1187

93.1.3 assignment: cannot assign to <function name>. . . 1187

93.1.4 expt: undefined: 0 to a negative exponent.. . . .1187

93.1.5 incorrect syntax: , is not a prefix operator. . . 1187

93.1.6 incorrect syntax: Illegal use of delimiter ). . . .1187

93.1.7 loadfile: failed to load<filename>. . . .1188

(19)

93.1.9 Only symbols can be bound. . . 1188

93.1.10 operators of arguments must all be the same. . . .1188

93.1.11 Out of memory. . . 1188

93.1.12 part: fell off the end. . . .1189

93.1.13 undefined variable (draw or plot). . . .1189

93.1.14 VTK is not installed, which is required for Scene. . . 1189

93.2 Warning messages. . . .1189

93.2.1 Encountered undefined variable<x>in translation . . . 1190

93.2.2 Rat: replaced<x>by <y> = <z>. . . 1190

94 Command-line options . . . . 1191

94.1 Command line options. . . 1191

Appendix A Function and Variable Index . . . 1193

(20)
(21)

1 Introduction to Maxima

Start Maxima with the command "maxima". Maxima will display version information and a prompt. End each Maxima command with a semicolon. End the session with the command "quit();". Here’s a sample session:

[wfs@chromium]$ maxima

Maxima 5.9.1 http://maxima.sourceforge.net Using Lisp CMU Common Lisp 19a

Distributed under the GNU Public License. See the file COPYING.

Dedicated to the memory of William Schelter.

This is a development version of Maxima. The function bug_report() provides bug reporting information.

(%i1) factor(10!);

8 4 2

(%o1) 2 3 5 7

(%i2) expand ((x + y)^6);

6 5 2 4 3 3 4 2 5 6

(%o2) y + 6 x y + 15 x y + 20 x y + 15 x y + 6 x y + x (%i3) factor (x^6 - 1);

2 2

(%o3) (x - 1) (x + 1) (x - x + 1) (x + x + 1) (%i4) quit();

[wfs@chromium]$

Maxima can search the info pages. Use the describe command to show information about the command or all the commands and variables containing a string. The question mark ?(exact search) and double question mark?? (inexact search) are abbreviations for describe:

(%i1) ?? integ

0: Functions and Variables for Elliptic Integrals 1: Functions and Variables for Integration

2: Introduction to Elliptic Functions and Integrals 3: Introduction to Integration

4: askinteger (Functions and Variables for Simplification) 5: integerp (Functions and Variables for Miscellaneous Options) 6: integer_partitions (Functions and Variables for Sets)

7: integrate (Functions and Variables for Integration)

8: integrate_use_rootsof (Functions and Variables for Integration) 9: integration_constant_counter (Functions and Variables for

Integration)

10: nonnegintegerp (Functions and Variables for linearalgebra) Enter space-separated numbers, ‘all' or ‘none': 5 4

-- Function: integerp (<expr>)

Returns ‘true' if <expr> is a literal numeric integer, otherwise

‘false'.

(22)

‘integerp' returns false if its argument is a symbol, even if the argument is declared integer.

Examples:

(%i1) integerp (0);

(%o1) true

(%i2) integerp (1);

(%o2) true

(%i3) integerp (-17);

(%o3) true

(%i4) integerp (0.0);

(%o4) false

(%i5) integerp (1.0);

(%o5) false

(%i6) integerp (%pi);

(%o6) false

(%i7) integerp (n);

(%o7) false

(%i8) declare (n, integer);

(%o8) done

(%i9) integerp (n);

(%o9) false

-- Function: askinteger (<expr>, integer) -- Function: askinteger (<expr>)

-- Function: askinteger (<expr>, even) -- Function: askinteger (<expr>, odd)

‘askinteger (<expr>, integer)' attempts to determine from the

‘assume' database whether <expr> is an integer. ‘askinteger' prompts the user if it cannot tell otherwise, and attempt to install the information in the database if possible. ‘askinteger (<expr>)' is equivalent to ‘askinteger (<expr>, integer)'.

‘askinteger (<expr>, even)' and ‘askinteger (<expr>, odd)'

likewise attempt to determine if <expr> is an even integer or odd integer, respectively.

(%o1) true

To use a result in later calculations, you can assign it to a variable or refer to it by its automatically supplied label. In addition,%refers to the most recent calculated result:

(%i1) u: expand ((x + y)^6);

6 5 2 4 3 3 4 2 5 6

(%o1) y + 6 x y + 15 x y + 20 x y + 15 x y + 6 x y + x (%i2) diff (u, x);

5 4 2 3 3 2 4 5

(23)

(%o2) 6 y + 30 x y + 60 x y + 60 x y + 30 x y + 6 x (%i3) factor (%o2);

5

(%o3) 6 (y + x)

Maxima knows about complex numbers and numerical constants:

(%i1) cos(%pi);

(%o1) - 1

(%i2) exp(%i*%pi);

(%o2) - 1

Maxima can do differential and integral calculus:

(%i1) u: expand ((x + y)^6);

6 5 2 4 3 3 4 2 5 6

(%o1) y + 6 x y + 15 x y + 20 x y + 15 x y + 6 x y + x (%i2) diff (%, x);

5 4 2 3 3 2 4 5

(%o2) 6 y + 30 x y + 60 x y + 60 x y + 30 x y + 6 x (%i3) integrate (1/(1 + x^3), x);

2 x - 1

2 atan(---)

log(x - x + 1) sqrt(3) log(x + 1) (%o3) - --- + --- + ---

6 sqrt(3) 3

Maxima can solve linear systems and cubic equations:

(%i1) linsolve ([3*x + 4*y = 7, 2*x + a*y = 13], [x, y]);

7 a - 52 25

(%o1) [x = ---, y = ---]

3 a - 8 3 a - 8 (%i2) solve (x^3 - 3*x^2 + 5*x = 15, x);

(%o2) [x = - sqrt(5) %i, x = sqrt(5) %i, x = 3]

Maxima can solve nonlinear sets of equations. Note that if you don’t want a result printed, you can finish your command with$ instead of;.

(%i1) eq_1: x^2 + 3*x*y + y^2 = 0$

(%i2) eq_2: 3*x + y = 1$

(%i3) solve ([eq_1, eq_2]);

3 sqrt(5) + 7 sqrt(5) + 3 (%o3) [[y = - ---, x = ---],

2 2

3 sqrt(5) - 7 sqrt(5) - 3 [y = ---, x = - ---]]

2 2

Maxima can generate plots of one or more functions:

(24)

(%i1) plot2d (sin(x)/x, [x, -20, 20])$

sin(x)/x

x -0.2

0 0.2 0.4 0.6 0.8 1

-20 -15 -10 -5 0 5 10 15 20

(%i2) plot2d ([atan(x), erf(x), tanh(x)], [x, -5, 5], [y, -1.5, 2])$

x

atan(x) erf(x) tanh(x)

-1.5 -1 -0.5 0 0.5 1 1.5 2

-4 -2 0 2 4

(25)

(%i3) plot3d (sin(sqrt(x^2 + y^2))/sqrt(x^2 + y^2), [x, -12, 12], [y, -12, 12])$

-10 -5

0 5

10 -10

-5 0

5 10 -0.4

-0.2 0 0.2 0.4 0.6 0.8 1

sin(sqrt(y^2+x^2))/sqrt(y^2+x^2)

x

y z

(26)
(27)

2 Bug Detection and Reporting

2.1 Functions and Variables for Bug Detection and Reporting

[Function]

run_testsuite ([options])

Run the Maxima test suite. Tests producing the desired answer are considered

“passes,” as are tests that do not produce the desired answer, but are marked as known bugs.

run_testsuitetakes the following optional keyword arguments display_all

Display all tests. Normally, the tests are not displayed, unless the test fails. (Defaults tofalse).

display_known_bugs

Displays tests that are marked as known bugs. (Default isfalse).

tests This is a single test or a list of tests that should be run. Each test can be specified by either a string or a symbol. By default, all tests are run.

The complete set of tests is specified bytestsuite_files.

time Display time information. If true, the time taken for each test file is displayed. If all, the time for each individual test is shown if display_

allistrue. The default is false, so no timing information is shown.

share_tests

Load additional tests for the share directory. If true, these additional tests are run as a part of the testsuite. Iffalse, no tests from theshare directory are run. If only, only the tests from the share directory are run. Of course, the actual set of test that are run can be controlled by thetestsoption. The default is false.

For example run_testsuite(display_known_bugs = true, tests=[rtest5]) runs just testrtest5and displays the test that are marked as known bugs.

run_testsuite(display_all = true, tests=["rtest1", rtest1a]) will run tests rtest1and rtest2, and displays each test.

run_testsuite changes the Maxima environment. Typically a test script executes kill to establish a known environment (namely one without user-defined functions and variables) and then defines functions and variables appropriate to the test.

run_testsuitereturns done.

[Option variable]

testsuite_files

testsuite_filesis the set of tests to be run byrun_testsuite. It is a list of names of the files containing the tests to run. If some of the tests in a file are known to fail, then instead of listing the name of the file, a list containing the file name and the test numbers that fail is used.

For example, this is a part of the default set of tests:

["rtest13s", ["rtest14", 57, 63]]

(28)

This specifies the testsuite consists of the files"rtest13s"and"rtest14", but"rtest14"

contains two tests that are known to fail: 57 and 63.

[Option variable]

share_testsuite_files

share_testsuite_files is the set of tests from thesharedirectory that is run as a part of the test suite byrun_testsuite..

[Function]

bug_report ()

Prints out Maxima and Lisp version numbers, and gives a link to the Maxima project bug report web page. The version information is the same as reported bybuild_info.

When a bug is reported, it is helpful to copy the Maxima and Lisp version information into the bug report.

bug_report returns an empty string"".

[Function]

build_info ()

Returns a summary of the parameters of the Maxima build, as a Maxima structure (defined by defstruct). The fields of the structure are: version,timestamp,host, lisp_name, andlisp_version. When the pretty-printer is enabled (viadisplay2d), the structure is displayed as a short table.

See also bug_report.

Examples:

(%i1) build_info ();

(%o1)

Maxima version: "5.36.1"

Maxima build date: "2015-06-02 11:26:48"

Host type: "x86_64-unknown-linux-gnu"

Lisp implementation type: "GNU Common Lisp (GCL)"

Lisp implementation version: "GCL 2.6.12"

(%i2) x : build_info ()$

(%i3) x@version;

(%o3) 5.36.1

(%i4) x@timestamp;

(%o4) 2015-06-02 11:26:48

(%i5) x@host;

(%o5) x86_64-unknown-linux-gnu

(%i6) x@lisp_name;

(%o6) GNU Common Lisp (GCL)

(%i7) x@lisp_version;

(%o7) GCL 2.6.12

(%i8) x;

(%o8)

Maxima version: "5.36.1"

Maxima build date: "2015-06-02 11:26:48"

Host type: "x86_64-unknown-linux-gnu"

Lisp implementation type: "GNU Common Lisp (GCL)"

Lisp implementation version: "GCL 2.6.12"

(29)

The Maxima version string can (here 5.36.1) can look very different:

(%i1) build_info();

(%o1)

Maxima version: "branch_5_37_base_331_g8322940_dirty"

Maxima build date: "2016-01-01 15:37:35"

Host type: "x86_64-unknown-linux-gnu"

Lisp implementation type: "CLISP"

Lisp implementation version: "2.49 (2010-07-07) (built 3605577779) (memory 3660647857)"

In that case, Maxima was not build from a released sourcecode, but directly from the GIT-checkout of the sourcecode. In the example, the checkout is 331 commits after the latest GIT tag (usually a Maxima (major) release (5.37 in our example)) and the abbreviated commit hash of the last commit was "8322940".

Front-ends for maxima can add information about currently being used by setting the variablesmaxima_frontend andmaxima_frontend_versionaccordingly.

(30)
(31)

3 Help

3.1 Documentation

The Maxima on-line user’s manual can be viewed in different forms. From the Maxima interactive prompt, the user’s manual is viewed as plain text by the ?command (i.e., the describe function). The user’s manual is viewed as info hypertext by the info viewer program and as a web page by any ordinary web browser.

example displays examples for many Maxima functions. For example, (%i1) example (integrate);

yields

(%i2) test(f):=block([u],u:integrate(f,x),ratsimp(f-diff(u,x))) (%o2) test(f) := block([u], u : integrate(f, x),

ratsimp(f - diff(u, x))) (%i3) test(sin(x))

(%o3) 0

(%i4) test(1/(x+1))

(%o4) 0

(%i5) test(1/(x^2+1))

(%o5) 0

and additional output.

3.2 Functions and Variables for Help

[Function]

apropos (name)

Searches for Maxima names which havenameappearing anywhere within them;name must be a string or symbol. Thus, apropos (exp) returns a list of all the flags and functions which have exp as part of their names, such as expand, exp, and exponentialize. So, if you can only remember part of the name of a Maxima com- mand or variable, you can use this command to find the rest of the name. Similarly, you can type apropos (tr_) to find a list of many of the switches relating to the translator, most of which begin withtr_.

apropos("")returns a list with all Maxima names.

apropos returns the empty list[], if no name is found.

Example:

Show all Maxima symbols which have gammain the name:

(%i1) apropos("gamma");

(%o1) [%gamma, Gamma, gamma_expand, gammalim, makegamma,

prefer_gamma_incomplete, gamma, gamma-incomplete, gamma_incomplete, gamma_incomplete_generalized, gamma_incomplete_generalized_regularized, gamma_incomplete_lower, gamma_incomplete_regularized, log_gamma]

The same example, using the symbol gamma, rather than the string:

(32)

(%i2) apropos(gamma);

(%o2) [%gamma, Gamma, gamma_expand, gammalim, makegamma,

prefer_gamma_incomplete, gamma, gamma-incomplete, gamma_incomplete, gamma_incomplete_generalized, gamma_incomplete_generalized_regularized, gamma_incomplete_lower, gamma_incomplete_regularized, log_gamma]

The number of symbols in the current Maxima session. This will vary.

(%i3) length(apropos(""));

(%o3) 2338

[Function]

demo (filename)

Evaluates Maxima expressions infilename and displays the results. demopauses after evaluating each expression and continues after the user enters a carriage return. (If running in Xmaxima, demo may need to see a semicolon ; followed by a carriage return.)

demo searches the list of directories file_search_demo to find filename. If the file has the suffix dem, the suffix may be omitted. See alsofile_search.

demo evaluates its argument. demo returns the name of the demonstration file.

Example:

(%i1) demo ("disol");

batching /home/wfs/maxima/share/simplification/disol.dem At the _ prompt, type ';' followed by enter to get next demo (%i2) load("disol")

_

(%i3) exp1 : a (e (g + f) + b (d + c)) (%o3) a (e (g + f) + b (d + c)) _

(%i4) disolate(exp1, a, b, e)

(%t4) d + c

(%t5) g + f

(%o5) a (%t5 e + %t4 b)

_

[Function]

describe

describe (string)

describe (string, exact) describe (string, inexact)

describe(string)is equivalent todescribe(string, exact).

describe(string, exact)finds an item with title equal (case-insensitive) tostring, if there is any such item.

(33)

describe(string, inexact)finds all documented items which containstringin their titles. If there is more than one such item, Maxima asks the user to select an item or items to display.

At the interactive prompt, ? foo (with a space between ? and foo) is equivalent to describe("foo", exact), and ?? foo is equivalent todescribe("foo", inexact).

describe("", inexact) yields a list of all topics documented in the on-line manual.

describe quotes its argument. describe returns true if some documentation is found, otherwise false.

See also Section 3.1 [Documentation], page 11.

Example:

(%i1) ?? integ

0: Functions and Variables for Elliptic Integrals 1: Functions and Variables for Integration

2: Introduction to Elliptic Functions and Integrals 3: Introduction to Integration

4: askinteger (Functions and Variables for Simplification) 5: integerp (Functions and Variables for Miscellaneous Options) 6: integer_partitions (Functions and Variables for Sets)

7: integrate (Functions and Variables for Integration) 8: integrate_use_rootsof (Functions and Variables for

Integration)

9: integration_constant_counter (Functions and Variables for Integration)

10: nonnegintegerp (Functions and Variables for linearalgebra) Enter space-separated numbers, ‘all' or ‘none': 7 8

-- Function: integrate (<expr>, <x>)

-- Function: integrate (<expr>, <x>, <a>, <b>)

Attempts to symbolically compute the integral of <expr> with respect to <x>. ‘integrate (<expr>, <x>)' is an indefinite integral, while ‘integrate (<expr>, <x>, <a>, <b>)' is a definite integral, [...]

-- Option variable: integrate_use_rootsof Default value: ‘false'

When ‘integrate_use_rootsof' is ‘true' and the denominator of a rational function cannot be factored, ‘integrate' returns the integral in a form which is a sum over the roots (not yet known) of the denominator.

[...]

In this example, items 7 and 8 were selected (output is shortened as indicated by [...]). All or none of the items could have been selected by entering allor none, which can be abbreviated aorn, respectively.

(34)

[Function]

example

example (topic) example ()

example (topic)displays some examples of topic, which is a symbol or a string. To get examples for operators like if,do, orlambdathe argument must be a string, e.g.

example ("do"). example is not case sensitive. Most topics are function names.

example ()returns the list of all recognized topics.

The name of the file containing the examples is given by the global option variable manual_demo, which defaults to"manual.demo".

examplequotes its argument. examplereturnsdoneunless no examples are found or there is no argument, in which case examplereturns the list of all recognized topics.

Examples:

(%i1) example(append);

(%i2) append([y+x,0,-3.2],[2.5e+20,x])

(%o2) [y + x, 0, - 3.2, 2.5e+20, x]

(%o2) done

(%i3) example("lambda");

(%i4) lambda([x,y,z],x^2+y^2+z^2)

2 2 2

(%o4) lambda([x, y, z], x + y + z ) (%i5) %(1,2,a)

2

(%o5) a + 5

(%i6) 1+2+a

(%o6) a + 3

(%o6) done

[Option variable]

manual_demo

Default value: "manual.demo"

manual_demo specifies the name of the file containing the examples for the function example. See example.

(35)

4 Command Line

4.1 Introduction to Command Line

4.2 Functions and Variables for Command Line

[System variable]

__

__ is the input expression currently being evaluated. That is, while an input expres- sion expr is being evaluated,__ isexpr.

__ is assigned the input expression before the input is simplified or evaluated. How- ever, the value of__ is simplified (but not evaluated) when it is displayed.

__ is recognized by batch and load. In a file processed by batch, __ has the same meaning as at the interactive prompt. In a file processed by load,__is bound to the input expression most recently entered at the interactive prompt or in a batch file;

__ is not bound to the input expressions in the file being processed. In particular, when load (filename) is called from the interactive prompt, __ is bound to load (filename)while the file is being processed.

See also _and %.

Examples:

(%i1) print ("I was called as", __);

I was called as print(I was called as, __) (%o1) print(I was called as, __) (%i2) foo (__);

(%o2) foo(foo(__))

(%i3) g (x) := (print ("Current input expression =", __), 0);

(%o3) g(x) := (print("Current input expression =", __), 0) (%i4) [aa : 1, bb : 2, cc : 3];

(%o4) [1, 2, 3]

(%i5) (aa + bb + cc)/(dd + ee + g(x));

cc + bb + aa Current input expression = ---

g(x) + ee + dd 6

(%o5) ---

ee + dd

[System variable]

_

_is the most recent input expression (e.g., %i1,%i2,%i3, . . . ).

_is assigned the input expression before the input is simplified or evaluated. However, the value of_is simplified (but not evaluated) when it is displayed.

_ is recognized by batch and load. In a file processed by batch, _ has the same meaning as at the interactive prompt. In a file processed by load,_is bound to the input expression most recently evaluated at the interactive prompt or in a batch file;

_is not bound to the input expressions in the file being processed.

(36)

See also __ and %.

Examples:

(%i1) 13 + 29;

(%o1) 42

(%i2) :lisp $_

((MPLUS) 13 29) (%i2) _;

(%o2) 42

(%i3) sin (%pi/2);

(%o3) 1

(%i4) :lisp $_

((%SIN) ((MQUOTIENT) $%PI 2)) (%i4) _;

(%o4) 1

(%i5) a: 13$

(%i6) b: 29$

(%i7) a + b;

(%o7) 42

(%i8) :lisp $_

((MPLUS) $A $B) (%i8) _;

(%o8) b + a

(%i9) a + b;

(%o9) 42

(%i10) ev (_);

(%o10) 42

[System variable]

%

% is the output expression (e.g., %o1, %o2, %o3, . . . ) most recently computed by Maxima, whether or not it was displayed.

% is recognized by batch and load. In a file processed by batch, % has the same meaning as at the interactive prompt. In a file processed by load,%is bound to the output expression most recently computed at the interactive prompt or in a batch file; %is not bound to output expressions in the file being processed.

See also _,%%, and %th.

[System variable]

%%

In compound statements, namelyblock,lambda, or(s_1, ..., s_n),%%is the value of the previous statement.

At the first statement in a compound statement, or outside of a compound statement,

%% is undefined.

%%is recognized bybatchandload, and it has the same meaning as at the interactive prompt.

See also %.

Examples:

(37)

The following two examples yield the same result.

(%i1) block (integrate (x^5, x), ev (%%, x=2) - ev (%%, x=1));

21

(%o1) --

2

(%i2) block ([prev], prev: integrate (x^5, x), ev (prev, x=2) - ev (prev, x=1));

21

(%o2) --

2

A compound statement may comprise other compound statements. Whether a state- ment be simple or compound, %% is the value of the previous statement.

(%i3) block (block (a^n, %%*42), %%/6);

n

(%o3) 7 a

Within a compound statement, the value of %%may be inspected at a break prompt, which is opened by executing the break function. For example, entering %%; in the following example yields42.

(%i4) block (a: 42, break ())$

Entering a Maxima break point. Type 'exit;' to resume.

_%%;

42 _

[Function]

%th (i)

The value of the i’th previous output expression. That is, if the next expression to be computed is the n’th output,%th (m)is the (n- m)’th output.

%this recognized bybatchand load. In a file processed bybatch,%thhas the same meaning as at the interactive prompt. In a file processed byload,%threfers to output expressions most recently computed at the interactive prompt or in a batch file; %th does not refer to output expressions in the file being processed.

See also %and %%.

Example:

%th is useful in batch files or for referring to a group of output expressions. This example setssto the sum of the last five output expressions.

(%i1) 1;2;3;4;5;

(%o1) 1

(%o2) 2

(%o3) 3

(%o4) 4

(%o5) 5

(%i6) block (s: 0, for i:1 thru 5 do s: s + %th(i), s);

(%o6) 15

(38)

[Special symbol]

?

As prefix to a function or variable name, ? signifies that the name is a Lisp name, not a Maxima name. For example, ?round signifies the Lisp function ROUND. See Section 37.1 [Lisp and Maxima], page 641, for more on this point.

The notation ? word (a question mark followed a word, separated by whitespace) is equivalent todescribe("word"). The question mark must occur at the beginning of an input line; otherwise it is not recognized as a request for documentation. See also describe.

[Special symbol]

??

The notation ?? word(??followed a word, separated by whitespace) is equivalent to describe("word", inexact). The question mark must occur at the beginning of an input line; otherwise it is not recognized as a request for documentation. See also describe.

[Input terminator]

$

The dollar sign $terminates an input expression, and the most recent output% and an output label, e.g. %o1, are assigned the result, but the result is not displayed.

See also ;.

Example:

(%i1) 1 + 2 + 3 $ (%i2) %;

(%o2) 6

(%i3) %o1;

(%o3) 6

[Input terminator]

;

The semicolon;terminates an input expression, and the resulting output is displayed.

See also $.

Example:

(%i1) 1 + 2 + 3;

(%o1) 6

[Option variable]

inchar

Default value: %i

inchar is the prefix of the labels of expressions entered by the user. Maxima auto- matically constructs a label for each input expression by concatenating inchar and linenum.

inchar may be assigned any string or symbol, not necessarily a single character.

Because Maxima internally takes into account only the first char of the prefix, the prefixesinchar,outchar, andlinecharshould have a different first char. Otherwise some commands likekill(inlabels) do not work as expected.

See also labels.

Example:

(%i1) inchar: "input";

(%o1) input

(39)

(input2) expand((a+b)^3);

3 2 2 3

(%o2) b + 3 a b + 3 a b + a

[System variable]

infolists

Default value: []

infolists is a list of the names of all of the information lists in Maxima. These are:

labels All bound%i,%o, and %t labels.

values All bound atoms which are user variables, not Maxima options or switches, created by: or::or functional binding.

functions

All user-defined functions, created by:=ordefine.

arrays All arrays,hashed arraysand memoizing functions.

macros All user-defined macro functions, created by::=.

myoptions

All options ever reset by the user (whether or not they are later reset to their default values).

rules All user-defined pattern matching and simplification rules, created by tellsimp,tellsimpafter,defmatch, ordefrule.

aliases All atoms which have an user-defined alias, created by the alias, ordergreat, orderless functions or by declaring the atom as a noun withdeclare.

dependencies

All atoms which have functional dependencies, created by thedepends, dependencies, orgradeffunctions.

gradefs All functions which have user-defined derivatives, created by thegradef function.

props All atoms which have any property other than those mentioned above, such as properties established byatvalueormatchdeclare, etc., as well as properties established in thedeclarefunction.

structures

All structs defined usingdefstruct.

let_rule_packages

All user-defined let rule packages plus the special package default_

let_rule_package. (default_let_rule_package is the name of the rule package used when one is not explicitly set by the user.)

(40)

[Function]

kill

kill(a_1, . . . , a_n) kill(labels)

kill(inlabels, outlabels, linelabels) kill(n)

kill([m, n])

kill(values, functions, arrays, . . .) kill(all)

kill(allbut (a_1, . . . , a_n))

Removes all bindings (value, function, array, or rule) from the arguments a 1, . . . , a n. An argument a k may be a symbol or a single array element. When a k is a single array element, killunbinds that element without affecting any other elements of the array.

Several special arguments are recognized. Different kinds of arguments may be com- bined, e.g., kill (inlabels, functions, allbut (foo, bar)).

kill (labels)unbinds all input, output, and intermediate expression labels created so far. kill (inlabels)unbinds only input labels which begin with the current value ofinchar. Likewise,kill (outlabels)unbinds only output labels which begin with the current value of outchar, and kill (linelabels) unbinds only intermediate expression labels which begin with the current value oflinechar.

kill (n), wheren is an integer, unbinds then most recent input and output labels.

kill ([m,n]) unbinds input and output labels mthrough n.

kill (infolist), where infolist is any item in infolists (such as values, functions, orarrays) unbinds all items in infolist. See alsoinfolists.

kill (all) unbinds all items on all infolists. kill (all) does not reset global vari- ables to their default values; see reseton this point.

kill (allbut (a_1, ..., a_n))unbinds all items on all infolists except fora 1, . . . , a n. kill (allbut (infolist)) unbinds all items except for the ones on infolist, where infolistis values,functions,arrays, etc.

The memory taken up by a bound property is not released until all symbols are unbound from it. In particular, to release the memory taken up by the value of a symbol, one unbinds the output label which shows the bound value, as well as unbinding the symbol itself.

kill quotes its arguments. The quote-quote operator'' defeats quotation.

kill (symbol)unbinds all properties ofsymbol. In contrast, the functionsremvalue, remfunction, remarray, and remrule unbind a specific property. Note that facts declared by assumedon’t require a symbol they apply to, therefore aren’t stored as properties of symbols and therefore aren’t affected bykill.

kill always returns done, even if an argument has no binding.

[Function]

labels (symbol)

Returns the list of input, output, or intermediate expression labels which begin with symbol. Typicallysymbol is the value ofinchar,outchar, or linechar. If no labels begin with symbol,labelsreturns an empty list.

(41)

By default, Maxima displays the result of each user input expression, giving the result an output label. The output display is suppressed by terminating the input with $ (dollar sign) instead of ; (semicolon). An output label is constructed and bound to the result, but not displayed, and the label may be referenced in the same way as displayed output labels. See also %,%%, and %th.

Intermediate expression labels can be generated by some functions. The option vari- ableprogrammodecontrols whethersolveand some other functions generate interme- diate expression labels instead of returning a list of expressions. Some other functions, such asldisplay, always generate intermediate expression labels.

See also inchar,outchar,linechar, andinfolists.

[System variable]

labels

The variable labelsis the list of input, output, and intermediate expression labels, including all previous labels if inchar,outchar, orlinecharwere redefined.

[Option variable]

linechar

Default value: %t

linechar is the prefix of the labels of intermediate expressions generated by Max- ima. Maxima constructs a label for each intermediate expression (if displayed) by concatenating linecharand linenum.

linechar may be assigned any string or symbol, not necessarily a single character.

Because Maxima internally takes into account only the first char of the prefix, the prefixesinchar,outchar, andlinecharshould have a different first char. Otherwise some commands likekill(inlabels) do not work as expected.

Intermediate expressions might or might not be displayed. See programmode and labels.

[System variable]

linenum

The line number of the current pair of input and output expressions.

[System variable]

myoptions

Default value: []

myoptions is the list of all options ever reset by the user, whether or not they get reset to their default value.

[Option variable]

nolabels

Default value: false

When nolabelsis true, input and output result labels (%iand %o, respectively) are displayed, but the labels are not bound to results, and the labels are not appended to thelabelslist. Since labels are not bound to results, garbage collection can recover the memory taken up by the results.

Otherwise input and output result labels are bound to results, and the labels are appended to thelabelslist.

Intermediate expression labels (%t) are not affected bynolabels; whethernolabels is true or false, intermediate expression labels are bound and appended to the labelslist.

See also batch,load, and labels.

(42)

[Option variable]

optionset

Default value: false

When optionset is true, Maxima prints out a message whenever a Maxima option is reset. This is useful if the user is doubtful of the spelling of some option and wants to make sure that the variable he assigned a value to was truly an option variable.

Example:

(%i1) optionset:true;

assignment: assigning to option optionset

(%o1) true

(%i2) gamma_expand:true;

assignment: assigning to option gamma_expand

(%o2) true

[Option variable]

outchar

Default value: %o

outcharis the prefix of the labels of expressions computed by Maxima. Maxima auto- matically constructs a label for each computed expression by concatenating outchar and linenum.

outchar may be assigned any string or symbol, not necessarily a single character.

Because Maxima internally takes into account only the first char of the prefix, the prefixesinchar,outcharandlinecharshould have a different first char. Otherwise some commands likekill(inlabels) do not work as expected.

See also labels.

Example:

(%i1) outchar: "output";

(output1) output

(%i2) expand((a+b)^3);

3 2 2 3

(output2) b + 3 a b + 3 a b + a

[Function]

playback

playback () playback (n) playback ([m, n]) playback ([m]) playback (input) playback (slow) playback (time) playback (grind)

Displays input, output, and intermediate expressions, without recomputing them.

playback only displays the expressions bound to labels; any other output (such as text printed by print or describe, or error messages) is not displayed. See also labels.

playback quotes its arguments. The quote-quote operator '' defeats quotation.

playbackalways returns done.

(43)

playback ()(with no arguments) displays all input, output, and intermediate expres- sions generated so far. An output expression is displayed even if it was suppressed by the$terminator when it was originally computed.

playback (n)displays the most recent nexpressions. Each input, output, and inter- mediate expression counts as one.

playback ([m,n]) displays input, output, and intermediate expressions with num- bers from mthrough n, inclusive.

playback ([m]) is equivalent to playback ([m,m]); this usually prints one pair of input and output expressions.

playback (input) displays all input expressions generated so far.

playback (slow) pauses between expressions and waits for the user to press enter.

This behavior is similar to demo. playback (slow) is useful in conjunction with save orstringoutwhen creating a secondary-storage file in order to pick out useful expressions.

playback (time)displays the computation time for each expression.

playback (grind) displays input expressions in the same format as the grindfunc- tion. Output expressions are not affected by thegrind option. Seegrind.

Arguments may be combined, e.g., playback ([5, 10], grind, time, slow).

[Option variable]

prompt

Default value: _

promptis the prompt symbol of thedemo function, playback (slow)mode, and the Maxima break loop (as invoked by break).

[Function]

quit ()

Terminates the Maxima session. Note that the function must be invoked as quit();

orquit()$, notquit by itself.

To stop a lengthy computation, typecontrol-C. The default action is to return to the Maxima prompt. If *debugger-hook* is nil, control-C opens the Lisp debugger.

See also Chapter 38 [Debugging], page 657.

[Function]

read (expr_1, . . . , expr_n)

Prints expr 1, . . . , expr n, then reads one expression from the console and returns the evaluated expression. The expression is terminated with a semicolon ; or dollar sign $.

See also readonly Example:

(%i1) foo: 42$

(%i2) foo: read ("foo is", foo, " -- enter new value.")$

foo is 42 -- enter new value.

(a+b)^3;

(%i3) foo;

3

(%o3) (b + a)

(44)

[Function]

readonly (expr_1, . . . , expr_n)

Printsexpr 1, . . . ,expr n, then reads one expression from the console and returns the expression (without evaluation). The expression is terminated with a ; (semicolon) or$(dollar sign).

See also read.

Examples:

(%i1) aa: 7$

(%i2) foo: readonly ("Enter an expression:");

Enter an expression:

2^aa;

aa

(%o2) 2

(%i3) foo: read ("Enter an expression:");

Enter an expression:

2^aa;

(%o3) 128

[Function]

reset ()

Resets many global variables and options, and some other variables, to their default values.

reset processes the variables on the Lisp list *variable-initial-values*. The Lisp macrodefmvarputs variables on this list (among other actions). Many, but not all, global variables and options are defined by defmvar, and some variables defined by defmvar are not global variables or options.

[Option variable]

showtime

Default value: false

Whenshowtimeistrue, the computation time and elapsed time is printed with each output expression.

The computation time is always recorded, so time and playback can display the computation time even when showtimeis false.

See also timer.

[Function]

to_lisp ()

Enters the Lisp system under Maxima. (to-maxima)returns to Maxima.

Example:

Define a function and enter the Lisp system under Maxima. The definition is inspected on the property list, then the function definition is extracted, factored and stored in the variable$result. The variable can be used in Maxima after returning to Maxima.

(%i1) f(x):=x^2+x;

2

(%o1) f(x) := x + x

(%i2) to_lisp();

Type (to-maxima) to restart, ($quit) to quit Maxima.

MAXIMA> (symbol-plist '$f)

(MPROPS (NIL MEXPR ((LAMBDA) ((MLIST) $X)

(45)

((MPLUS) ((MEXPT) $X 2) $X)))) MAXIMA> (setq $result ($factor (caddr (mget '$f 'mexpr)))) ((MTIMES SIMP FACTORED) $X ((MPLUS SIMP IRREDUCIBLE) 1 $X)) MAXIMA> (to-maxima)

Returning to Maxima

(%o2) true

(%i3) result;

(%o3) x (x + 1)

[System variable]

values

Initial value: []

values is a list of all bound user variables (not Maxima options or switches). The list comprises symbols bound by :, or::.

If the value of a variable is removed with the commands kill,remove, orremvalue the variable is deleted fromvalues.

Seefunctions for a list of user defined functions.

Examples:

First, valuesshows the symbols a, b, and c, but not d, it is not bound to a value, and not the user function f. The values are removed from the variables. values is the empty list.

(%i1) [a:99, b:: a-90, c:a-b, d, f(x):=x^2];

2 (%o1) [99, 9, 90, d, f(x) := x ] (%i2) values;

(%o2) [a, b, c]

(%i3) [kill(a), remove(b,value), remvalue(c)];

(%o3) [done, done, [c]]

(%i4) values;

(%o4) []

4.3 Functions and Variables for Display

[Option variable]

%edispflag

Default value: false

When%edispflagistrue, Maxima displays%eto a negative exponent as a quotient.

For example,%e^-x is displayed as1/%e^x. See also exptdispflag.

Example:

(%i1) %e^-10;

- 10

(%o1) %e

(%i2) %edispflag:true$

(%i3) %e^-10;

1

(%o3) ----

10

%e

(46)

[Option variable]

absboxchar

Default value: !

absboxchar is the character used to draw absolute value signs around expressions which are more than one line tall.

Example:

(%i1) abs((x^3+1));

! 3 !

(%o1) !x + 1!

[Function]

declare_index_properties (a, [p_1, p_2, p_3, ...])

[Function]

declare_index_properties ([a, b, c, ...], [p_1, p_2, p_3, ...])

[Symbol]

postsubscript

[Symbol]

postsuperscript

[Symbol]

presuperscript

[Symbol]

presubscript

Declares the properties of indices applied to the symbol a or each of the of symbols a, b,c, .... If multiple symbols are given, the whole list of properties applies to each symbol.

Given a symbol with indices, a[i_1,i_2,i_3, ...], thek-th propertyp k applies to thek-th indexi k. There may be any number of index properties, in any order.

Each property p k must one of these four recognized properties: postsubscript, postsuperscript, presuperscript, or presubscript, to denote indices which are displayed, respectively, to the right and below, to the right and above, to the left and above, or to the left and below.

Index properties apply only to the 2-dimensional display of indexed variables (i.e., when display2d is true) and TeX output via tex. Otherwise, index properties are ignored. Index properties do not change the input of indexed variables, do not change the algebraic properties of indexed variables, and do not change the 1-dimensional display of indexed variables.

declare_index_properties quotes (does not evaluate) its arguments.

remove_index_propertiesremoves index properties. killalso removes index prop- erties (and all other properties).

get_index_propertiesretrieves index properties.

Examples:

Given a symbol with indices, a[i_1,i_2,i_3, ...], thek-th propertyp k applies to thek-th indexi k. There may be any number of index properties, in any order.

(%i1) declare_index_properties (A, [presubscript, postsubscript]);

(%o1) done

(%i2) declare_index_properties (B, [postsuperscript, postsuperscript, presuperscript]);

(%o2) done

(%i3) declare_index_properties (C, [postsuperscript, presubscript, presubscript, presuperscript]);

(%o3) done

(47)

(%i4) A[w, x];

(%o4) A

w x (%i5) B[w, x, y];

y w, x

(%o5) B

(%i6) C[w, x, y, z];

z w

(%o6) C

x, y

Index properties apply only to the 2-dimensional display of indexed variables and TeX output. Otherwise, index properties are ignored.

(%i1) declare_index_properties (A, [presubscript, postsubscript]);

(%o1) done

(%i2) A[w, x];

(%o2) A

w x (%i3) tex (A[w, x]);

$${}_{w}A_{x}$$

(%o3) false

(%i4) display2d: false $ (%i5) A[w, x];

(%o5) A[w,x]

(%i6) display2d: true $ (%i7) grind (A[w, x]);

A[w,x]$

(%o7) done

(%i8) stringdisp: true $ (%i9) string (A[w, x]);

(%o9) "A[w,x]"

[Function]

get_index_properties (a)

Returns the properties for aestablished by declare_index_properties.

See also remove_index_properties.

[Function]

remove_index_properties (a, b, c, ...)

Removes the properties established by declare_index_properties. All index prop- erties are removed from each symbol a,b,c, ....

remove_index_propertiesquotes (does not evaluate) its arguments.

[Symbol property]

display_index_separator

When a symbol A has index display properties declared via declare_index_

properties, the value of the property display_index_separator is the string or other expression which is displayed between indices.

The value of display_index_separator is assigned by put(A,S, display_index_

separator), where S is a string or other expression. The assigned value is retrieved by get(A, display_index_separator).

(48)

The display index separator S can be a string, including an empty string, or false, indicating the default separator, or any expression. If not a string and notfalse, the property value is coerced to a string viastring.

If no display index separator is assigned, the default separator is used. The default separator is a comma. There is no way to change the default separator.

Each symbol has its own value of display_index_separator.

See also put,get, anddeclare_index_properties.

Examples:

When a symbol A has index display properties, the value of the property display_

index_separatoris the string or other expression which is displayed between indices.

The value is assigned by put(A,S, display_index_separator),

(%i1) declare_index_properties (A, [postsuperscript, postsuperscript, presubscript, presubscript]);

(%o1) done

(%i2) put (A, ";", display_index_separator);

(%o2) ;

(%i3) A[w, x, y, z];

w;x

(%o3) A

y;z

The assigned value is retrieved byget(A, display_index_separator).

(%i1) declare_index_properties (A, [postsuperscript, postsuperscript, presubscript, presubscript]);

(%o1) done

(%i2) put (A, ";", display_index_separator);

(%o2) ;

(%i3) get (A, display_index_separator);

(%o3) ;

The display index separator S can be a string, including an empty string, or false, indicating the default separator, or any expression.

(%i1) declare_index_properties (A, [postsuperscript, postsuperscript, presubscript, presubscript]);

(%o1) done

(%i2) A[w, x, y, z];

w, x

(%o2) A

y, z

(%i3) put (A, "-", display_index_separator);

(%o3) -

(%i4) A[w, x, y, z];

w-x

(%o4) A

y-z

(%i5) put (A, " ", display_index_separator);

(%o5)

Références

Documents relatifs

The aim of this work is to study this Weyl symbol when V is a C ∞ potential describing a large number of particles in interaction, either for a nearest neighbor interaction model in

Anne-Gaëlle T OUTAIN , who presents the Saussurian conception of the constitutive duality of the sign, shows that in traditional dualism sound / meaning, Saussure opposes

I knew that there must be a lot of poignant connections since her work talks about the ways that contemporary global trade is based on these very specific military models of

Using the symbol means that the symbol can appear in some larger pattern which provides a context for this instantiation of the represented object.. This larger pattern may be

The continuation of the Verse of Light confirms moreover this assimilation of divine light with artificial rather than celestial light, reiterating the comparison by

The concentration of either our sample or titrant can affect the shape of our titration curve.. different acid sample concentrations As the

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des

When forming their value proposition, which is needed for acquiring new customers, the company may focus one of the three main assets that are needed to run process instances: