Maxima CAS an introduction

ssuserd6b1fd 348 views 176 slides Oct 10, 2021
Slide 1
Slide 1 of 176
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113
Slide 114
114
Slide 115
115
Slide 116
116
Slide 117
117
Slide 118
118
Slide 119
119
Slide 120
120
Slide 121
121
Slide 122
122
Slide 123
123
Slide 124
124
Slide 125
125
Slide 126
126
Slide 127
127
Slide 128
128
Slide 129
129
Slide 130
130
Slide 131
131
Slide 132
132
Slide 133
133
Slide 134
134
Slide 135
135
Slide 136
136
Slide 137
137
Slide 138
138
Slide 139
139
Slide 140
140
Slide 141
141
Slide 142
142
Slide 143
143
Slide 144
144
Slide 145
145
Slide 146
146
Slide 147
147
Slide 148
148
Slide 149
149
Slide 150
150
Slide 151
151
Slide 152
152
Slide 153
153
Slide 154
154
Slide 155
155
Slide 156
156
Slide 157
157
Slide 158
158
Slide 159
159
Slide 160
160
Slide 161
161
Slide 162
162
Slide 163
163
Slide 164
164
Slide 165
165
Slide 166
166
Slide 167
167
Slide 168
168
Slide 169
169
Slide 170
170
Slide 171
171
Slide 172
172
Slide 173
173
Slide 174
174
Slide 175
175
Slide 176
176

About This Presentation

How use maxima? Read this note for better understanding. Professionally written and explained.


Slide Content

1
PROGRAMMING
MAXIMA
Arun Umrao
www.sdmsacademy.in
DRAFT COPY- GPL LICENSING

2

Contents
I Modelica Commands 17
1 Maxima Core 19
1.1 Mathematical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.1.1 Factorial Symbol (!) . . . . . . . . . . . . . . . . . . . . . 19
1.1.2 Double Factorial Symbol (!!) . . . . . . . . . . . . . . . . 19
1.1.3 Termination of Line (;) . . . . . . . . . . . . . . . . . . . 20
1.1.4 Negation of Expression (#) . . . . . . . . . . . . . . . . . 20
1.1.5 Evaluate Internally & No Output ($) . . . . . . . . . . . . 20
1.1.6 Do Not Execute Function (’) . . . . . . . . . . . . . . . . 20
1.1.7 Re-evaluation of Specific Input (“) . . . . . . . . . . . . . 21
1.1.8 Variable Assigning Operator (:) . . . . . . . . . . . . . . . 21
1.1.9 Operator Assigner (::) . . . . . . . . . . . . . . . . . . . . 21
1.1.10 Macro Function Definition Operator (::=) . . . . . . . . . 22
1.1.11 Function Operator (:=) . . . . . . . . . . . . . . . . . . . 22
1.1.12 Sum Operator (+) . . . . . . . . . . . . . . . . . . . . . . 23
1.1.13 Subtraction Operator (-) . . . . . . . . . . . . . . . . . . . 23
1.1.14 Product Operator (*) . . . . . . . . . . . . . . . . . . . . 24
1.1.15 Division Operator (/) . . . . . . . . . . . . . . . . . . . . 24
1.1.16 Exponential Operator (ˆ) . . . . . . . . . . . . . . . . . . 25
1.1.17 Equal Operator (=) . . . . . . . . . . . . . . . . . . . . . 26
1.1.18 Less Than Operator (<) . . . . . . . . . . . . . . . . . . . 26
1.1.19 Grater Than Operator (>) . . . . . . . . . . . . . . . . . 26
1.1.20 Less Than or Equals To Operator (<=) . . . . . . . . . . 27
1.1.21 Greater Than or Equals To Operator (>=) . . . . . . . . 27
1.1.22 Lisp Name (?) . . . . . . . . . . . . . . . . . . . . . . . . 27
1.1.23 A List ([ ... ]) . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.1.24 Call Last Garbage (%) . . . . . . . . . . . . . . . . . . . . 28
1.1.25 Previous Statement (%%) . . . . . . . . . . . . . . . . . . 28
1.1.26 Exponential (%e) . . . . . . . . . . . . . . . . . . . . . . . 28
1.1.27 %e tonumlog . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.1.28 Negative Exponent as a Quotient (%edispflag) . . . . . . 29
1.1.29 Demoivre Mode (%emode) . . . . . . . . . . . . . . . . . 29
1.1.30 Exponential Numerical (%enumer) . . . . . . . . . . . . . 29
1.1.31 Gamma Constant (%gamma) . . . . . . . . . . . . . . . . 30
3

4 CONTENTS
1.1.32 Pi Value (%pi) . . . . . . . . . . . . . . . . . . . . . . . . 30
1.1.33 Previous Output (%th) . . . . . . . . . . . . . . . . . . . 30
1.1.34 Most Recent Expression ( ) . . . . . . . . . . . . . . . . . 30
1.1.35 Display String (disp) . . . . . . . . . . . . . . . . . . . . . 30
1.2 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.2.1 Error (error) . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.2.2 Error Size (errorsize) . . . . . . . . . . . . . . . . . . . . 31
1.2.3 Error Symbol (errorsyms) . . . . . . . . . . . . . . . . . 31
1.2.4 Error Message (errormsg) . . . . . . . . . . . . . . . . . . 31
1.2.5 Debug Mode Maxima (debugmode) . . . . . . . . . . . . 32
1.2.6 Show Examples (example) . . . . . . . . . . . . . . . . . . 32
1.2.7 Set Numerical Precision (fpprec) . . . . . . . . . . . . . . 32
1.2.8 Toggle to Floating Point (numer) . . . . . . . . . . . . . . 32
1.3 Procedural . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.3.1 Interrupt Maxima (kill) . . . . . . . . . . . . . . . . . . . 33
1.3.2 Modes of Variables (modedeclare) . . . . . . . . . . . . . 33
1.3.3 Evaluate & Print Expression (print) . . . . . . . . . . . . 34
1.3.4 Labels (labels) . . . . . . . . . . . . . . . . . . . . . . . . 34
1.3.5 Line Number (linenum) . . . . . . . . . . . . . . . . . . . 34
1.3.6 List of Options (myoptions) . . . . . . . . . . . . . . . . . 34
1.3.7 Ordinary Base (obase) . . . . . . . . . . . . . . . . . . . . 34
1.3.8 Print the Reset Option (optionset) . . . . . . . . . . . . . 35
1.3.9 Play Previous Garbage (playback) . . . . . . . . . . . . . 35
1.3.10 Prompting Symbol (prompt) . . . . . . . . . . . . . . . . 35
1.3.11 Quit the Session (quit) . . . . . . . . . . . . . . . . . . . . 35
1.3.12 Rationalized Print (ratprint) . . . . . . . . . . . . . . . . 35
1.3.13 Enter into Lisp System (tolisp) . . . . . . . . . . . . . . . 35
1.3.14 Call Functions of Current Session (backtrace) . . . . . . . 36
1.3.15 Break Maxima Evaluation (break) . . . . . . . . . . . . . 36
1.3.16 Bug Reporting Info (bugreport) . . . . . . . . . . . . . . 36
1.3.17 Build Information (buildinfo) . . . . . . . . . . . . . . . . 36
1.3.18 Debug Mode (debugmode) . . . . . . . . . . . . . . . . . 36
1.3.19 Show Evaluation Time (showtime) . . . . . . . . . . . . . 36
1.3.20 Evaluation Time (time) . . . . . . . . . . . . . . . . . . . 36
1.3.21 Promp & Read (read) . . . . . . . . . . . . . . . . . . . . 37
1.3.22 testsuitefiles . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.3.23 Test The Maxim (runtestsuite) . . . . . . . . . . . . . . . 37
1.3.24 Read Function Without Evaluation (readonly) . . . . . . 37
1.3.25 Activate Contexts (activate) . . . . . . . . . . . . . . . . . 38
1.3.26 List of Activated Contexts (activecontexts) . . . . . . . . 38
1.3.27 Additive Function (additive) . . . . . . . . . . . . . . . . 38
1.3.28 Alternative Name for Function (alias) . . . . . . . . . . . 38
1.3.29 Declare String as Alphabic (alphabetic) . . . . . . . . . . 38
1.3.30 Arguments In Expression (args) . . . . . . . . . . . . . . . 38
1.3.31 Atomic Expression (atom) . . . . . . . . . . . . . . . . . . 38
1.3.32 Declare a Function Antisymmetric (antisymmetric) . . . . 39

CONTENTS 5
1.3.33 Check The Integer Type (askinteger) . . . . . . . . . . . . 39
1.3.34 Retrive User Property (get) . . . . . . . . . . . . . . . . . 39
1.3.35 Declare Variable as Integer (integer) . . . . . . . . . . . . 39
1.3.36 Declare Variable as Non-Integer (noninteger) . . . . . . . 40
1.3.37 Integer Variabe (integervalued) . . . . . . . . . . . . . . . 40
1.3.38 Query for Sign of Expression (asksign) . . . . . . . . . . . 40
1.3.39 Declare Variables (assume) . . . . . . . . . . . . . . . . . 40
1.3.40 Declare Variable as Positive (assumepos) . . . . . . . . . 41
1.3.41 Declare As Communative Function (commutative) . . . . 41
1.3.42 Compare Expression (compare) . . . . . . . . . . . . . . . 41
1.3.43 Context (context) . . . . . . . . . . . . . . . . . . . . . . 41
1.3.44 Contexts (contexts) . . . . . . . . . . . . . . . . . . . . . 41
1.3.45 Deactivate Context (deactivate) . . . . . . . . . . . . . . . 41
1.3.46 Delcaration Statement (declare) . . . . . . . . . . . . . . 41
1.4 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
1.4.1 Declare As Decreasing Function (decreasing) . . . . . . . 42
1.4.2 Declare As Increasing Function (increasing) . . . . . . . . 42
1.4.3 Declare Variable as Even Variable (even) . . . . . . . . . 42
1.4.4 Declare Variable as Odd Variable (odd) . . . . . . . . . . 42
1.4.5 Variable As a Constant (constant) . . . . . . . . . . . . . 42
1.4.6 Check a Constant (constantp) . . . . . . . . . . . . . . . . 42
1.4.7 Get Features (featurep) . . . . . . . . . . . . . . . . . . . 43
1.4.8 Set Feature (features) . . . . . . . . . . . . . . . . . . . . 43
1.4.9 Status (is) . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
1.4.10 Kill Contextx (killcontext) . . . . . . . . . . . . . . . . . 43
1.4.11 Simplify as Left-Associative (lassociative) . . . . . . . . . 43
1.4.12 Recognize Function as N-Array (nary) . . . . . . . . . . . 44
1.4.13 Maximum Negative Expansion (maxnegex) . . . . . . . . 44
1.4.14 Match Declaration (matchdeclare) . . . . . . . . . . . . . 44
1.4.15 Simplify as Multiplicative (multiplicative) . . . . . . . . . 44
1.4.16 Multiply Two Expression (multthru) . . . . . . . . . . . . 44
1.4.17 Negative Distribution (negdistrib) . . . . . . . . . . . . . 44
1.4.18 Create New Context (newcontext) . . . . . . . . . . . . . 45
1.4.19 Numerical Value of Variable (numerval) . . . . . . . . . . 45
1.4.20 Pull Out Constant Term (outative) . . . . . . . . . . . . . 45
1.4.21 Positive Function (posfun) . . . . . . . . . . . . . . . . . . 45
1.4.22 Properties of Atom (properties) . . . . . . . . . . . . . . . 45
1.4.23 Assign a Value to Property (put) . . . . . . . . . . . . . . 46
1.4.24 Simplify as Right-Associative (rassociative) . . . . . . . . 46
1.4.25 Declare Variable as Irrational Variable (irrational) . . . . 46
1.4.26 Declare Variable as Irrational Variable (rational) . . . . . 46
1.4.27 Declare Variable as Complex Variable (complex) . . . . . 46
1.4.28 Declare Variable as Imaginary Variable (imaginary) . . . 46
1.4.29 Declare Variable as Real Variable (real) . . . . . . . . . . 47
1.4.30 Remove Indicator From Atom (rem) . . . . . . . . . . . . 47
1.4.31 Remove Property (remove) . . . . . . . . . . . . . . . . . 47

6 CONTENTS
1.4.32 Scalar Value (scalar) . . . . . . . . . . . . . . . . . . . . . 47
1.4.33 Sign of Expression (sign) . . . . . . . . . . . . . . . . . . 47
1.4.34 Declare Variable as Symetric Function (symmetric) . . . . 48
2 Numeric Evaluation 49
2.1 Number Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.1.1 Big Float (bffac) . . . . . . . . . . . . . . . . . . . . . . . 49
2.1.2 Big Float Zeta Function (bfhzeta) . . . . . . . . . . . . . 49
2.1.3 Convert to Big Float (bfloat) . . . . . . . . . . . . . . . . 49
2.1.4 Is Big Float (bfloatp) . . . . . . . . . . . . . . . . . . . . 50
2.1.5 Digamma Big Float Function (bfpsi) & (bfpsi0) . . . . . . 50
2.1.6 Big Float to Rational Number (bftorat) . . . . . . . . . . 50
2.1.7 Truncate Big Float (bftrunc) . . . . . . . . . . . . . . . . 50
2.1.8 Big Float Zeta Function (bfzeta) . . . . . . . . . . . . . . 50
2.1.9 Complex Big Float (cbffac) . . . . . . . . . . . . . . . . . 50
2.1.10 Floating Point (float) . . . . . . . . . . . . . . . . . . . . 51
2.1.11 Float to Big Float (float2bf) . . . . . . . . . . . . . . . . 51
2.1.12 Is Floating Number (floatnump) . . . . . . . . . . . . . . 51
2.1.13 Float Point Precision (fpprec) . . . . . . . . . . . . . . . . 51
2.1.14 Float Point Print Precission (fpprintprec) . . . . . . . . . 51
2.1.15 Keep Float Points (keepfloat) . . . . . . . . . . . . . . . . 51
2.1.16 Numerical Solution (numer) . . . . . . . . . . . . . . . . . 51
2.1.17 Numerical Power of Negative Integer (numer pbranch) . . 52
2.1.18 Number to Variables (numerval) . . . . . . . . . . . . . . 52
2.1.19 Tolerance in Floating Point (ratepsilon) . . . . . . . . . . 52
2.1.20 Rationalize (rationalize) . . . . . . . . . . . . . . . . . . . 52
2.1.21 Is Rational Number (ratnump) . . . . . . . . . . . . . . . 53
2.1.22 Print Message Rational (ratprint) . . . . . . . . . . . . . 53
2.1.23 Numerical Status (statsnumer) . . . . . . . . . . . . . . . 53
3 Conditions 55
3.1 Linear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.1.1 If Statement (if) . . . . . . . . . . . . . . . . . . . . . . . 55
3.1.2 If-Else Statement (if-else) . . . . . . . . . . . . . . . . . . 56
3.2 Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.2.1 For Statement (for) . . . . . . . . . . . . . . . . . . . . . 56
3.2.2 Do Statement (do) . . . . . . . . . . . . . . . . . . . . . . 57
3.2.3 While Statement (while) . . . . . . . . . . . . . . . . . . . 57
4 Arithmetic 59
4.1 Arithmatic Functions . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.1.1 Absolute Number (abs) . . . . . . . . . . . . . . . . . . . 59
4.1.2 Summation of Terms (sum) . . . . . . . . . . . . . . . . . 59
4.1.3 Numerical Summation of Terms (nusum) . . . . . . . . . 60
4.1.4 Numerical Factor of Algebraic Fraction (numfactor) . . . 60
4.1.5 Product of Terms (product) . . . . . . . . . . . . . . . . . 61

CONTENTS 7
4.1.6 Maximum Value (max) . . . . . . . . . . . . . . . . . . . 61
4.1.7 Minimum Value (min) . . . . . . . . . . . . . . . . . . . . 61
4.1.8 Modulo (mod) . . . . . . . . . . . . . . . . . . . . . . . . 62
4.1.9 Square Root (sqrt) . . . . . . . . . . . . . . . . . . . . . . 62
4.1.10 Sorting Elements (sort) . . . . . . . . . . . . . . . . . . . 62
4.1.11 Simplification Environment (simp) . . . . . . . . . . . . . 62
5 Algebra 63
5.1 Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.1.1 Algebraic Evaluation (algebraic) . . . . . . . . . . . . . . 63
5.1.2 Solving Linear Equation (solve) . . . . . . . . . . . . . . . 63
5.1.3 Simplify Logs, Exponent & Radicals (radcan) . . . . . . . 64
5.1.4 Radical Expansion (radexpand) . . . . . . . . . . . . . . . 64
5.1.5 Rational Simplification (ratsimp) . . . . . . . . . . . . . . 64
5.1.6 Rationalized Simplification Flag (ratsimpexpons) . . . . . 65
5.1.7 Evaluation of Expression in Environment (ev) . . . . . . . 65
5.1.8 Evaluation of Expression (eval) . . . . . . . . . . . . . . . 66
5.1.9 Expansion of Algebraic Relations (expand) . . . . . . . . 66
5.2 Inequality & Polynomial . . . . . . . . . . . . . . . . . . . . . . . 66
5.2.1 Equality (equal) . . . . . . . . . . . . . . . . . . . . . . . 66
5.2.2 Inequality (notequal) . . . . . . . . . . . . . . . . . . . . . 67
5.2.3 Solve Algebraic Polynomials (algsys) . . . . . . . . . . . . 67
5.2.4 Solve Linear Equations (linsolve) . . . . . . . . . . . . . . 68
5.2.5 Check The Stat Of Database (is) . . . . . . . . . . . . . . 68
5.2.6 Check The Stat Of Database (maybe) . . . . . . . . . . . 68
5.2.7 Algebraic Substitution (subst) . . . . . . . . . . . . . . . 69
6 Logarithm 71
6.0.8 Expoential (exp) . . . . . . . . . . . . . . . . . . . . . . . 71
6.0.9 Logarithm (log) . . . . . . . . . . . . . . . . . . . . . . . . 71
6.0.10 Absolute Logarithm (logabs) . . . . . . . . . . . . . . . . 71
6.0.11 Arc Logarithm (logarc) . . . . . . . . . . . . . . . . . . . 71
6.0.12 logconcoeffp . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.0.13 logcontract . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.0.14 Logarithmic Expansion (logexpand) . . . . . . . . . . . . 71
6.0.15 lognegint . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.0.16 Logarithmic Numerical Value (lognumer) . . . . . . . . . 71
6.0.17 Logarithmic Simplification (logsimp) . . . . . . . . . . . . 71
7 Calculus 73
7.1 Limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.1.1 Finding Limit (limit) . . . . . . . . . . . . . . . . . . . . . 73
7.1.2 Limit Substitution (limsubst) . . . . . . . . . . . . . . . . 73
7.1.3 Limit By Taylor Series (tlimit) . . . . . . . . . . . . . . . 73
7.1.4 Taylor Limit Switch (tlimswitch) . . . . . . . . . . . . . . 74
7.2 Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

8 CONTENTS
7.2.1 Derivative of a Function (diff) . . . . . . . . . . . . . . . . 74
7.2.2 Partial Drivative (gradef) . . . . . . . . . . . . . . . . . . 76
7.2.3 Total Differential (del) . . . . . . . . . . . . . . . . . . . . 76
7.2.4 Dependence of Function (depends) . . . . . . . . . . . . . 77
7.2.5 Show Dependencies (dependencies) . . . . . . . . . . . . . 77
7.2.6 Notation of Derivative (derivabbrev) . . . . . . . . . . . . 77
7.2.7 Value of Function at a Point (atvalue) . . . . . . . . . . . 78
7.2.8 Degree of Derivative (derivdegree) . . . . . . . . . . . . . 78
7.2.9 Partial Derivative (express) . . . . . . . . . . . . . . . . . 79
7.2.10 Selective Derivative (derivlist) . . . . . . . . . . . . . . . . 79
7.2.11 Substitution in Derivatives (derivsubst) . . . . . . . . . . 79
7.3 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.3.1 Anti Derivative of a Function (integrate) . . . . . . . . . . 79
7.3.2 Changing The Variable (changevar) . . . . . . . . . . . . 80
7.3.3 Double Integration (dblint) . . . . . . . . . . . . . . . . . 80
8 Ordinary Differential Equation 83
8.1 Boundary Value Problems . . . . . . . . . . . . . . . . . . . . . . 83
8.1.1 Boundary Value Problem (bc2) . . . . . . . . . . . . . . . 83
8.1.2 Linear Ordinary Differential Equations (desolve) . . . . . 84
8.1.3 Initial Value Problem of First Order (ic1) . . . . . . . . . 84
8.1.4 Initial Value Problem of Second Order (ic2) . . . . . . . . 85
8.2 ODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.2.1 Ordinary Deferential Equation of Second Order (ode2) . . 85
9 Trigonometric 87
9.1 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . 87
9.1.1 Sine (sin) . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.1.2 Cosine (cos) . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.1.3 Tangent (tan) . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.1.4 Cotangent (cot) . . . . . . . . . . . . . . . . . . . . . . . . 88
9.1.5 Secant (sec) . . . . . . . . . . . . . . . . . . . . . . . . . . 89
9.1.6 Cosecant (cosec) . . . . . . . . . . . . . . . . . . . . . . . 89
9.2 Hyperbolic Trigonometric Functions . . . . . . . . . . . . . . . . 89
9.2.1 Hyperbolic Sine (sinh) . . . . . . . . . . . . . . . . . . . . 89
9.2.2 Hyperbolic Cosine (cosh) . . . . . . . . . . . . . . . . . . 90
9.2.3 Hyperbolic Tangent (tanh) . . . . . . . . . . . . . . . . . 90
9.2.4 Hyperbolic Cotangent (coth) . . . . . . . . . . . . . . . . 90
9.2.5 Hyperbolic Secant (sech) . . . . . . . . . . . . . . . . . . 91
9.2.6 Hyperbolic Cosecant (csch) . . . . . . . . . . . . . . . . . 91
9.3 Inverse Trigonometric Functions . . . . . . . . . . . . . . . . . . 91
9.3.1 Inverse Sine (asin) . . . . . . . . . . . . . . . . . . . . . . 91
9.3.2 Inverse Cosine (acos) . . . . . . . . . . . . . . . . . . . . . 91
9.3.3 Inverse Tangent (atan) . . . . . . . . . . . . . . . . . . . . 92
9.3.4 Inverse Tangent Type Two (atan2) . . . . . . . . . . . . . 92
9.3.5 Inverse Cotangent (acot) . . . . . . . . . . . . . . . . . . . 92

CONTENTS 9
9.3.6 Inverse Secant (asec) . . . . . . . . . . . . . . . . . . . . . 93
9.3.7 Inverse Cosecant (acsc) . . . . . . . . . . . . . . . . . . . 93
9.4 Inverse Hyperbolic Trigonometric Functions . . . . . . . . . . . . 93
9.4.1 Inverse Hyperbolic Sine (asinh) . . . . . . . . . . . . . . . 93
9.4.2 Inverse Hyperbolic Cosine (acosh) . . . . . . . . . . . . . 94
9.4.3 Inverse Hyperbolic Tangent (atanh) . . . . . . . . . . . . 94
9.4.4 Inverse Hyperbolic Cotangent (acoth) . . . . . . . . . . . 95
9.4.5 Inverse Hyperbolic Secant (asech) . . . . . . . . . . . . . 95
9.4.6 Inverse Hyperbolic Cosecant (acsch) . . . . . . . . . . . . 95
9.5 Trigonometric Identities . . . . . . . . . . . . . . . . . . . . . . . 96
9.5.1 Half Angle (halfangles) . . . . . . . . . . . . . . . . . . . 96
9.5.2 Expansion of Trigonometric Functions (trigexpand) . . . . 96
9.5.3 Sum of Arguments (trigexpandplus) . . . . . . . . . . . . 97
9.5.4 Product of Arguments (trigexpandtimes) . . . . . . . . . 97
9.5.5 Inverse Sequence Flag (triginverses) . . . . . . . . . . . . 98
9.5.6 Expansion of Rational Fractions (trigrat) . . . . . . . . . 98
9.5.7 Reduce Trigonometric Expressions (trigreduce) . . . . . . 99
9.5.8 Negative Arguments Simplification (trigsign) . . . . . . . 99
9.5.9 Trigonometric Simplification (trigsimp) . . . . . . . . . . 99
9.5.10 Demoivre Expansion (demoivre) . . . . . . . . . . . . . . 99
10 Matrix 101
10.1 Mathematical Operaton . . . . . . . . . . . . . . . . . . . . . . . 101
10.1.1 Matrix (matrix) . . . . . . . . . . . . . . . . . . . . . . . 101
10.1.2 Scalar Addition of Matrices (+) . . . . . . . . . . . . . . . 101
10.1.3 Scalar Subtraction of Matrices (-) . . . . . . . . . . . . . 102
10.1.4 Scalar Multiplication of Matrices (*) . . . . . . . . . . . . 102
10.1.5 Scalar Division of Matrix (/) . . . . . . . . . . . . . . . . 103
10.1.6 Exponent of Matrix (ˆ) . . . . . . . . . . . . . . . . . . . 103
10.1.7 Matrix Dot Product (.) . . . . . . . . . . . . . . . . . . . 104
10.2 Inverse of Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10.2.1 Invert of Matrix Elements (Aˆ-1) . . . . . . . . . . . . . . 105
10.2.2 Inverse of a Matrix (Aˆˆ-1) . . . . . . . . . . . . . . . . . 105
10.2.3 Append Columns (addcol) . . . . . . . . . . . . . . . . . . 105
10.2.4 Append Rows (addrow) . . . . . . . . . . . . . . . . . . . 106
10.2.5 Ajoint of Matrix (adjoint) . . . . . . . . . . . . . . . . . . 106
10.2.6 Augmented Matrix (augcoefmatrix) . . . . . . . . . . . . 106
10.2.7 Cauchy Matrix (cauchy matrix) . . . . . . . . . . . . . . . 107
10.2.8 Characteristics Polynomial (charpoly) . . . . . . . . . . . 108
10.2.9 Coefficient Matrix (coefmatrix) . . . . . . . . . . . . . . . 108
10.2.10 Columns of Matrix (col) . . . . . . . . . . . . . . . . . . . 108
10.2.11 Column Vectors (columnvector) . . . . . . . . . . . . . . . 109
10.2.12 Copy Matrix (copymatrix) . . . . . . . . . . . . . . . . . . 109
10.2.13 Determinant Of Matrix (determinant) . . . . . . . . . . . 109
10.2.14 Determinant As Fraction (detout) . . . . . . . . . . . . . 109
10.2.15 Diagonal Matrix (diagmatrix) . . . . . . . . . . . . . . . . 110

10 CONTENTS
10.2.16 Do All Matrix Operations (doallmxops) . . . . . . . . . . 110
10.2.17 Do Exponent Operations (domxexpt) . . . . . . . . . . . 110
10.2.18 Do Matrix-Matrix Operations (domxmxops) . . . . . . . . 110
10.2.19 Do Matrix Products (domxnctimes) . . . . . . . . . . . . 110
10.2.20 Do Not Factorize (dontfactor) . . . . . . . . . . . . . . . . 110
10.2.21 Do Scalar Matrix Operations (doscmxops) . . . . . . . . . 111
10.2.22 Do Scalar Matrix Operation as Matrix (doscmxplus) . . . 111
10.2.23 Product of Zero & Non-Scalar Term (dot0nscsimp) . . . . 111
10.2.24 Product of Zero & Scalar Term (dot0simp) . . . . . . . . 111
10.2.25 Product of One & Other Term (dot1simp) . . . . . . . . . 111
10.2.26 Associative of Dot Product (dotassoc) . . . . . . . . . . . 111
10.2.27 Product of Constant & Other Term (dotconstrules) . . . . 111
10.2.28 Distribution in Dot Product (dotdistrib) . . . . . . . . . . 111
10.2.29 Simplified to Exponent (dotexptsimp) . . . . . . . . . . . 111
10.2.30 Zero Exponsnt (dotident) . . . . . . . . . . . . . . . . . . 112
10.2.31 Dot Screw Rules (dotscrules) . . . . . . . . . . . . . . . . 112
10.3 Matrix Characteristics . . . . . . . . . . . . . . . . . . . . . . . . 112
10.3.1 Echelon Form of Matrix (echelon) . . . . . . . . . . . . . 112
10.3.2 Eigenvalues (eivals) . . . . . . . . . . . . . . . . . . . . . . 112
10.3.3 Eigenvectors (eivects) . . . . . . . . . . . . . . . . . . . . 113
10.3.4 Except Matrix (ematrix) . . . . . . . . . . . . . . . . . . . 113
10.3.5 User Matrix (entermatrix) . . . . . . . . . . . . . . . . . . 113
10.3.6 Generate Matrix (genmatrix) . . . . . . . . . . . . . . . . 114
10.3.7 Identity Matrix (ident) . . . . . . . . . . . . . . . . . . . . 114
10.3.8 Inverse Matrix (invert) . . . . . . . . . . . . . . . . . . . . 114
10.3.9 List Elements of Matrix (listmatrixentries) . . . . . . . 115
10.3.10 Left Side Delimiter (lmxchar) . . . . . . . . . . . . . . . . 115
10.3.11 Right Side Delimiter (rmxchar) . . . . . . . . . . . . . . . 115
10.3.12 Adjoin Matrix (adjoin) . . . . . . . . . . . . . . . . . . . . 115
10.3.13 Transpose of a Matrix (transpose) . . . . . . . . . . . . . 115
10.3.14 Mapping of Matrix (matrixmap) . . . . . . . . . . . . . . 116
10.3.15 Expression As Matrix (matrixp) . . . . . . . . . . . . . . 116
10.3.16 Trace of Matrix (mattrace) . . . . . . . . . . . . . . . . . 116
10.3.17 Minor of Matrix (minor) . . . . . . . . . . . . . . . . . . . 116
10.3.18 Determinant of Matrix (newdet) . . . . . . . . . . . . . . 117
10.3.19 Permanent of Matrix (permanent) . . . . . . . . . . . . . 117
10.3.20 Rank of Matrix (rank) . . . . . . . . . . . . . . . . . . . . 117
10.3.21 Rationalize to Matrix (ratmx) . . . . . . . . . . . . . . . . 117
10.3.22 Row of Matrix (row) . . . . . . . . . . . . . . . . . . . . . 117
10.3.23 Solve To Scalar Matrix (scalarmatrixp) . . . . . . . . . . 118
10.3.24 Sub Matrix (submatrix) . . . . . . . . . . . . . . . . . . . 118
10.3.25 Triangularization of Matrix (triangularize) . . . . . . . . . 118
10.3.26 Zero Matix (zeromatrix) . . . . . . . . . . . . . . . . . . . 118
10.3.27 Matrix Element Transpose (matrixelementtranspose) . . 118
10.3.28 Matrix Element Multiplication (matrixelementmult) . . 119
10.3.29 Matrix Element Addition (matrixelementadd) . . . . . . 119

CONTENTS 11
10.4 Solution of Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11 Array 121
12 Special Functions 123
12.1 airy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.1.1 airyai . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.1.2 airybi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.1.3 airydai . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.1.4 airydbi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.2 Bessel Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.2.1 Bessel Function of First Kind (besselj) . . . . . . . . . . 123
12.2.2 Bessel Function of Second Kind (bessely) . . . . . . . . . 124
12.2.3 Hyperbolic Bessel Function of First Kind (besseli) . . . . 124
12.2.4 Hyperbolic Bessel Function of Second Kind (besselk) . . 125
12.2.5 Expansion of Bessel Function (besselexpand) . . . . . . . 125
12.3 Beta Function (beta) . . . . . . . . . . . . . . . . . . . . . . . . . 125
12.4 Gamma Function (gamma) . . . . . . . . . . . . . . . . . . . . . 126
12.5 Euler Function (euler) . . . . . . . . . . . . . . . . . . . . . . . . 126
12.6 Error Function (erf) . . . . . . . . . . . . . . . . . . . . . . . . . 127
12.7 Laplace Transform (laplace) . . . . . . . . . . . . . . . . . . . . . 127
12.7.1 Inverse Laplace Transform (ilt) . . . . . . . . . . . . . . . 127
12.8 Lagrange Polynomial (lagrange) . . . . . . . . . . . . . . . . . . . 128
12.9 Laguerre Polynomial (laguerre) . . . . . . . . . . . . . . . . . . . 128
12.10Legendre Polynomial . . . . . . . . . . . . . . . . . . . . . . . . . 128
12.10.1 Legendre Polynomial of First Kind(legendrep) . . . . . . 129
12.10.2 Legendre Polynomial of Second Kind(legendreq) . . . . . 129
12.11Jacobians . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.1 jacobi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.2 jacobicd . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.3 jacobicn . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.4 jacobics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.5 jacobidc . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.6 jacobidn . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.7 jacobids . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.8 jacobinc . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.9 jacobind . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.10jacobins . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.11jacobip . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.12jacobisc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.13jacobisd . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.14jacobisn . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.15inversejacobicd . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.16inversejacobicn . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.17inversejacobics . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.18inversejacobidc . . . . . . . . . . . . . . . . . . . . . . . 130

12 CONTENTS
12.11.19inversejacobidn . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.20inversejacobids . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.21inversejacobinc . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.22inversejacobind . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.23inversejacobins . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.24inversejacobisc . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.25inversejacobisd . . . . . . . . . . . . . . . . . . . . . . . 130
12.11.26inversejacobisn . . . . . . . . . . . . . . . . . . . . . . . 130
12.12fourier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.12.1 fourint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.12.2 fourintcos . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.12.3 fourintsin . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.12.4 foursimp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.12.5 foursin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13elliptic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13.1 elliptice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13.2 ellipticec . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13.3 ellipticeu . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13.4 ellipticf . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13.5 elliptickc . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
12.13.6 ellipticpi . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
13 Graphics 131
13.1 Contour Plot (contourplot) . . . . . . . . . . . . . . . . . . . . . 131
13.2 Plotting 2D Plot (plot2d) . . . . . . . . . . . . . . . . . . . . . . 132
13.3 Three Dimensional Plotting (plot3d) . . . . . . . . . . . . . . . . 133
13.4 Finding Plot Options (plotoptions) . . . . . . . . . . . . . . . . 133
13.5 Set Plot Options (setplotoption) . . . . . . . . . . . . . . . . . 135
13.6 Spherical To Cartesian (sphericaltoxyz) . . . . . . . . . . . . . 136
14 Binary Operations 137
14.1 AND Operation (and) . . . . . . . . . . . . . . . . . . . . . . . . 137
14.2 OR Operation (or) . . . . . . . . . . . . . . . . . . . . . . . . . . 137
14.3 NOT Operation (not) . . . . . . . . . . . . . . . . . . . . . . . . 137
15 File Operations 139
15.1 Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
15.1.1 Append Console Transcript to File (appendfile) . . . . . . 139
15.1.2 Read File & Evaluate (batch) . . . . . . . . . . . . . . . . 139
15.1.3 Type of File (filetype) . . . . . . . . . . . . . . . . . . . . 139
15.1.4 Evaluation From File From Directory (load) . . . . . . . . 140
15.1.5 Evaluation From File (loadfile) . . . . . . . . . . . . . . . 140
15.1.6 File Load Path Name (loadpathname) . . . . . . . . . . . 140
15.1.7 File Load Print Message (loadprint) . . . . . . . . . . . . 140
15.1.8 Show File Contents In Console (printfile) . . . . . . . . . 140
15.1.9 Evaluates Expression From File (batchload) . . . . . . . . 140

CONTENTS 13
15.2 Writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
15.2.1 Write Transcript in File (writefile) . . . . . . . . . . . . . 141
15.2.2 Write Expressions to File (stringout) . . . . . . . . . . . . 141
15.2.3 file outputappend . . . . . . . . . . . . . . . . . . . . . . 141
15.2.4 Write Output To a File (withstdout) . . . . . . . . . . . 141
15.2.5 Save A File (save) . . . . . . . . . . . . . . . . . . . . . . 142
15.2.6 Close Opened File (closefile) . . . . . . . . . . . . . . . . 142
15.3 Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
15.3.1 filesearch . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
15.3.2 filesearchdemo . . . . . . . . . . . . . . . . . . . . . . . 143
15.3.3 filesearchmaxima . . . . . . . . . . . . . . . . . . . . . . 143
15.3.4 filesearchusage . . . . . . . . . . . . . . . . . . . . . . . 143
15.3.5 filesearchlisp . . . . . . . . . . . . . . . . . . . . . . . . . 143
15.3.6 filesearchtests . . . . . . . . . . . . . . . . . . . . . . . . 144
15.3.7 filetypelisp . . . . . . . . . . . . . . . . . . . . . . . . . . 144
15.4 Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
15.4.1 filetypemaxima . . . . . . . . . . . . . . . . . . . . . . . 144
15.4.2 pathnamedirectory . . . . . . . . . . . . . . . . . . . . . 144
15.4.3 pathnamename . . . . . . . . . . . . . . . . . . . . . . . 144
15.4.4 pathnametype . . . . . . . . . . . . . . . . . . . . . . . . 145
16 Polynomial 147
16.1 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
16.1.1 All Roots of Polynomial (allroots) . . . . . . . . . . . . . 147
16.1.2 All Big Float Roots of Polynomial (bfallroots) . . . . . . 147
16.1.3 All Roots Within Limits (nroots) . . . . . . . . . . . . . . 148
16.1.4 Nth Root of Base (nthroot) . . . . . . . . . . . . . . . . . 148
16.1.5 Real Roots (realroots) . . . . . . . . . . . . . . . . . . . . 148
16.2 Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
16.2.1 Separation of Coefficients (bothcoef) . . . . . . . . . . . . 149
16.2.2 Coefficient of Term (coeff) . . . . . . . . . . . . . . . . . . 149
16.2.3 Divide Expression (divide) . . . . . . . . . . . . . . . . . . 149
16.2.4 Eliminate Variables (eliminate) . . . . . . . . . . . . . . . 150
16.2.5 Factor of Expression (factor) . . . . . . . . . . . . . . . . 150
16.2.6 Rearrange Factors (factorout) . . . . . . . . . . . . . . . . 151
16.2.7 Rearrange Factors of Sum (factorsum) . . . . . . . . . . . 151
16.2.8 Greatest Common Divisor (gcd) . . . . . . . . . . . . . . 151
16.2.9 Greatest Common Divisor (gcdex) . . . . . . . . . . . . . 152
16.2.10 Gaussian Factor (gfactor) . . . . . . . . . . . . . . . . . . 152
16.2.11 Highest Power (hipow) . . . . . . . . . . . . . . . . . . . . 152
16.2.12 Lowest Power (lopow) . . . . . . . . . . . . . . . . . . . . 152
16.2.13 Return The Coefficient (ratcoef) . . . . . . . . . . . . . . 152
16.2.14 Remainder (remainder) . . . . . . . . . . . . . . . . . . . 153
16.3 Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
16.3.1 rat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
16.3.2 Return Denominator (ratdenom) . . . . . . . . . . . . . . 153

14 CONTENTS
16.3.3 Expand Ratio (ratdenomdivide) . . . . . . . . . . . . . . 153
16.3.4 Derivative of Rational Number (ratdiff) . . . . . . . . . . 153
16.3.5 Rational Expansion (ratexpand) . . . . . . . . . . . . . . 153
16.3.6 Rational Factor (ratfac) . . . . . . . . . . . . . . . . . . . 153
16.3.7 Is Rational (ratp) . . . . . . . . . . . . . . . . . . . . . . . 153
16.3.8 Rational Simplification (ratsimp) . . . . . . . . . . . . . . 154
16.3.9 Simplify Rational Exponent (ratsimpexpons) . . . . . . . 154
16.3.10 Rational Substitution (ratsubst) . . . . . . . . . . . . . . 154
16.3.11 Resultant (resultant) . . . . . . . . . . . . . . . . . . . . . 154
17 power series 155
17.1 Binomial Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
17.1.1 Define Taylor Function (deftaylor) . . . . . . . . . . . . . 155
17.1.2 Max Taylor Order (maxtayorder) . . . . . . . . . . . . . . 155
17.1.3 Power Series (powerseries) . . . . . . . . . . . . . . . . . . 155
17.1.4 Taylor Series (taylor) . . . . . . . . . . . . . . . . . . . . . 156
17.1.5 taylor logexpand . . . . . . . . . . . . . . . . . . . . . . . 156
17.1.6 taylorordercoefficients . . . . . . . . . . . . . . . . . . . 157
17.1.7 taylorsimplifier . . . . . . . . . . . . . . . . . . . . . . . . 157
17.1.8 taylortruncatepolynomials . . . . . . . . . . . . . . . . . 157
17.1.9 Depth of Taylor Terms (taylordepth) . . . . . . . . . . . . 157
17.1.10 Info of Taylor Series (taylorinfo) . . . . . . . . . . . . . . 157
17.1.11 Check Series as Taylor (taylorp) . . . . . . . . . . . . . . 157
17.1.12 Print Power Series Message (verbose) . . . . . . . . . . . 157
17.1.13 Integer to Poisson (intopois) . . . . . . . . . . . . . . . . 157
17.1.14 outofpois . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
17.2 Poisson Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
17.2.1 Poisson Differentiation (poisdiff) . . . . . . . . . . . . . . 158
17.2.2 Poisson Exponent (poisexpt) . . . . . . . . . . . . . . . . 158
17.2.3 Poisson Integration (poisint) . . . . . . . . . . . . . . . . 158
17.2.4 Poisson Limit (poislim) . . . . . . . . . . . . . . . . . . . 158
17.2.5 Poisson Plus (poisplus) . . . . . . . . . . . . . . . . . . . 159
17.2.6 Poisson Simplification (poissimp) . . . . . . . . . . . . . . 159
17.2.7 Poisson Substitution (poissubst) . . . . . . . . . . . . . . 159
17.2.8 Poisson Multiplicaiton (poistimes) . . . . . . . . . . . . . 159
17.2.9 Print Poisson Series (printpois) . . . . . . . . . . . . . . . 159
18 Sets 161
18.1 Properties of Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
18.1.1 Distinct Elements of The Set (cardinality) . . . . . . . . . 161
18.1.2 Disjoin of Sets (disjoin) . . . . . . . . . . . . . . . . . . . 161
18.1.3 Disjoint Sets (disjointp) . . . . . . . . . . . . . . . . . . . 162
18.1.4 Element of a Set (elementp) . . . . . . . . . . . . . . . . . 162
18.1.5 Empty Set (emptyp) . . . . . . . . . . . . . . . . . . . . . 162
18.1.6 External Subset (extremalsubset) . . . . . . . . . . . . . 162
18.1.7 flatten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

CONTENTS 15
18.1.8 fulllistify . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
18.1.9 List From a Set (listify) . . . . . . . . . . . . . . . . . . . 162
18.1.10 Construct a Set (makeset) . . . . . . . . . . . . . . . . . . 163
18.1.11 Partition of Set (partitionset) . . . . . . . . . . . . . . . 163
18.1.12 Ordered Permutations of a Set (permutations) . . . . . . 163
18.1.13 Random Permutation (randompermutation) . . . . . . . 163
18.1.14 Check Set Equality (setequalp) . . . . . . . . . . . . . . . 164
18.1.15 Check For argument as Set (setp) . . . . . . . . . . . . . 164
18.2 Operations On Sets . . . . . . . . . . . . . . . . . . . . . . . . . . 164
18.2.1 Maximum Element Value of a Set (lmax) . . . . . . . . . 164
18.2.2 Minimum Element Value of a Set (lmin) . . . . . . . . . . 164
18.2.3 Sub Set (subset) . . . . . . . . . . . . . . . . . . . . . . . 165
18.2.4 Predicate Subset (subsetp) . . . . . . . . . . . . . . . . . 165
18.2.5 Symmentric Difference (symmdifference) . . . . . . . . . . 165
18.2.6 Subtraction of Sets (setdifference) . . . . . . . . . . . . . 165
18.2.7 Cartesian Product (cartesianproduct) . . . . . . . . . . . 165
18.2.8 Intersection of Sets (intersection) . . . . . . . . . . . . . . 166
18.2.9 Power Set (powerset) . . . . . . . . . . . . . . . . . . . . . 166
18.2.10 Union Of Sets (union) . . . . . . . . . . . . . . . . . . . . 166
19 Statistics 167
19.1 Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
19.1.1 Bar Plot of Data (barsplot) . . . . . . . . . . . . . . . . . 167
19.1.2 Error Box Plot of Data (boxplot) . . . . . . . . . . . . . . 168
19.1.3 Stem Plot (stemplot) . . . . . . . . . . . . . . . . . . . . . 168
19.1.4 Pie Chart (piechart) . . . . . . . . . . . . . . . . . . . . . 168
19.1.5 Scatterin Plot of Data (scatterplot) . . . . . . . . . . . . . 168
19.1.6 Asterisk Plot of Data (starplot) . . . . . . . . . . . . . . . 168
19.1.7 Histogram Plot (histogram) . . . . . . . . . . . . . . . . . 168
19.2 Regression & Correlation . . . . . . . . . . . . . . . . . . . . . . 168
19.2.1 Building a Sample (buildsample) . . . . . . . . . . . . . . 168
19.2.2 Correlation (cor) . . . . . . . . . . . . . . . . . . . . . . . 168
19.2.3 Covariance Matrix (cov) . . . . . . . . . . . . . . . . . . . 168
19.2.4 Covariance of Type One (cov1) . . . . . . . . . . . . . . . 169
19.2.5 Coefficient Variation (cv) . . . . . . . . . . . . . . . . . . 169
19.2.6 List Correlation (listcorrelations) . . . . . . . . . . . . . 169
19.3 Mean, Median & Deviation . . . . . . . . . . . . . . . . . . . . . 169
19.3.1 Average or Mean (mean) . . . . . . . . . . . . . . . . . . 169
19.3.2 Mean Deviation (meandeviation) . . . . . . . . . . . . . 170
19.3.3 Median (median) . . . . . . . . . . . . . . . . . . . . . . . 170
19.3.4 Deviation from Median (mediandeviation) . . . . . . . . 171
19.3.5 Continuous Frequency (continuousfreq) . . . . . . . . . . 171
19.3.6 Discrete Frequency (discretefreq) . . . . . . . . . . . . . 171
19.3.7 Geometric Means (geometricmean) . . . . . . . . . . . . 171
19.3.8 Harmonic Mean (harmonicmean) . . . . . . . . . . . . . 172
19.3.9 Range of Data (range) . . . . . . . . . . . . . . . . . . . . 172

16 CONTENTS
19.3.10 Maximum Value of Sample List (smax) . . . . . . . . . . 172
19.3.11 Minimum Value of Sample List (smin) . . . . . . . . . . . 173
19.3.12 Standard Deviation (std) . . . . . . . . . . . . . . . . . . 173
19.3.13 Standard Deviation Type One (std1) . . . . . . . . . . . . 173
19.3.14 Transforming Samples (tranform sample) . . . . . . . . . 173
19.3.15 Variance (var) . . . . . . . . . . . . . . . . . . . . . . . . 173
19.3.16 Variance of Type One (var1) . . . . . . . . . . . . . . . . 174
19.4 Skew, Kurosis & Moment . . . . . . . . . . . . . . . . . . . . . . 174
19.4.1 Skewness of Data (skewness) . . . . . . . . . . . . . . . . 174
19.4.2 Pearson Skewness (pearsonskewness) . . . . . . . . . . . 175
19.4.3 Quartile Skewness (quartileskewness) . . . . . . . . . . . 175
19.4.4 Kurtosis (kurtosis) . . . . . . . . . . . . . . . . . . . . . . 175
19.4.5 noncentralmoment . . . . . . . . . . . . . . . . . . . . . . 176
19.4.6 Central Moment of Data (centralmoment) . . . . . . . . 176

Part I
Maxima Commands
17

Chapter 1
Maxima Core
1.1 Mathematical
1.1.1 Factorial Symbol (!)
It represents to the factorial operator. An! represents the factorial ofnin form
ofn×(n−1)×. . .×3×2×1. Factorial of negative number is infinity.

1(%i1) 5!

The output is

(%o1) 120

Factorial of a fraction number in three place precision is

1(%i1) 0.5!

The output is

(%o1) 0.886

Factorial of 0.5! is

π/2.
1.1.2 Double Factorial Symbol (!!)
It represents to the double factorial operator. An!! represents the factorial
in form ofn×(n−2)×. . .×5×3×1. Ifnis an odd number otherwise
n×(n−2)×. . .×4×2 ifnis an even number.

1(%i1) 5!!

The output is

(%o1) 15

19

20 CHAPTER 1. MAXIMA CORE
1.1.3 Termination of Line (;)
Symbol ‘;’ (colon) is used to terminate a line in Maxima console. Every thing
written after the symbol ‘;’ is treated as comments and it is skipped by Maxima
during evaluation of transcript.

1(%i1) 5!!; double factorial

The output is

(%o1) 15

1.1.4 Negation of Expression (#)
#represents negation of syntactic equality. Note that because ofthe rules for
evaluation of predicate expressions “nota = b” is equivalent tois(a # b)instead
of “a # b”.
1.1.5 Evaluate Internally & No Output ($)
$restrict the evaluation of expression internally and the result is notprinted in
output console. This operator is always post fixed to transcripts.The syntax is

1(%i1) <transcript>$

For example

1(%i1)matrix([1,2],[3,4])$

will be evaluated internally and there is no output in console. Remember that
this symbol must not followed by any string or digits or comments.
1.1.6 Do Not Execute Function (’)
If a function is prefixed with (’) then function is not executed. It just returns
the argument.

1(%i1)’integrate(x,x)

The output is
(%o1)
Z
x dx
and function without prefix with (’)

1(%i2)integrate(x,x)

1.1. MATHEMATICAL 21
The output is
(%o2)
x
2
2
1.1.7 Re-evaluation of Specific Input (“)
The double single quote (“) provides re-evaluation of specific input once again.
For example, to evaluate the first input (%i1) once again as fourth input (%i4),
use syntax like

1(%i4)’’%i1

Example is

1(%i2)integrate(x, x);
(%i3)integrate(x^2, x);
3(%i4)integrate(x^3, x);
(%i5)’’%i2

The output is
(%o2)
x
2
2
(%o3)
x
3
3
(%o4)
x
4
4
(%o5)
x
2
2
1.1.8 Variable Assigning Operator (:)
It assign a value to a variable.

(%i4) a:2

It sets ‘2’ to variable ‘a’.
1.1.9 Operator Assigner (::)
::is similar to the:but it differs to:by evaluation method.:evaluates only
left hand side but::evaluates left hand side as well as right hand side.

22 CHAPTER 1. MAXIMA CORE

1(%i4) y:[a,b,c];%initializing operators
(%i5) y::[10,11,12];%initializing values
3(%i6) a;%call operator ’a’


(%o4) 10

1.1.10 Macro Function Definition Operator (::=)
::=defines a function which quotes its arguments, and the expressionwhich it
returns is evaluated in the context from which the macro was called.

1(%i4) g(x)::=x/99;
(%i5) g(9999);


(%o5) 101

1.1.11 Function Operator (:=)
:=is used to initialize a function.:=never evaluates the function body. The
syntax for function operator is like

1(%i4) <function name>(<independent variable>):=<function body>

For example

1(%i4) f(x):=sin(x)

(%o4)f(x) := sin(x)
To call the function use following syntax.

1(%i4) f(<independent variable value>)

If user defined function body consists in-build functions then result is just sym-
bolic otherwise it gives numeric result. For example

1(%i4) f(x):=sin(x);
(%i5) f(10);

(%o5) sin(10)
To get the numerical result rather than symbolic result then the syntax becomes
like

1.1. MATHEMATICAL 23

(%i4) f(x):=sin(x);
2(%i5) ev(f(10),numer);


(%o5) -0.54402111088937

defineis also used to define a function. Its syntax is

1(%i4) define(<user define function>, <function body>);

1.1.12 Sum Operator (+)
It is arithmetic additive symbol. It is used to add two or more variables. If
variables are previously assigned the values then variables are replaced by their
corresponding values and resultant sum is printed in output otherwise symbolic
addition is obtained at output. It performs algebraic sum operation. It is
commutative operator and can be used in an array. Maxima sorts operands
before applying ‘+’ operator. Among ‘+’, ‘-’, ‘/’ and ‘*’, it has third highest
priority during arithmetic calculations. Scope of operator must be specified by
using parenthesis brackets.

1(%i4) 10+11


(%o4) 21

Another example is

1(%i4) a:10;
(%i5) a+b

(%o5)b+ 10
1.1.13 Subtraction Operator (-)
It is arithmetic subtraction symbol. It is used to subtract two or more variables.
If variables are previously assigned values then variables are replaced by their
corresponding values and resultant subtraction is printed in output otherwise
symbolic subtraction is obtained at output. It performs algebraic subtraction
operation. It is not a commutative operator. Among ‘+’, ‘-’, ‘/’ and ‘*’,it has
fourth highest priority during arithmetic calculations. Scope of operator must
be specified by using parenthesis brackets.

(%i4) 10-11

24 CHAPTER 1. MAXIMA CORE
(%o4) −1
Another example is

1(%i4) a:10;
(%i5) a-b

(%o5) −b+ 10
1.1.14 Product Operator (*)
It is arithmetic multiplicative symbol. It is used to multiply two or more vari-
ables. If variables are previously assigned with values then variablesare replaced
by their corresponding values and resultant multiplication is printed inoutput
otherwise symbolic multiplication is obtained at output. It is commutative op-
erator and can be used in an array. Maxima sorts operands beforeapplying ‘*’
operator. Among ‘+’, ‘-’, ‘/’ and ‘*’, it has second highest priority during arith-
metic calculations. Scope of operator must be specified by using parenthesis
brackets.

(%i4) 10*11

(%o4) 110
Another example is

1(%i4) a:10;
(%i5) a*b

(%o5) 10b
1.1.15 Division Operator (/)
It is arithmetic division symbol. It is used to divide two variables. If variables
are previously assigned with values then variables are replaced by their corre-
sponding values and resultant division is printed in output otherwise symbolic
division is obtained at output. It is not a commutative operator. Among ‘+’,

1.1. MATHEMATICAL 25
‘-’, ‘/’ and ‘*’, it has highest priority during arithmetic calculations. Scope of
operator must be specified by using parenthesis brackets.

(%i4) 100/10

(%o4) 10
Another example is

1(%i4) a:10;
(%i5) a/b

(%o5)
10
b
1.1.16 Exponential Operator (ˆ)
It is arithmetic exponential symbol. It is used to raise the power by anumber
over the base value. It is binary and non-commutative operator. Grouping of
terms is required to limit the scope of the operator otherwise its scope is limited
to the succeeding terms only. If base and exponent are symbols then symbolic
output is obtained and if base and exponent are assigned numericalvalue then
variables are replaced by their corresponding numerical values.

(%i4) 10^2

(%o4) 100
Another example is

1(%i4) 10^(2^2);

(%o4) 10000

1(%i5) a^b;

(%o5)a
b

26 CHAPTER 1. MAXIMA CORE
1.1.17 Equal Operator (=)
=denotes an equation. It also represents to the equal boolean operator. In
algebraic equations, equal sign indicates that left hand side is equalto the right
hand side for specific values of independent variable. For example
2x+ 3y= 10
If we choosex= 2 andy= 2 then left hand side of above equation is equal to
the right hand side of the equation. Symbolically, ifa=bthen valuesaandb
are equal.
1.1.18 Less Than Operator (<)
It is mathematical operator that tells whether the left hand side is lesser than
the right hand side term.

1(%i4)is(a < b);


(%o4)unknown

If terms are purely number then answer is either “true’ or ‘false’.

1(%i4)is(1 < 2);


(%o4) true

1.1.19 Grater Than Operator (>)
It is mathematical operator that tells whether the left hand side is greater than
the right hand side term.

1(%i4)is(a > b);


(%o4)unknown

If terms are purely number then answer is either “true’ or ‘false’.

1(%i4)is(1 > 2);


(%o4) false

1.1. MATHEMATICAL 27
1.1.20 Less Than or Equals To Operator (<=)
It is mathematical operator that tells whether the left hand side is lesser than
or equals to the right hand side term.

1(%i4)is(a <=b);


(%o4)unknown

If terms are purely number then answer is either “true’ or ‘false’.

1(%i4)is(1 <=2);


(%o4) true

1.1.21 Greater Than or Equals To Operator (>=)
It is mathematical operator that tells whether the left hand side is greater than
or equals to the right hand side term.

1(%i4)is(a >=b);


(%o4)unknown

If terms are purely number then answer is either “true’ or ‘false’.

1(%i4)is(1 >=2);


(%o4) false

1.1.22 Lisp Name (?)
The function name which is prefixed by ‘?’ signifies that the name is a Lisp
name, not a Maxima name.
1.1.23 A List ([ ... ])
[ ... ]represents the beginning and end of a list or vector.

1(%i4) y:[a,b,c];%initializing operators as a list
(%i5) y::[10,11,12];%initializing values as a list
3(%i6) a;%call operator ’a’ from operator list


(%o4) 10

28 CHAPTER 1. MAXIMA CORE
1.1.24 Call Last Garbage (%)
Symbolic computation, tends to create a good deal of garbage (temporary or
intermediate results that are eventually not used), and effective handling of it
can be crucial to successful completion of some programs. Symbol % is used for
calling last garbage.

1(%i1) x^2+2$
(%i2) x^2-2$
3(%i3)solve(%); % calling last garbage

(%o3) [x=−

2x=

2]
If % is suffixed by garbage handle like ‘i1’, ‘i2’ or ‘o1’, ‘o2’ etc then specific
garbage can be called.

1(%i1) x^2+2$
(%i2) x^2-2$
3(%i3)solve(%i1); % calling first garbage

(%o3) [x=−

2i, x=

2i]
1.1.25 Previous Statement (%%)
In compound statements, namely block, lambda, or (s1, ..., sn), %% is the value
of the previous statement.
1.1.26 Exponential (%e)
It represents to the exponential base. The series expansion of ‘%e’ is
e
x
= 1 +
x
1!
+
x
2
2!
+
x
3
3!
+. . .
Ifx= 1 then above series becomes
e= 1 +
1
1!
+
1
2!
+
1
3!
+. . .
The numerical value of ‘%e’ lies between 2<%e <3 and actually it is ap-
proximately equals to ‘2.718281828459045’. Remember whenever you need to
substitute ‘%e’ with its numerical value, set ‘%enumer’ to true by using the
following syntax

1(%i1) %enumer:true;

1.1. MATHEMATICAL 29
1.1.27 %etonumlog
When%etonumlogis ‘true’,rsome rational number, andxsome expression,
%e
(rlogx)
will be simplified intox
r
.
y=e
rlogx
Taking logarithm both side with natural base
log
ey= log
ee
rlogx
or
log
e
y= logx
r
Taking antilogarithm
y=x
r
It should be noted that theradcancommand also does the same transformation,
and more complicated transformations of this as well. Thelogcontractcommand
“contracts” expressions containing logarithms. By default it is ‘false’.
1.1.28 Negative Exponent as a Quotient (%edispflag)
When%edispflagis ‘true’, Maxima displays%eto a negative exponent as a
quotient. For example, %e
−x
is displayed as 1/%e
x
. By default it is ‘false’.
1.1.29 Demoivre Mode (%emode)
If%emodeis ‘true’ then Demoivre relatione
nπi
is solved by using relation
e
ix
= cos(x) +isin(x)
Remember that ‘n’ must be a whole integer. ‘i’ represents to imaginary constant.
For example

1(%i1) %e^(5*%i*%pi)


(%o1) -1

1.1.30 Exponential Numerical (%enumer)
It controls that whether ‘%e’ is to be used in output or its numericalvalue. If
%enumeris ‘false’, ‘%e’ is used other wise its numerical value 2.718281828459045
is placed.

30 CHAPTER 1. MAXIMA CORE
1.1.31 Gamma Constant (%gamma)
It is an Euler-Mascheroni constant. Its numerical value is 0.5772156649015329.
It is defined as the limiting difference between the harmonic series andthe
natural logarithm
γ= lim
n→∞

n
X
k=1
1
k
−ln(n)
!
=
Z

1

1
⌊x⌋

1
x

dx
Here,⌊x⌋represents the floor function.
1.1.32 Pi Value (%pi)
%pirepresents to the exponential value and symbolically it is equal toπ. Nu-
merical value ofπis 3.141592653589793 approximately.

1(%i1)numer:true;
(%i2) %pi;


(%o1) 3.141592653589793

1.1.33 Previous Output (%th)
%threturns the value of previous output expression identified by a number from
the current output. If there are totalnoutputs in the current session thenm
th
previous output is the (n−m)
th
output from the begining of session. Syntax
for this function is

1(%i1) %th(<integer>)

1.1.34 Most Recent Expression ()
is the most recent input expression.

1(%i1)sin(%pi/2)$
(%i2):lisp$_;


(%o2) ((\%SIN) ((MQUOTIENT)$\%PI 2))

1.1.35 Display String (disp)
It displays only the value of the arguments rather than equations.This is useful
for complicated arguments which don’t have names or where only thevalue of
the argument is of interest and not the name. Remember that those inputs
which are only variables are post-fixed by symbol $. It instructs toMaxima to

1.2. ERRORS 31
accept the input as key-value like arguments rather than executeit and show
output. The key-value syntax may be in form of ‘key=value’ or ‘key:value’. If
dispexecuted successfully, “done” is returns as output by Maxima.

1(%i1) b[1,2]:x-x^2$
(%i2) x:123$
3(%i3) disp(x, b[1,2],sin(1.0));


123
x-x^2
0.8414709848078965
(%o3) done

1.2 Errors
1.2.1 Error (error)
The variableerroris set to a list describing the error. The first element of error
is a format string, which merges all the strings among the arguments supplied
toerrorfunction and the remaining elements are the values of any non-string
arguments. Syntax forerrorfunction is

(%i1) error(expr_1, ..., expr_n)

1.2.2 Error Size (errorsize)
errorsizemodifies error messages according to the size of expressions which
appear in them. If the size of an expression (as determined by the Lisp func-
tion ERROR-SIZE) is greater thanerrorsize, the expression is replaced in the
message by a symbol, and the symbol is assigned the expression. The symbols
are taken from the listerrorsyms. The default value oferrorsizeis ‘10’.
1.2.3 Error Symbol (errorsyms)
In error messages, expressions larger thanerrorsizeare replaced by symbols,
and the symbols are set to the expressions. The symbols are takenfrom the
listerrorsyms. The first too-large expression is replaced byerrorsyms[1], the
second byerrorsyms[2], and so on.
1.2.4 Error Message (errormsg)
Reprints the most recent error message. The variable error holdsthe message,
anderrormsgformats and prints it.

32 CHAPTER 1. MAXIMA CORE
1.2.5 Debug Mode Maxima (debugmode)
By default, Maxima does not debugs to any errors and mistakes. Toset the
debug mode true usedebugmodefunction like

1(%i4) debugmode(true)

It returns ‘true’ if debug mode is set to true otherwise returns false.
1.2.6 Show Examples (example)
It returns the method for using a function whose name is supplied asan argu-
ment. To see all the listed functions for functionexampleuse it like

1(%i1) example();

To see the example ofnrootsuse it like

1(%i1) example("nroots");

It returns the method of use of functionnroots. At the end of successful execu-
tion ofexamplefunction, “done” is printed in output console.
1.2.7 Set Numerical Precision (fpprec)
fpprecis used to set the decimal places of decimal numbers ie precision of nu-
merical output. The syntax is

1(%i1) fpprec : <integer for decimal places>;

For example

1(%i1) fpprec : 16

Now the outputs will have sixteen decimal places. If we want to get result upto
five decimal places then set precision to five like

1(%i1) fpprec : 5

1.2.8 Toggle to Floating Point (numer)
By defalutnumeris ‘false’ and the symbols are used in calculations of expression.
Ifnumeris ‘true’ then variables or symbols in expression which have numerical
values are replaced by their values. The syntax is used like

1(%i1) numer:true % for setting true value
(%i2) numer:false % for setting false value

For example

1.3. PROCEDURAL 33

(%i1) numer:true;
2(%i2) %e


(\%o2) 2.718281828459045

Ifnumeris set to ‘false’ then result is symbolic.

1(%i1) numer:false;
(%i2) %e


(%o2) %e

1.3 Procedural
1.3.1 Interrupt Maxima (kill)
It removes all bindings (value, function, array, or rule) from the arguments. An
argument may be a symbol or a single array element. The syntax is

1(%i1) kill(<symbol>)
(%i2) kill([<array element 1>, <array element 2>, ...)
3(%i3) kill(<labels>)
(%i4) kill(<integers>)
5(%i5) kill(all)%kills all values, function, array or rules

1.3.2 Modes of Variables (modedeclare)
modedeclareis used to declare the modes of variables and functions for subse-
quent translation or compilation of functions.modedeclareis typically placed
at the beginning of definition of a function, at the beginning of a Maxima script,
or executed at the interactive prompt. The syntax used is

1(%i1) mode_declare ([y_1, y_2, ...], fixnum)%Or

or

1(%i2) mode_declare (y_1, mode_1, ... y_n, mode_n])

The ‘fixnum’ are “float”, “bignum” etc. For example,

1(%i1) F(x):=(mode_declare([x],float), x+2.0)

This converts independent variablexas floating value and as well as function
F(x) =x+ 2.0 into floating function.

34 CHAPTER 1. MAXIMA CORE
1.3.3 Evaluate & Print Expression (print)
printevaluates and displays expressions one after another, from left to right,
starting at the left edge of the console display. The syntax for thefunctionprint
is

1(%i1)print(<expr 1>, <expr 2>, ...., <expr n>)


1(%i1)print((a+b)^2, (a-b)^2)

(%o3)b
2
−2a b+a
2
1.3.4 Labels (labels)
labelsreturns the list of either input or output or intermediate expression labels
which begin with symbol. Typically symbol is the value of eitherincharor
outcharorlinechar. Syntax for the function is

1(%i1)labels(<symbol>)

1.3.5 Line Number (linenum)
It is the line number of the current pair of input and output expressions.
1.3.6 List of Options (myoptions)
myoptionsis the list of all options ever reset by the user, whether or not they
get reset to their default value.
1.3.7 Ordinary Base (obase)
obasemay be assigned any integer between 2 and 36 (decimal), inclusive. The
default value ofobasevariable is decimal ‘10’. Other bases are binary ‘2’, octal
‘8’, hexadecimal ‘16’ and ‘32’.

1(%i1)obase:2$
(%i2) 99;


(%o2) 1100011

1.3. PROCEDURAL 35
1.3.8 Print the Reset Option (optionset)
Whenoptionsetis ‘true’, Maxima print outs a message whenever a Maxima
option is reset. This is useful if the user is doubtful of the spelling ofsome
option and wants to make sure that the variable he assigned a value to was
truly an option variable. The default value is ‘false’.
1.3.9 Play Previous Garbage (playback)
It prints the previously collected garbage by the Maxima. The syntax is

1(%i1)playback([<inputs>, <outputs>],grind,time, slow)

Argument “slow” is useful in conjunction with save orstringoutwhen creating a
secondary-storage file in order to pick out useful expressions. Argument “time”
displays the computation time for each expression. Argument “grind” displays
input expressions in the same format as the “grind”. Output expressions are
not affected by the “grind” option.
1.3.10 Prompting Symbol (prompt)
promptis the prompt symbol of thedemofunction, playback (slow) mode and
the Maxima break loop. The default value is ‘’.
1.3.11 Quit the Session (quit)
quitterminates the current Maxima session. It is used likequit().
1.3.12 Rationalized Print (ratprint)
Whenratprintis true, a message informing the user about the conversion of
floating point numbers into rational numbers is displayed. The default value is
‘true’.
1.3.13 Enter into Lisp System (tolisp)
tolispvariable let to enter into Lisp system of Maxima. It enables to initiated
new variable, function etc in Maxima that can be used later in Maxima after
returning to Maxima. To return to Maxima,

1(%i1) to_maxima;

variable is used (including parenthesis brackets).

36 CHAPTER 1. MAXIMA CORE
1.3.14 Call Functions of Current Session (backtrace)
backtracefunction is used to call the all functions of current session. The length
of tracing is controled by supplying an integer value as argument to the function.
The syntax used is

1(%i1) backtrace(<lengthoftraceas integer>)

1.3.15 Break Maxima Evaluation (break)
This function has syntax like

1(%i1) break(<expr 1>, <expr 2>, ..., <expr n>)

breakevaluates and prints ‘expr1’ to ‘exprn’ and then causes a Maxima break
at which point the user can examine and change his environment. Upon typing
“exit”; the computation resumes.
1.3.16 Bug Reporting Info (bugreport)
It returns the details of Maxima and the link where a bug can be reported.
1.3.17 Build Information (buildinfo)
buildinforeturns the information consisting date, time, building plateform,
Lisp compiler, version of Maxima and host etc used during the compilation and
building of Maxima.
1.3.18 Debug Mode (debugmode)
By defaultdebugmodeis false. When a Maxima error occurs, Maxima will start
the debugger ifdebugmodeis ‘true’. The user may enter commands to examine
the call stack, set breakpoints, step through Maxima code, and so on. Enabling
debugmode will not catch Lisp errors.
1.3.19 Show Evaluation Time (showtime)
showtimeis ‘true’ then time taken by maxima to evaluate the transcript is shown
at the output. By default it is ‘false’. This variable is useful to check the speed
of execusion of function and provide the ways of script cleaning.
1.3.20 Evaluation Time (time)
timereturns the time taken durign the evaluation by Maxima. The handle is
supplied as argument to get the time taken by Maxima in evaluation of specific
function.timecan only be applied to output line variables; for any other vari-
ables, time returns unknown. Setshowtimeas ‘true’ to make Maxima print out
the computation time and elapsed time with each output line.

1.3. PROCEDURAL 37

1(%i1)integrate(x,x)
(%i2)time(%o1);


(%o2) [0.0]

1.3.21 Promp & Read (read)
readfirst prints the statement and then ask for one input in the console. The
expression entered in the console is read by Maxima and returns theevaluated
result of the expression in the console. The expression entered into the console
muste be terminated by dollar sign(‘$’).

1(%i1) a=10;
(%i2) f:read("Enter new value")$
3<Enter new value> 2^a$
(%i3) f;


(%o3) 1024

1.3.22 testsuitefiles
Similar to theruntestsuiteto check the test pass of a file.

1(%i1) testsuite_files();

1.3.23 Test The Maxim (run testsuite)
runtestsuitetests producing the desired answer are considered “passes” as are
tests that do not produce the desired answer, but are marked asknown bugs.

1(%i1) run_testsuite();

1.3.24 Read Function Without Evaluation (readonly)
Ifreadonlyfunction is used in place ofreadfunction with similar syntax, then it
returns the expression to console without evaluation.

1(%i1) a=10;
(%i2) f:readonly("Enter new value")$
3<Enter new value> 2^a$
(%i3) f;

(

38 CHAPTER 1. MAXIMA CORE
1.3.25 Activate Contexts (activate)
It activates the contexts. The facts in these contexts are thenavailable to make
deductions and retrieve information. The facts in these contextsare not listed
byfacts. Syntax foractivateis

(%i1) activate(<context 1>, <context 2>, ...)

1.3.26 List of Activated Contexts (activecontexts)
activecontextsis a list of the contexts which are active by way of theactivate
they are subcontexts of the current context.
1.3.27 Additive Function (additive)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as a additive function. The syntax for this is

1(%i1) declare(<f>, additive)

1.3.28 Alternative Name for Function (alias)
It assigns an alternative name to Maxima function. Syntax for this function is

1(%i1) alias(<new fcn name 1>, <old fcn name 1>, ...)

1.3.29 Declare String as Alphabic (alphabetic)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
all characters in the ‘s’ as alphabatic characters. The syntax forthis flag is

1(%i1) declare(<s>, alphabatic)

1.3.30 Arguments In Expression (args)
It returns the number of arguments in an expression. Syntax used is

1(%i1) args(<expression>)

1.3.31 Atomic Expression (atom)
If the function is used like

1(%i1) atom(<expression>)

1.3. PROCEDURAL 39
and Maxima returns ‘true’ then ‘expression’ is atomic (i.e. a number,name or
string) otherwise ‘expression’ is non atomic. Thus

1(%i1) atom(5)

is true while

1(%i1) atom(a[1])

and

1(%i2) atom(sin(x))

are ‘false’ (assuminga[1] andxare unbound).
1.3.32 Declare a Function Antisymmetric (antisymmet-
ric)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as an antisymmetric function. The syntax for this flag is

1(%i1) declare(<f>, antisymmetric)

Here function ‘f’ will assumed as an antisymmetric function.
1.3.33 Check The Integer Type (askinteger)

1(%i1) askinteger(<expression>, <integer type>)

attempts to determine from the assume database whether expression is an in-
teger or not. There are three categories of ‘integer type’ - (i) “odd”, (ii) “even”
and (iii) “integer”.
1.3.34 Retrive User Property (get)

1(%i1)get(<a>, <i>)

It retrieves the user property indicated byiassociated with atomaor returns
‘false’ if a doesn’t have propertyi.
1.3.35 Declare Variable as Integer (integer)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as an integer. The syntax for this flag is

1(%i1) declare(<var>, integer)

Here variable ‘var’ will assumed as an integer.

40 CHAPTER 1. MAXIMA CORE
1.3.36 Declare Variable as Non-Integer (noninteger)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as a noninteger. The syntax for this flag is

1(%i1) declare(<var>, noninteger)

Here variable ‘var’ will assumed as a noninteger.
1.3.37 Integer Variabe (integervalued)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as an integervalued function. The syntax for this flag is

1(%i1) declare(<f>, integervalued)

Here function ‘f’ will assumed as an integervalued function.
1.3.38 Query for Sign of Expression (asksign)
asksignattempts to deduce the sign of expressions from the sign of operands
within the expression. For example, ifaandbare both positive, thena+bis
also positive.

1(%i1) asksign(1-2)


(%o1) neg

1.3.39 Declare Variables (assume)
It adds predicates to the current context. If a predicate is inconsistent or redun-
dant with the predicates in the current context, it is not added to the context.
The context accumulates predicates from each call to assume. Syntax for the
functionassumeis

1(%i1) assume(<var> <condition> <varvalues>, .....)

‘conditions’ are the mathematical comparision symbols like ‘<=’, ‘>=’, ‘<’, ‘>’
and ‘=’ etc. For example

1(%i1) assume(x>1,y<1)$
(%i2)is(x>y)


(%o2) true

1.3. PROCEDURAL 41
1.3.40 Declare Variable as Positive (assumepos)
Whenassumeposis ‘true’ and the sign of a parameterxcannot be determined
from the current context or other considerations,signandasksign (x)return
‘true’. By default it is ‘false’.
1.3.41 Declare As Communative Function (commutative)
Functiondeclare, if used as the syntax given below, tells the simplifier that
function is a commutative function. The syntax for this is

1(%i1) declare(<f>, commutative)

1.3.42 Compare Expression (compare)
It returns the comparative result according to the comparative relation between
two supplied arguments to the functioncompare. Syntax for this function is

1(%i1) compare(<expr 1>, <expr 2>)

If Maxima is unable to compare then it returns “unknown”.
1.3.43 Context (context)
contextnames the collection of facts maintained byassume,forget. Binding con-
text to a name ‘foo’ changes the current context to ‘foo’. If the specified context
‘foo’ does not yet exist, it is created automatically by a call tonewcontext. The
specified context is activated automatically. By default it is “initial”.
1.3.44 Contexts (contexts)
contextsis a list of the contexts which currently exist, including the currently
active context. By default its value is [“initial”, “global”].
1.3.45 Deactivate Context (deactivate)
deactivatedeactivates the contexts supplied to the function as its arguments.

1(%i1) deactivate(<context 1>, <context 2>, .....)

1.3.46 Delcaration Statement (declare)
It assigns the atom or list of atoms the property or list of properties respectively.
It is used like

1(%i1) declare(<atom>, <property>)

42 CHAPTER 1. MAXIMA CORE
1.4 Declarations
1.4.1 Declare As Decreasing Function (decreasing)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as a decreasing function. The syntax for this is

1(%i1) declare(<f>, decreasing)

1.4.2 Declare As Increasing Function (increasing)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as a increasing function. The syntax for this is

1(%i1) declare(<f>, increasing)

1.4.3 Declare Variable as Even Variable (even)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a symbol as a even integer variable. The syntax for this is

1(%i1) declare(<sym>, even)

1.4.4 Declare Variable as Odd Variable (odd)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a symbol as a odd integer variable. The syntax for this is

1(%i1) declare(<sym>, odd)

1.4.5 Variable As a Constant (constant)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a symbol as a constant. The syntax for this is

1(%i1) declare(<sym>, constant)

1.4.6 Check a Constant (constantp)
It returns ‘true’ if an expression is a constant expression, otherwise returns
‘false’.

1(%i1) constantp(<expression>)

1.4. DECLARATIONS 43
1.4.7 Get Features (featurep)
It attempts to determine whether the object has the feature onthe basis of the
facts in the current database. If so, it returns ‘true’, else ‘false’.

1(%i1)featurep(<object name>, <featurename>)

1.4.8 Set Feature (features)
Maxima recognizes certain mathematical properties of functions and variables.
These are called ”features”. The syntax

1(%i1) declare(x, foo)

gives the propertyfooto the function or variablex. Thedeclarefunction used
like

1(%i1) declare(<featurename>,feature)

declares a new feature.featuresis a list of mathematical features.
1.4.9 Status (is)
isasks whether the predicate expression is provable from the factsin the as-
sume database. If predicted expression is provable, it returns ‘true’ otherwise it
returns ‘false’.

1(%i1) 1<2$% itistrue as 1isalways less than 2.
(%i2)is(1<2) % ask the prediction, resultistrue


(%o2) true

1.4.10 Kill Contextx (killcontext)
It kills the contenxt from the Maxima. Syntax is

1(%i1)killcontext(<context 1>, ...)

1.4.11 Simplify as Left-Associative (lassociative)
Functiondeclare, if used as the syntax given below, tells to simplifier that the
function is a left-associative. The syntax for this is

1(%i1) declare(<expr>,lassociative)

44 CHAPTER 1. MAXIMA CORE
1.4.12 Recognize Function as N-Array (nary)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as n-array function. The syntax for this is

1(%i1) declare(<f>, nary)

1.4.13 Maximum Negative Expansion (maxnegex)
maxnegexis the largest negative exponent which will be expanded by the expand
command. By default its value is ‘1000’.
1.4.14 Match Declaration (matchdeclare)
Associates a predicate with a variable so that variable matches expressions for
which the predicate returns anything other than false. Syntax is

1(%i1)matchdeclare(<var>, <predicate>)

1.4.15 Simplify as Multiplicative (multiplicative)
Functiondeclare, if used as the syntax given below, tells Maxima to expand an
expression as a multiplicative. The syntax for this is

1(%i1) declare(<expr>,multiplicative)

1.4.16 Multiply Two Expression (multthru)
This function multiply two or more expressions with each other.multthrudoes
not expand exponentiated sums if present in the expressions. Thisfunction is
the fastest way to distribute products (commutative or noncommutative) over
sums.

1(%i1)multthru(<expr 1>, <expr 2>)

1.4.17 Negative Distribution (negdistrib)
If this variable is set to ‘true’ this negative coefficient of an expression is dis-
tributed to the all terms of the expression. By default it is ‘true’.

1(%i1) -(a+b)

(%o1) −b−a
Now, settingnegdistribas ‘false’.

1.4. DECLARATIONS 45

1(%i1)negdistrib:false$
(%i2) -(a+b)

(%o2) −(b+a)
1.4.18 Create New Context (newcontext)
It creates a new contenxt in the Maxima. Syntax is

(%i1)newcontext(<context>)

1.4.19 Numerical Value of Variable (numerval)
It declares that a variable have numerical value.

1(%i1)numerval(<var 1>, <num1>, ....., <var n>, <numn>)

1.4.20 Pull Out Constant Term (outative)
Functiondeclare, if used as the syntax given below, tells Maxima to pull out
the constant term from the expression as coefficient. The syntaxfor this is

1(%i1) declare(<f>,outative)

1.4.21 Positive Function (posfun)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a functionfto be a positive function.

1(%i1)is(f(x) > 0)

yields ‘true’.

1(%i1) declare(<f>,posfun)

1.4.22 Properties of Atom (properties)
Returns a list of the names of all the properties associated with theatom. It is
used like

1(%i1)properties(<atom name>)

46 CHAPTER 1. MAXIMA CORE
1.4.23 Assign a Value to Property (put)
putassigns value to the property (specified by indicator) of atom. ‘indicator’
may be the name of any property, not just a system-defined property. The
syntax used is

1(%i1)put(<atom>, <value>, <indicator>)

1.4.24 Simplify as Right-Associative (rassociative)
Functiondeclare, if used as the syntax given below, tells to simplifier that the
function is a a right-associative. The syntax for this is

1(%i1) declare(<expr>,rassociative)

1.4.25 Declare Variable as Irrational Variable (irrational)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as an irrational variable. The syntax for this flag is

1(%i1) declare(<var>, irrational)

Here variable ‘var’ will assumed as an irrational variable.
1.4.26 Declare Variable as Irrational Variable (rational)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as a rational variable. The syntax for this flag is

1(%i1) declare(<var>, rational)

Here variable ‘var’ will assumed as a rational variable.
1.4.27 Declare Variable as Complex Variable (complex)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as a complex variable. The syntax for this flag is

1(%i1) declare(<var>, complex)

Here variable ‘var’ will assumed as a complex variable.
1.4.28 Declare Variable as Imaginary Variable (imaginary)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as an imaginary variable. The syntax for this flag is

1(%i1) declare(<var>, imaginary)

Here variable ‘var’ will assumed as an imaginary variable.

1.4. DECLARATIONS 47
1.4.29 Declare Variable as Real Variable (real)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as a real variable The syntax for this flag is

1(%i1) declare(<var>, real)

Here variable ‘var’ will assumed as a real variable.
1.4.30 Remove Indicator From Atom (rem)
The syntax for theremis

1(%i1)rem(<atom>, <indicator>)

It removes the property indicated by ‘indicator’ from ‘atom’.remreverses the
effect ofput.remreturns done if atom had an indicator property whenremwas
called, or ‘false’ if it had no such property.
1.4.31 Remove Property (remove)
It removes the properties from the atom. It has syntax like

1(%i1)rem(<atom vector>, <property vector>)

If “all’ is used as argument in place of ‘atom vector’ then ‘property vector’ will
be removed from all atoms.
1.4.32 Scalar Value (scalar)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a variable as a scalar variable. The syntax for this flag is

1(%i1) declare(<var>, scalar)

Here variable ‘var’ will assumed as a scalar variable.
1.4.33 Sign of Expression (sign)
signattempts to deduce the sign of expressions from the sign of operands within
the expression. For example, ifaandbare both positive, thena+bis also
positive.

1(%i1)sign(1-2)


(%o1) neg

48 CHAPTER 1. MAXIMA CORE
1.4.34 Declare Variable as Symetric Function (symmetric)
Functiondeclare, if used as the syntax given below, tells Maxima to recognize
a function as a symmetric function. The syntax for this flag is

1(%i1) declare(<f>,symmetric)

Here function ‘f’ will assumed as a symmetric function.

Chapter 2
Numeric Evaluation
2.1 Number Theory
2.1.1 Big Float (bffac)
bffacis acronym of “Bigfloat” version of the factorial function. The syntax for
the function is

1(%i1) bffac(<expression>, <integer>)

The second argument ‘integer’ is how many digits to retain and return, it’s a
good idea to request a couple of extra.
2.1.2 Big Float Zeta Function (bfhzeta)
bfhzetareturns the Hurwitz zeta function for the argumentssandh. The return
value is a big float (bfloat);nis the number of digits in the return value. The
Hurwitz zeta function is defined as
zeta(s, h) =

X
n=0
1
(n+h)
s
To use this function, “bffac” should be loaded at first. The syntax for this
function is

1(%i1) bfhzeta(<expr s>, <expr h>, <numofreturndigit n>)

2.1.3 Convert to Big Float (bfloat)
It converts all numbers and functions of numbers in expression tobigfloatnum-
bers. The number of significant digits in the resultingbigfloatsis specified by
the global variablefpprec.

1(%i1) bfloat(<expression>)

49

50 CHAPTER 2. NUMERIC EVALUATION
2.1.4 Is Big Float (bfloatp)
Returns ‘true’ if expression is abigfloatnumber, otherwise ‘false’.

1(%i1) bfloatp(<expression>)

2.1.5 Digamma Big Float Function (bfpsi) & (bfpsi0)
bfpsiis the polygamma function of real argumentzand integer ordern.bfpsi0
is the digamma function. The syntax is

1(%i1) bfpsi0 (z,fpprec)

or

1(%i1) bfpsi (0, z,fpprec)

These functions are same and return bigfloat values.fpprecis the bigfloat
precision of the return value.
2.1.6 Big Float to Rational Number (bftorat)
bftoratcontrols the conversion ofbfloatsto rational numbers. Whenbftorat
is ‘false’,ratepsilonconversion take place. Whenbftoratis ‘true’, generated
rational number generated will accurately represent thebfloat. By default it is
‘false’.
2.1.7 Truncate Big Float (bftrunc)
bftrunccauses trailing zeroes in non-zerobigfloatnumbers not to be displayed.
Thus, ifbftruncis ‘false’,bfloat(1)displays as 1.000000000000000B0. Otherwise,
this is displayed as 1.0B0. By default it is ‘true’.
2.1.8 Big Float Zeta Function (bfzeta)
It returns the Riemann zeta function for the arguments. The return value is a
big float (bfloat);nis the number of digits in the return value. The syntax is

1(%i1) bfzeta(s, n)

2.1.9 Complex Big Float (cbffac)
It returns complex big float and needs to loadbffac. The syntax is

1(%i1) cbffac(<complex number>, <precision points>)

2.1. NUMBER THEORY 51
2.1.10 Floating Point (float)
It converts integers, rational numbers and bigfloats in expression to floating
point numbers.
2.1.11 Float to Big Float (float2bf)
Whenfloat2bfis ‘false’, a warning message is printed when a floating point
number is converted into a bigfloat number. By default it is ‘true’.
2.1.12 Is Floating Number (floatnump)
It returns ‘true’ if expression is a floating point number, otherwise‘false’. The
syntax is

1(%i1)floatnump(<expression>)

2.1.13 Float Point Precision (fpprec)
fpprecis the number of significant digits for arithmetic on bigfloat numbers.
fpprecdoes not affect computations on ordinary floating point numbers. By
default its value is ‘16’. It is used like

1(%i1)fpprec:<integer less than 16>

2.1.14 Float Point Print Precission (fpprintprec)
fpprintprecis the number of digits to print when printing an ordinary float or
bigfloat number. For ordinary floating point numbers, whenfpprintprechas a
value between ‘2’ and ‘16’ (inclusive), the number of digits printed is equal to
fpprintprec. Otherwise,fpprintprecis ‘0’, or greater than ‘16’, and the number
of digits printed is ‘16’. By default its value is ‘0’.

1(%i1)fpprintprec:<integer 2 to 16 & 0>

2.1.15 Keep Float Points (keepfloat)
By default it is ‘false’. Whenkeepfloatis ‘true’, prevents floating point numbers
from being rationalized when expressions which contain them are converted to
canonical rational expression (CRE) form.
2.1.16 Numerical Solution (numer)
numercauses some mathematical functions (including exponentiation) with nu-
merical arguments to be evaluated in floating point. It causes variables in ex-
pression which have been given numerals to be replaced by their values. It also
sets thefloat.

52 CHAPTER 2. NUMERIC EVALUATION
2.1.17 Numerical Power of Negative Integer (numerpbranch)
By default, this variable is ‘false’. The option variablenumerpbranchcontrols
the numerical evaluation of the power of a negative integer, rational, or floating
point number. Whennumerpbranchis ‘true’ and the exponent is a floating
point number or the option variablenumerthe numerical result returns us-
ing the principal branch, otherwise a simplified, but not an evaluatedresult is
returned.

1(%i1) (-2)^0.75;


(%o1) (-2)^0.75


1(%i2) (-2)^0.75,numer_pbranch:true;


(%o2) 1.189207115002721*%i-1.189207115002721

2.1.18 Number to Variables (numerval)
This function assigns the numerical values to the variables. Syntaxused like

1(%i1)numerval(var_1, val_1, ..., var_n, val_n)

2.1.19 Tolerance in Floating Point (ratepsilon)
ratepsilonis the tolerance used in the conversion of floating point numbers
to rational numbers, when the option variablebftorat. By default its value is
2.0e
−15
.
2.1.20 Rationalize (rationalize)
Convert all double floats and big floats in the Maxima expression to their exact
rational equivalents. If you are not familiar with the binary representation of
floating point numbers, you might be surprised that

1(%i1) rationalize (0.1)

does not equal 1/10. This behavior isn’t special to Maxima. The number 1/10
is a repeating, not a terminating, binary representation.

1(%i1) rationalize(0.1)

The output is
(%o1)
3602879701896397
36028797018963968

2.1. NUMBER THEORY 53
2.1.21 Is Rational Number (ratnump)
Returns ‘true’ if expression is a literal integer or ratio of literal integers, other-
wise ‘false’.
2.1.22 Print Message Rational (ratprint)
Whenratprintis ‘true’, a message informing the user of the conversion of floating
point numbers to rational numbers is displayed. By default it is ‘true’.
2.1.23 Numerical Status (statsnumer)
Ifstatsnumeris ‘true’, inference statistical functions return their results in
floating point numbers. If it is ‘false’, results are given in symbolic and rational
format.

54 CHAPTER 2. NUMERIC EVALUATION

Chapter 3
Conditions
Following conditions can be used in Maxima.
3.1 Linear
3.1.1 If Statement (if)
ifis a conditional statement. The syntax for functionifis like

1(%i2)if< condition >
then
3 <bodyifcondition true>
else
5 <bodyifcondition false>


1(%i2) f(x):= ifx=1 then (x+1)$
(%i2) f(3)

(%o1)false
The output is false asx6= 1. Again

(%i2) f(x): = ifx=1 then (x+1)$
2(%i2) f(1)

(%o1) 2
55

56 CHAPTER 3. CONDITIONS
3.1.2 If-Else Statement (if-else)
if-elseis a conditional statement where function body for ‘true’ and ‘false’ con-
ditions are given and only ‘true’ case is printed in output. Syntax forif-else
condition is

(%i2)if< condition >
2 then
<bodyifcondition true>
4 else
<bodyifcondition false>


1(%i2) f(x): = ifx=1 then (x+1) else (x-1)$
(%i2) f(3)

(%o1) 2
3.2 Loop
3.2.1 For Statement (for)
It is loop operator. The syntax forforloop is

(%i1)for<initial var>
2 thru
<boundinglimit>
4 step
<integer>
6 do
<function body>;

For example

1(%i1)fori:1 thru 10 step 3 doprint(2*i);


2
8
14
20
(%o1) done

whilestatement can be applied withforfunction.

1(%i1)fori:1 while i <=10 do s:s+i;


(%o1) 55

3.2. LOOP 57
3.2.2 Do Statement (do)
Thedostatement is used for performing iteration.

1(%i1)fori:1 while i <=10 do s:s+i;


(%o1) 55

3.2.3 While Statement (while)
It allow the iteration to be performed until the require condition is satisfied.
Generallywhilestatement comes withdostatement.

1(%i1)fori:1 while i <=10 do s:s+i;


(%o1) 55

58 CHAPTER 3. CONDITIONS

Chapter 4
Arithmetic
Arithmetical functions are followings.
4.1 Arithmatic Functions
4.1.1 Absolute Number (abs)
absreturns the absolute value of an supplied number. Ifx= 1.20152 then its
absolute value is 1.201. Similarly ifx=−1.20152, then its absolute value is
1.201.

1(%i1) abs(1.20152);


(\%o1) 1.201


1(%i1) abs(-1.20152);


(\%o1) 1.201

4.1.2 Summation of Terms (sum)
sumis used for sum evaluation of a series. Syntax forsumis

1(%i1) sum(<expression>, <variable>, <initial value>, <final value>)

Summation
n
X
i=1
i
2
is expanded as
n
X
i=1
i
2
= 1
2
+ 2
2
+ 3
2
+. . .+n
2
59

60 CHAPTER 4. ARITHMETIC
If either initial or final value is symbol, then output is just symbolic representa-
tion of summation. The sum of a series of square of first ‘n’ integersis evaluated
as

1(%i1) sum(x^2, x, a, b)

The output is
(%o1)
b
X
x=a
x
2
If initial & final values are integers then

1(%i1) sum(x^2,x,1,10)

The output is

(%o1) 385

4.1.3 Numerical Summation of Terms (nusum)
nusumis used for numerical sum evaluation of a series. Syntax fornusumis

1(%i1) nusum(<expression>, <variable>, <initial value>, <final value>)

The numerical sum of a series of square of first ‘n’ integers is evaluated as

1(%i1) nusum(x^2,x,1,n)

The output is
(%o1)
n(n+ 1) (2n+ 1)
6
This output is in symbolic form.
4.1.4 Numerical Factor of Algebraic Fraction (numfactor)
It returns the numerical factor from an algrebraic fraction.

1(%i1) numfactor(15/8 * %e);

The output is
(%o1)
15
8

4.1. ARITHMATIC FUNCTIONS 61
4.1.5 Product of Terms (product)
productis used for product evaluation of a series. Syntax forproductis

1(%i1) product(<expression>, <variable>, <initial value>,<final value>)

Product
n
Y
i=1
i
2
is expanded as
n
Y
i=1
i
2
= 1
2
×2
2
×3
2
×. . .×n
2
If either initial or final value is symbol, then output is just symbolic representa-
tion of product. The product of a series of square of first ‘n’ integers is evaluated
as

1(%i1) product(x^2, x, a, b)

The output is
(%o1)
b
Y
x=a
x
2
If initial & final values are integers then

1(%i1) product(x^2, x, 1, 5)


(\%o1) 14400

4.1.6 Maximum Value (max)
maxreturns the maximum value of supplied arguments as vector or matrix.

1(%i1) max(20,15,47,85,0,-2)


(%o1) 85

4.1.7 Minimum Value (min)
minreturns the minimum value of supplied arguments as vector or matrix.

1(%i1) min(20,15,47,85,0,-2)


(%o1) -2

62 CHAPTER 4. ARITHMETIC
4.1.8 Modulo (mod)
It returns the modulo of two expressions as shown in the syntax ofthis function.

1(%i1) mod(<expression 1>, <expression 2>)

Modulo between two pure integer values is given by

1(%i1) mod(10,3)


(%o1) 1

Modulo for algebraic relations

1(%i1) mod(a^3-b^3,a-b);

(
4.1.9 Square Root (sqrt)
It returns the square root of given number.

1(%i1) numer:true;
(%i2) sqrt(10)


(%o2) 3.16227766016838

4.1.10 Sorting Elements (sort)
4.1.11 Simplification Environment (simp)
Whensimpis used as anevflagwith a value ‘false’, the simplification is sup-
pressed only during the evaluation phase of an expression. The flagcan not
suppress the simplification which follows the evaluation phase. The simplifi-
cation is switched off globally. The expressionsin(1.0)is not simplified to its
numerical value. Thesimp-flag switches the simplification on is

1(%i4) simp:true;


(%o4) true


1(%i5) x:sin(1.0),simp:false;


(%o5) 0.8414709848078965

Chapter 5
Algebra
This section includes the functions can be used in algebra.
5.1 Linear Equations
5.1.1 Algebraic Evaluation (algebraic)
By defaultalgebraicis ‘false’. It must be set ‘true’ in order to simplify the
algebraic numbers.
5.1.2 Solving Linear Equation (solve)
A linear equation can be solved by usingsolvefunction. An algebraic equation,
f(x) = 0 of a variablex, would be arranged in form off(x) = 0 before getting
the roots of the equation. If equation is in form off(x) =athen it should be
arranged asf(x)−a= 0 before supplying it as argument to thesolvefunction.
The synopsis of thesolvefunction is

1(%i1)solve([<linearalgebraic equation>],[<variable>])

Example is

1(%i1)solve([x^2-x+1=0],[x])

The output is
(%o1)
"
x=−

3i−1
2
, x=

3i+ 1
2
#
If we have to solve more than one function then syntax forsolvebecomes

1(%i11) x+y=1

63

64 CHAPTER 5. ALGEBRA
(%o11)x+y= 1

1(%i12) x-y=2

(%o12)x−y= 2

1(%i13)solve([%o11,%o12])

(%o12)
≤≤
y=−
1
2
, x=
3
2
λλ
5.1.3 Simplify Logs, Exponent & Radicals (radcan)
radcansimplifies expressions, which contain logs, exponentials and radicals.For
a somewhat larger class of expressions,radcanproduces a regular form. Two
equivalent expressions in this class do not necessarily have the sameappearance,
but their difference can be simplified byradcanto zero. For example
×
log(x+x
2
)−log(x)

a
[log(1 +x)]
a/2
= [log(x+ 1)]
a/2
Maxima code is

1(%i3)radcan((log(x+x^2)-log(x))^a/log(1+x)^(a/2));

(%o3) log (x+ 1)
a
2
5.1.4 Radical Expansion (radexpand)
By default it is ‘true’. It controls the expansion of radicals. When it is ‘true’
for all, factors are pulled outside to the radicals. For example, whenradexpand
is ‘true’,

4x
2
becomes 2xas a coefficient of the expression.
5.1.5 Rational Simplification (ratsimp)
It is abbrevation of “rational simplification”. It simplifies the expression and all
of its subexpressions, including the arguments to non-rational functions. The

5.1. LINEAR EQUATIONS 65
result is returned as the quotient of two polynomials in a recursive form. The
syntax used is

1(%i3)ratsimp(<expression>, <arg 1>, <arg 2>, ... , <arg n>)

For example

1(%i3)sin(x)/x +exp((1+log(x))^2 -log(x));

(%o3)
sin (x)
x
+
e
(log(x)+1)
2
x

1(%i3)sin(x)/x +exp((1+log(x))^2 -log(x));
(%i4)ratsimp(%);

(%o4)
sin (x) +x
2
e
log(x)
2
+1
x
5.1.6 Rationalized Simplification Flag (ratsimpexpons)
By default it is ‘false’. Whenratsimpexponsis true,ratsimpis applied to the
exponents of expressions during simplification.
5.1.7 Evaluation of Expression in Environment (ev)
It evals an expression in the environment as specified by the user in form of
arg1,arg2,. . .,argn. In all of these arguments, at least one must be from the
environmentssimp,noeval,diff,integrate,expand,detout,derivlist,float,numer,
pred,evalor other valid function names. The syntax used for this function is

(%i3) ev(<expression>, <arg 1>, <arg 2>, ... , <arg n>)

A functionf(x) =x
2
+2, is to be derivated with respect to independent variable
‘x’ by using theevfunction is

1(%i3) x+1;
(%i4) ev(%,1);

(%o4) 2

66 CHAPTER 5. ALGEBRA
5.1.8 Evaluation of Expression (eval)
It is used as an argument in the functionevto cause an extra evaluation of
expression or relation.
5.1.9 Expansion of Algebraic Relations (expand)
expandexpands to the algebraic relations consisiting product of sum of two
or more independent variables. Exponents of sum of two or more variables or
algebraic constants are splited in simplified terms and numerical constants are
made corresponding coefficients of their respective terms. The syntax used is

(%i3)expand(<expression>)

For example

1(%i3) (a+b)^2;
(%i4)expand(%);

(%o4)b
2
+ 2ab+a
2
Another form of the syntax ofexpandis

(%i3)expand(<expression>, <mpnum>, <maximum power of denominator>)

Here ‘mpnum’ limits the expansion of those terms whose exponent is less than or
equal to ‘mpnum’ in the numerator. Similarly ‘mpden’ limits the expansion of
those terms whose exponent is less than or equal to ‘mpden’ in the denominator.
This limitation is applicable when power of exponents is positive. It is helpful
to expand the specific radicals in the rational algebraic expression.For example

1(%i3) (a+b)^2;
(%i4)expand(%, 1);

Does not exapanded as the exponent of numerator is ‘2’ that is greater than
the ‘mpnum’ value ‘1’. Remember if there is negative exponents of a radical
value in rational expressions then their power is made positive by changing their
position from the numerator to denominator and vice versa.
5.2 Inequality & Polynomial
5.2.1 Equality (equal)
equalcompares two expressions, whether two expressions are equal or not. The
stat of comparison is returned when it is asked by using functionis. It is used
for true state. If the condition is ‘true’, then the function is proven by facts and
assumed in database.

5.2. INEQUALITY & POLYNOMIAL 67

(%i3) equal(x, x^2);
2(%i4)is(%);

(%o4)unknown

(%i3) equal(x*x,x^2);
2(%i4)is(%);

(%o4)true
5.2.2 Inequality (notequal)
notequalcompares two expressions, whether two expressions are equal or not.
The stat of comparison is returned when it is asked by using functionis. It is
used for false state.

(%i3) notqual(x, x^2);
2(%i4)is(%);

(%o4)unknown

(%i3)notequal(x*x,x^2);
2(%i4)is(%);

(%o4)false
5.2.3 Solve Algebraic Polynomials (algsys)
algsysused to solve the simultaneous polynomial equations for the list of the
variables. All the polynomial equations and list of variables to be supplied as
arguments to the function must be in vector form. The syntax used is

(%i3) algsys([s^3+1], [s]);

68 CHAPTER 5. ALGEBRA
(%o3)
s=−1
s=

3i+ 1
2
s=−

3i−1
2
5.2.4 Solve Linear Equations (linsolve)
linsolveis used to solve the simultaneous linear equations for the list of variables.
The expressions must be polynomials in the variables and may be equations.
All the linear equations and list of variables to be supplied as arguments to the
function must be in vector form. The syntax used is

1(%i3)linsolve([2*x+8*y-4*z=10, 2*x+y+4*z=8, x-8*y-z=-20], [x, y, z]);

(%o3)x=−
45
89
y=
198
89
z=
151
89
5.2.5 Check The Stat Of Database (is)
isattempts to determine whether the predicate expression is provable from the
facts in the assume database. If the proven state from the facts is not assumed
then it returns the status ‘unknown’.

1(%i3)notequal(x*x, x^2);
(%i4)is(%);

(%o4)false
5.2.6 Check The Stat Of Database (maybe)
maybesimilar tois, attempts to determine whether the predicate expression
is provable from the facts in the assume database. If state is not assumed in
database, it returns ‘unknown’ result.

(%i3)notequal(x, x^2);
2(%i4)maybe(%);

5.2. INEQUALITY & POLYNOMIAL 69
(%o4)unknown

(%i5)notequal(x*x, x^2);
2(%i6)maybe(%);

(%o6)false
5.2.7 Algebraic Substitution (subst)
This function substitutes old variable by new variable. The syntax for this
function is

(%i3)subst(<new var>, <old var>, <expression>);

For example

1(%i5)subst(y, x, x^n-a^n);

(%o6)y
n
−a
n

70 CHAPTER 5. ALGEBRA

Chapter 6
Logarithm
6.0.8 Expoential (exp)
It represents to the exponential base. The syntax used for thisfunction is

1(%i5)exp(<a constantornumber>)

It is similar to the %e
x
where ‘x’ is a constant or a number. If%enumerset
true then numerical value of %e
x
is placed in place of %e
x
.
6.0.9 Logarithm (log)
6.0.10 Absolute Logarithm (logabs)
6.0.11 Arc Logarithm (logarc)
6.0.12 logconcoeffp
6.0.13 logcontract
6.0.14 Logarithmic Expansion (logexpand)
6.0.15 lognegint
6.0.16 Logarithmic Numerical Value (lognumer)
6.0.17 Logarithmic Simplification (logsimp)
71

72 CHAPTER 6. LOGARITHM

Chapter 7
Calculus
Following function are useful for calculus.
7.1 Limit
7.1.1 Finding Limit (limit)
Functionlimitis used to find a limit of a function at a point either in positive
direction or in negative direction. The syntax used is

1(%i5)limit(
<function>,
3 <independent variable>,
<limitpoint>,
5 <direction>
)

The values of ‘direction’ are “plus” for a limit from above, “minus” fora limit
from below. For example

(%i5)limit(sin(x)/x, x, 0, plus);


(%o5) 1

7.1.2 Limit Substitution (limsubst)
It prevents limit from attempting substitutions on unknown forms.By default
it is ‘false’. The substitution is allowed iflimsubstis set to ‘true’.
7.1.3 Limit By Taylor Series (tlimit)
For using the Taylor series expansion to find the limit use functiontlimit. The
syntax of functiontlimitis identical to the functionlimit.
73

74 CHAPTER 7. CALCULUS

1(%i5)tlimit(
<function>,
3 <independent variable>,
<limitpoint>,
5 <direction>
)

For example

(%i5)tlimit(sin(x)/x, x, 0, plus);


(%o5) 1

7.1.4 Taylor Limit Switch (tlimswitch)
By default it is ‘true’. Whentlimswitchis ‘true’, the limit command will use a
Taylor series expansion if the limit of the input expression cannot be computed
directly. Whentlimswitchis ‘false’ and the limit of input expression cannot be
computed directly, limit will return an unevaluated limit expression.
7.2 Derivative
7.2.1 Derivative of a Function (diff)
diffis used to get derivative of a function with respect to an independent vari-
able. The syntax used is

1(%i5) diff(
<function>,
3 <independent variable>,
<order of diff>
5 )

If ‘order of diff’ is omitted then only first order derivative is calculated. Example
is

1(%i5) diff(sin(x)*cos(x),x)

(%o5) cos
2
(x)−sin
2
(x)
A muti-variable and multi-order differentiation of a function is performed by
using following syntax.

7.2. DERIVATIVE 75

1(%i5) diff(
<function>,
3 <var 1>,
<order var 1>,
5 <var 2>,
<order var 2>, ...
7 )

Example is

1(%i5)’diff(sin(x)*cos(y),x,2,y,2);

(%o5)
d
4
dx
2
dy
2
[sin(x) cos(y)]
If ‘independent variable’ is not provided then the result contains

1del(<independent variable>)

that represents to the differential of ‘independent variable’ and return value is
so called “total differential”. For example
y= cos(x)×sin(x)
Its total derivative is
dy=

cos
2
(x)−sin
2
(x)
·
dx
Single variable example in Maxima is

1(%i5) diff(sin(x)*cos(x))

(%o5) (cos
2
(x)−sin
2
(x))del(x)
A multivariable example is

1(%i5) diff(sin(x)*cos(y))

(%o5) cos(x) cos(y)del(x)−sin(x) sin(y)del(y)
difffunction can be used withintegratefunction to evaluate relation for “deriva-
tive of integral” written as
d
dx
Z
b(x)
a(x)
f(t)dt
Maxima example is given like

76 CHAPTER 7. CALCULUS

1(%i5) diff(
integrate(
3 cos(t),
t,
5 0,
x^2
7 ),
x,
9 1
);

(%o5) 2xcos(x
2
)
7.2.2 Partial Drivative (gradef)
7.2.3 Total Differential (del)
If ‘independent variable’ is not provided then the result containsdel(¡independent
variable¿)that represents to the differential of ‘independent variable’ and return
value is so called “total differential”. Single variable example is

(%i5) diff(sin(x)*cos(x))

(%o5) (cos
2
(x)−sin
2
(x))del(x)
A multivariable example is

1(%i5) diff(sin(x)*cos(y))

(%o5) cos(x) cos(y)del(x)−sin(x) sin(y)del(y)
A functional defferentiation can be obtained by using functiondifflike the
syntax.

1(%i5) depends([f,g],u);
(%i5) diff(f*g,u);

(%o5)f

d
d u
g

+

d
d u
f

g

7.2. DERIVATIVE 77
7.2.4 Dependence of Function (depends)
Supposefandgare two independent functions and they are dependend of
uthen the function will be likef(u) andg(u). Here functionsfandgare
dependent to variableu. To define the dependency of function to independent
variable,dependsfunction is used like the syntax

(%i5) depends(<function>, <dependent variable>)

Functions may be dependent to one or more variables. The syntax will be
modified like

1(%i5) depends(
[<function 1>,<function 2>],
3 [<dependent var 1>, <dependent var 2>]
)

Here functions and independent variables are in vector form. A combination
of vector and scalar for functions and independent variables can also be used.
Single function and single variable xample is

(%i5) depends (f, x);

(%o5) [ f(x)]
Multi-functions and multi-variables example is

1(%i5) depends ([r, s], [u, v, w]);

(%o5) [r(u, v, w), s(u, v, w)]
7.2.5 Show Dependencies (dependencies)
It returns the previously defined dependent functions. The syntax used is

1(%i5) dependencies;

7.2.6 Notation of Derivative (derivabbrev)
Whenderivabbrevis ‘true’, symbolic derivatives are displayed as subscripts.
Otherwise, derivatives are displayed in the Leibniz notationdy/dx.

1(%i4) derivabbrev:true;
(%i5) diff(f(x),x)

78 CHAPTER 7. CALCULUS
(%o5)f(x)x
7.2.7 Value of Function at a Point (atvalue)
atvalueassigned a value to function when condition is met. The syntax used is

(%i5) atvalue(<function>, <conditions>, <rep value>)

This function is used to assign boundary values to a function. For example,
whenx= 0 andy= 0 then assign functionf(x, y) value ‘a’. The syntax is

1(%i5) atvalue(f(x,y), [x=0,y=0], a)

(%o5)a
If ‘rep value’ is not a constant value and it is expression consisting independent
variables ‘x’ and ‘y’ then first independent variable of function is represented
as ‘@1’ and second indpenedent variable is represented as ‘@2’ and so on. For
example

1(%i5) atvalue(f(x,y), [x=0,y=0], x+y)%firstvar=x &secondvar=y

(%o5) @2 + @1
Example of three variables function with two variables condition and replace-
ment value.

1(%i5) atvalue(f(x,z,y), [x=0,y=0], x+y) %firstvar=x &thirdvar=y

(%o5) @3 + @1
7.2.8 Degree of Derivative (derivdegree)
Returns the highest degree of derivative of dependent variableywith respect to
the independent variablexoccuring in expression. The syntax used is

1(%i5) atvalue(<expression>, <dependent var>, <independent var>)

Here ‘expression’ may be a function name or a differential equation.

7.3. INTEGRATION 79
7.2.9 Partial Derivative (express)
expressexpands the differential operators in terms of partial derivatives. It ex-
pands the differential operatorsgrad,div,curl,laplacianand the cross product.
The syntax used is

1(%i5)express(<expression>)

7.2.10 Selective Derivative (derivlist)
It causes only differentiations with respect to the indicated variables, within the
evcommand.

1(%i5) derivlist(var_1, ...., var_k)

7.2.11 Substitution in Derivatives (derivsubst)
Whenderivsubstis ‘true’, a non-syntactic substitution such as

1(%i5)subst(x,’diff (y, t), ’diff (y, t, 2))

yields

1(%i6)’diff(x, t)

By default it is ‘false’.
7.3 Integration
7.3.1 Anti Derivative of a Function (integrate)
integratefunction is used to integrate a function. Integration of functionf(x)
within lower and upper limit is expressed as
I=
Z
u
l
f(x)dx
The syntax used in integration of a function is

1(%i5)integrate(<function>, <base of int>, <lowerlimit>, <upperlimit>)

If ‘lower limit’ and ‘upper limit’ are omitted then function is integrated inthe
domain of−∞to +∞. Example is

1(%i5)integrate(sin(x)*cos(x),x)

80 CHAPTER 7. CALCULUS
(%o5) −0.5 cos
2
(x)
If limits are supplied then

1(%i5)integrate(sin(x)*cos(x),x,1,2)


(%o5) 0.059374196079117

7.3.2 Changing The Variable (changevar)
Let a function is given byf(x) wherexis independent variable and function is
dependent on thex. Now the independent variable,xcan be substituted by a
new variabley, given as functionf(x, y) = 0, using this function like.

1(%i3) changevar(<expr>, <f(x,y)>, <new var y>, <old var x>)

For example, substitution of old variablexwith new variableyaccording to the
relationy=x+ 1 in integral
Z
1
0

x+ 1−1
x
dx
is

1(%i3)’integrate((\sqrt(x+1)-1)/x,x,0,1)$
(%i4) changevar(%, -y+x+1, y, x);

Output after substituting the variable, new integration form will be
(%o4)
Z
2
1
1

y+ 1
dy
7.3.3 Double Integration (dblint)
Double integration of a two variable functionf(x, y) is given by
Idbl=
Z
ux
lx
Z
u(x)
l(x)
f(x, y)dy dx
Double integration is area covered by a function and a line within the fixed
boundary limits. The syntax for double integration in Maxima is

(%i5) dblint(<function of x & y>, <l(x)>, <u(x)>, <lx>, <ux>)

7.3. INTEGRATION 81
Here,l(x) is lower limit ofyas a function ofxandu(x) is upper limit ofy
as a function ofx. Similarlylxis lower limit ofxanduxis upper limit ofx.
Example is

1(%i5) f(x,y):=x*y;
(%i6) l(x):=1.0;
3(%i7) u(x):=x;
(%i8) dblint(’f,’l,’u,0.0,1.0);


(%o8) -0.125

82 CHAPTER 7. CALCULUS

Chapter 8
Ordinary Differential
Equation
An ordinary differential equation (ODE) is an equality involving a function and
its derivatives. An ODE of ordernis an equation of the form
F

x, y, y

, ..., y
(n)

= 0
whereyis a function ofx,y

=dy/dxis the first derivative ofywith respect to
x, andy
(n)
=d
n
y/dx
n
is then
th
derivative ofywith respect tox. Nonhomo-
geneous ordinary differential equations can be solved if the general solution to
the homogenous version is known, in which case the undetermined coefficients
method or variation of parameters can be used to find the particular solution.
Many ordinary differential equations can be solved exactly in Maxima using
dsolvefunction, and numerically by enablingnumervariable. An ODE of order
nis said to be linear if it is of the form
an(x)y
(n)
+a
(n−1)(x)y
(n−1)
+...+a1(x)y

+a0(x)y=Q(x)
A linear ODE whereQ(x) = 0 is said to be homogeneous.
8.1 Boundary Value Problems
8.1.1 Boundary Value Problem (bc2)
bc2is acronym of boundary value problem for second order differentialequation.
It receives five arguments. The syntax used forbc2is

1(%i5) bc2(<solution>, <x_1>, <y_1>, <x_2>, <y_2>)

First argument ‘solution’ is the solution of second order differentialequation.
It has two constants those are obtained by substituting the initialand final
boundary values (x1, y1) and (x2, y2) respectively. For example
83

84 CHAPTER 8. ORDINARY DIFFERENTIAL EQUATION

1(%i5) bc2(y=x+%k1+%k2, x=0, y=1, x=1, y=2);

(%o5)y=x+ 1
8.1.2 Linear Ordinary Differential Equations (desolve)
The functiondesolvesolves systems of linear ordinary differential equations
using Laplace transform. The syntax used is

1(%i5) desolve ([eqn_1, ..., eqn_n], [x_1, ..., x_n])

For example

1(%i5)

(%o5)
8.1.3 Initial Value Problem of First Order (ic1)
A first-order ordinary differential equation is either in form of
dy
dx
=F(x, y)
or in form of
dy
dx
+p(x)y=q(x)
and its solution is
y=
R
h
e
R
p(x)dx
i
q(x)dx+c
e
R
p(x)dx
To get the constant value ‘c’, we substitute the initial values in the solution of
first order differential equation. The value of ‘c’ is again put into thesolution
of first order equation and finally it gives the final solution. The functionic1
solves initial value problem of first order differential equation. It accepts three
arguments. ‘solution’ is the solution of first order differential equation. It has
one constant whose value is obtained by substituting initial boundary values
(x1, y1). The syntax used is

1(%i5)ic1(<solution>, <x_1>, <y_1>)

For example

8.2. ODE 85
8.1.4 Initial Value Problem of Second Order (ic2)
A second-order linear ODE with variable coefficients
d
2
y
dx
2
+p(x)
dy
dx
+q(x)y= 0
Solution of this equation is
?
The functionic2solves initial value problem of second order differential equa-
tion. It accepts four arguments. ‘solution’ is the solution of second order differ-
ential equation. It has one constant,k, and one derivative of dependent variable
with respect to independent variable,dy/dx, after first anti-derivative of second
order differential equation. Before performing second anti-derivative to get final
solution of second order differential equation, constantkis obtained by sub-
stituting the initial boundary values and derivative value, [dy/dx]
x1,y1
at the
initial boundary value in the ‘solution’. The syntax used is

1(%i5)ic2(<solution>, <x_1>, <y_1>, <deriv x_1 y_1>)

For example
8.2 ODE
8.2.1 Ordinary Deferential Equation of Second Order (ode2)
The functionode2solves an ordinary differential equation (ODE) of first or
second order. It receives three arguments, ‘solution’, ‘dependent variable’ and
‘independent variable’. The syntax used is

1(%i5)ode2(<equation>, <dependent variable>, <independent variable>)

For example

1(%i5)ode2(’diff(y,x) -y=1, y,x);

(%o5)y=

%c−e
−x
·
e
x

86 CHAPTER 8. ORDINARY DIFFERENTIAL EQUATION

Chapter 9
Trigonometric
Following trigonometric functions and relations are useful for mathematical so-
lutions.
9.1 Trigonometric Functions
9.1.1 Sine (sin)
sinis acronym of “sine”. It computes the sine of supplied argument in radian.
The principal domain of sine is−
π
2
≤x≤
π
2
. General domain of sine is all real
numbers. If argument is outside the principal domain then Maxima computes
nothing. Sine function is given by
y= sin(x)
Herexis argument/angle and measured in radian.

1(%i5)sin(10)


(%o5)sin(10)


1(%i5)sin(3.14)


(%o5) 0.0015926529164868

9.1.2 Cosine (cos)
cosis acronym of “cosine”. It computes the cosine of supplied argument in
radian. The principal domain of cosine is 0≤x≤π. General domain of cosine
is all real numbers. If supplied argument is outside the domain then Maxima
computes nothing.
87

88 CHAPTER 9. TRIGONOMETRIC

1(%i5) cos(10)


(%o5) cos(10)


1(%i5) cos(0)

(%o5) 1
9.1.3 Tangent (tan)
tanis acronym of “tangent”. It computes the tangent of supplied argument in
radian. The principal domain of tangent is−
π
2
< x <
π
2
. General domain of
tangent is all real numbers except the odd integer multiple ofπ/2. If supplied
argument is outside the domain then Maxima computes nothing.

1(%i5)tan(10)


(%o5)tan(10)


1(%i5)tan(3.14)

(%o5) −0.0015926549364072
9.1.4 Cotangent (cot)
cotis acronym of “cotangent”. It computes the cotangent of supplied argument
in radian. The principal domain of secant is 0< x < π. General domain
of cotangent is all real numbers except the integer multiple ofπ. If supplied
argument is outside the domain then Maxima computes nothing.

1(%i5) cot(10)


(%o5) cot(10)


1(%i5) cot(%pi/2)

(%o5) 0

9.2. HYPERBOLIC TRIGONOMETRIC FUNCTIONS 89
9.1.5 Secant (sec)
secis acronym of “secant”. It computes the secant of supplied argument in
radian. The principal domain of secant is 0≤x≤π, x6=
π
2
. General domain
of secant is all real numbers except the odd integer multiple ofπ/2. If supplied
argument is outside the domain then Maxima computes nothing.

1(%i5)sec(10)


(%o5)sec(10)


1(%i5)sec(0)

(%o5) 1
9.1.6 Cosecant (cosec)
cosecis acronym of “cosecant”. It computes the cosecant of supplied argument
in radian. The principal domain of cosecant is−
π
2
≤x≤
π
2
, x6= 0. General
domain of cosecant is all real numbers except the integer multiple ofπ. If
supplied argument is outside the domain then Maxima computes nothing.

1(%i5) csc(10)


(%o5) csc(10)


1(%i5) csc(%pi/2)

(%o5) 1
9.2 Hyperbolic Trigonometric Functions
9.2.1 Hyperbolic Sine (sinh)
sinis acronym of ‘hyperbolic sine”. It computes the hyperbolic sine of supplied
argument in radian. The principal domain of hyperbolic sine isR. If supplied
number is outside the domain then Maxima computes nothing.

1(%i5)sinh(10)

90 CHAPTER 9. TRIGONOMETRIC

(%o5)sinh(10)


1(%i5)sinh(3.14)


(%o5) 11.53029203041011

9.2.2 Hyperbolic Cosine (cosh)
coshis acronym of “hyperbolic cosine”. It computes the hyperbolic cosine of
supplied argument in radian. The principal domain of hyperbolic cosineisR.
If supplied argument is outside the domain then Maxima computes nothing.

1(%i5) cosh(10)


(%o5) cosh(10)


1(%i5) cosh(0)

(%o5) 1
9.2.3 Hyperbolic Tangent (tanh)
tanhis acronym of “hyperbolic tangent”. It computes the hyperbolic tangent
of supplied argument in radian. The principal domain of hyperbolic tangent is
R. If supplied argument is outside the domain then Maxima computes nothing.

1(%i5)tanh(10)


(%o5)tanh(10)


1(%i5)tanh(3.14)

(%o5) 0.99626020494583
9.2.4 Hyperbolic Cotangent (coth)
The principal domain of hyperbolic cotangent isR− {0}.

9.3. INVERSE TRIGONOMETRIC FUNCTIONS 91
9.2.5 Hyperbolic Secant (sech)
sechis acronym of “hyperbolic secant”. It computes the hyperbolic secant of
supplied argument in radian. The principal domain of hyperbolic secant isR.
If supplied argument is outside the domain then Maxima computes nothing.

1(%i5)sech(10)


(%o5)sech(10)


1(%i5)sech(0)

(%o5) 1
9.2.6 Hyperbolic Cosecant (csch)
The principal domain of hyperbolic cosecant isR− {0}.
9.3 Inverse Trigonometric Functions
9.3.1 Inverse Sine (asin)
asinis acronym of “inverse of sine”. It computes the sine inverse of supplied
number. The principal domain of inverse sine is [−1,1]. If supplied number is
outside the domain then Maxima computes nothing.

1(%i5) asin(10)


(%o5) asin(10)


1(%i5) asin(1)

(%o5)
π
2
9.3.2 Inverse Cosine (acos)
acosis acronym of “inverse of cosine”. It computes the cosine inverse of supplied
number. The principal domain of inverse cosine is [−1,1]. If supplied number
is outside the domain then Maxima computes nothing.

92 CHAPTER 9. TRIGONOMETRIC

1(%i5) acos(10)


(%o5) acos(10)


1(%i5) acos(0)

(%o5)
π
2
9.3.3 Inverse Tangent (atan)
atanis acronym of “inverse of tangent”. It computes the tangent inverse of
supplied number. The principal domain of inverse tangent isR. If supplied
number is outside the domain then Maxima computes nothing.

1(%i5) atan(10)


(%o5) atan(10)


1(%i5) atan(3.14)

(%o5) 1.262480664599468
9.3.4 Inverse Tangent Type Two (atan2)
atan2yields the value ofatan(y/x) in the interval−πtoπ. If supplied number
is outside the domain then Maxima computes nothing.
9.3.5 Inverse Cotangent (acot)
acotis acronym of “inverse of cotangent”. It computes the cotangent inverse of
supplied number. The principal domain of inverse cotangent isR. If supplied
number is outside the domain then Maxima computes nothing.

1(%i5) acot(10)


(%o5) acot(10)


1(%i5) acot(0.5)

9.4. INVERSE HYPERBOLIC TRIGONOMETRIC FUNCTIONS 93
(%o5) 1.10714871779409
9.3.6 Inverse Secant (asec)
asecis acronym of “inverse of secant”. It computes the secant inverse of supplied
number. Theprincipal domain of inverse secant isR−(−1,1). If supplied
number is outside the domain then Maxima computes nothing.

1(%i5) asec(10)


(%o5) asec(10)


1(%i5) asec(1)

(%o5) 2.993222846126381i
9.3.7 Inverse Cosecant (acsc)
acscis acronym of “inverse of cosecant”. It computes the cosecant inverse of
supplied number. The principal domain of inverse cosecant isR−(−1,1). If
supplied number is outside the domain then Maxima computes nothing.

1(%i5) acsc(10)


(%o5) acsc(10)


1(%i5) acsc(1)

(%o5)
π
2
9.4 Inverse Hyperbolic Trigonometric Functions
9.4.1 Inverse Hyperbolic Sine (asinh)
asinhis acronym of “inverse of hyperbolic sine”. It computes the hyperbolic
sine inverse of supplied number. The principal domain of inverse hyperbolic
sine is−∞< x <∞. If supplied number is outside the domain then Maxima
computes nothing.

94 CHAPTER 9. TRIGONOMETRIC

1(%i5) asinh(10)


(%o5) asinh(10)


1(%i5) asinh(0.1)

(%o5) 0.099834078899208
9.4.2 Inverse Hyperbolic Cosine (acosh)
acoshis acronym of “inverse of hyperbolic cosine”. It computes the cosine hy-
perbolic inverse of supplied number. The principal domain of inverse hyperbolic
cosine is 1≤x <∞. If supplied number is outside the domain and zero then
Maxima computes nothing.

1(%i5) acosh(0)


(%o5) acosh(0)


1(%i5) acosh(0.5)

(%o5) 1.047197551196598i−1.1102230246251565×10
−16
9.4.3 Inverse Hyperbolic Tangent (atanh)
atanhis acronym of “inverse of hyperbolic tangent”. It computes the hyperbolic
tangent inverse of supplied number. The principal domain of inversehyperbolic
tangent is−1< x <1. If supplied number is outside the domain then Maxima
computes nothing.

1(%i5) atanh(10)


(%o5) atanh(10)


1(%i5) atanh(3.14)

(%o5) 0.32994497940173−1.570796326794897i

9.4. INVERSE HYPERBOLIC TRIGONOMETRIC FUNCTIONS 95
9.4.4 Inverse Hyperbolic Cotangent (acoth)
acoshis acronym of “inverse of hyperbolic cotangent”. It computes thecotan-
gent hyperbolic inverse of supplied number. Theprincipal domain of inverse
hyperbolic cotangent is{−∞< x <−1} ∪ {1< x <∞}. If supplied number is
outside the domain and zero then Maxima computes nothing.

1(%i5) acoth(0)


(%o5) acoth(0)


1(%i5) acoth(0.5)

(%o5) 0.54930614433405−1.570796326794897i
9.4.5 Inverse Hyperbolic Secant (asech)
asechis acronym of “inverse of hyperbolic secant”. It computes the hyperbolic
secant inverse of supplied number. The principal domain of inverse hyperbolic
secant is 0< x≤1. If supplied number is outside the domain then Maxima
computes nothing.

1(%i5) asech(10)


(%o5) asech(10)


1(%i5) asech(0.1)

(%o5) 2.993222846126381
9.4.6 Inverse Hyperbolic Cosecant (acsch)
acschis acronym of “inverse of hyperbolic cosecant”. It computes the cose-
cant hyperbolic inverse of supplied number. The principal domain of inverse
hyperbolic cosecant is−∞< x <∞, x6= 0. If supplied number is outside the
domain and zero then Maxima computes nothing.

1(%i5) acsch(0)


(%o5) acsch(0)

96 CHAPTER 9. TRIGONOMETRIC

1(%i5) acsch(0.9)

(%o5) 0.95780044920067
9.5 Trigonometric Identities
9.5.1 Half Angle (halfangles)
The default value of variablehalfanglesis ‘false’. If it is set to true then trigono-
metric functions having half angles (x/2) as arguments are expands in form of
angle (x) arguments.

1(%i5)halfangles;
(%i6)sin(x/2);

(%o6) sin(x/2)

(%i5)halfangles:true;
2(%i6)sin(x/2);

(%o6)
(−1)
floor(
x
2π)

1−cosx

2
9.5.2 Expansion of Trigonometric Functions (trigexpand)
Iftrigexpandis true then trigonometric expressions are expanded in the form of
sin and cos or %e. This function can be used either in form of flag or in form
of function. In flag form, the default value oftrigexpandis ‘false’. For example

(%i5)trigexpand:true;
2(%i6)sin(3*x);

(%o6) 3 cos
2
(x) sin(x)−sin
3
(x)
By using function directly like

9.5. TRIGONOMETRIC IDENTITIES 97

(%i5)trigexpand(sin(3*x));

(%o5) 3 cos
2
(x) sin(x)−sin
3
(x)
9.5.3 Sum of Arguments (trigexpandplus)
By defaulttrigexpandplusis set to ‘true’. If it is ‘true’ then expansion for
trigonometirc operator for “summation” of arguments is take place. If it is
‘false’ thentrigexpanddoes not expand the trigonometric expression having
arguments in “sum” form. For example

1(%i4)trigexpandplus:false;
(%i5)trigexpand(sin(x+y));

(%o5) sin(y+x)
Iftrigexpandplusis set to ‘true’ or by default it is ‘true’ then

(%i4)trigexpandplus:true;
2(%i5)trigexpand(sin(x+y));

(%o5) cos(x) sin(y) + sin(x) cos(y)
9.5.4 Product of Arguments (trigexpandtimes)
By defaulttrigexpandtimesis set to ‘true’. If it is ‘true’ then expansion for
trigonometirc opertors for “product” of arguments is take place. If it is ‘false’
thentrigexpanddoes not expand the trigonometric expressions. For example

(%i4)trigexpandtimes:false;
2(%i5)trigexpand(sin(3*y));

(%o5) sin(3y)
Iftrigexpandtimesis set to ‘true’ or by default it is ‘true’ then

(%i4)trigexpandtimes:true;
2(%i5)trigexpand(sin(3*y));

98 CHAPTER 9. TRIGONOMETRIC
(%o5) 3 cos
2
(y) sin(y)−sin
3
(y)
9.5.5 Inverse Sequence Flag (triginverses)
triginversescontrols the sequence of function and arcfunction in simplification
of trigonometric inverse function. It is flag function. By default itsvalue is
‘true’. It has three values.
1. Iftriginversesis set to “all” then trigonometric operation in sequence
sin(sin
−1
(x))≈sin(arcsin(x))
and
sin
−1
(sin(x))≈arcsin(sin(x))
simplified tox. The same is applicable to all trigonometric operators (cos,
tan, cot, sec and csc).
2. Iftriginversesset to ‘true’ then sequence like
sin
−1
(sin(x))≈arcsin(sin(x))
is set turned off.
3. Iftriginversesset to ‘false’ then both sequences
sin(sin
−1
(x))≈sin(arcsin(x))
and
sin
−1
(sin(x))≈arcsin(sin(x))
are set turned off.
9.5.6 Expansion of Rational Fractions (trigrat)
This function performs canonical simplified of a trigonometrical expression. The
expression is a rational fraction of several sine, cosine or tangent. These argu-
ments are in linear form in some variables andπ/n, whereninteger. The
result is a simplified fraction with linear numerator and denominator in sine
and cosine.

(%i5)trigrat(sin(3*a)/sin(a+%pi/3));

(%o5) −sin
2
(a) + 2

3 cos(a) sin(a) + cos
2
(a)−1

9.5. TRIGONOMETRIC IDENTITIES 99
9.5.7 Reduce Trigonometric Expressions (trigreduce)
It combines the products and powers of trigonometric and hyperbolic ‘sine’ and
‘cosine’ of argument ‘x’ into those of multiplies of ‘x’. It also tries to eliminate
these functions when they occur in denominators. If ‘x’ is omitted then all
variables in trigonometric relations or expressions are used. The syntax used is

1(%i5)trigreduce(<expression of x>, <variable x>)

or

1(%i6)trigreduce(<multi-variables expression>)

For example

1(%i5)trigreduce(-sin(x)^2+2*cos(x)^2+x);

(%o5)
cos(2x)
2
+ 2

cos(2x)
2
+
1
2

+x−
1
2
9.5.8 Negative Arguments Simplification (trigsign)
Iftrigsingis ‘true’ (by default it is ‘true’) then trigonometric functions like
sin(−x) becomes−sin(x). In otherwords it controls the expansion of trigono-
metric operators having negative arguments. It is flag operator.
9.5.9 Trigonometric Simplification (trigsimp)
This function includes the trigonometric identity
cos
2
(x) + sin
2
(x) = 1
and
cosh
2
(x)−sinh
2
(x) = 1
to further reduce the result obtained from the application of function liketri-
greduce,ratsimp, andradcanetc. The syntax for the function is

1(%i6)trigsimp(<trigonometric expression>)

9.5.10 Demoivre Expansion (demoivre)
The functiondemoivreconverts one expression without setting the global vari-
abledemoivre. When the variabledemoivreis ‘true’, complex exponentials are
converted into equivalent expressions in terms of circular functions. Ifdemoivre
is set ‘false’ then

100 CHAPTER 9. TRIGONOMETRIC

1(%i6)exp(a + b*%i)

(%o6)e
(i∗b+a)
Ifdemoivreis set ‘true’ then

1(%i5) demoivre:true;
(%i6)exp(a + b*%i)

(%o5)e
a
(isin(b) + cos(b))
The default value ofdemoivreis false.

Chapter 10
Matrix
Following functions are useful for matrices.
10.1 Mathematical Operaton
10.1.1 Matrix (matrix)
The functionmatrixconstructs a matrix of orderm×nwheremis number of
rows andnis number of columns. The syntax for functionmatrixis

(%io) A:matrix([<row1>], [<row2>], ..., [<rown>]);

For example

1(%i1) A:matrix([1,2,3],[2,1,3],[4,7,4]);

(%o1)


1 2 3
2 1 3
4 7 4


10.1.2 Scalar Addition of Matrices (+)
The operator+adds two matrices element by element wise. IfA=Pijand
B=Qijare two matrices then the addition of two matrices will be
Cij=A+B=Pij+Qij
In addition of two matrices corresponding elements are added together and
output is a matrix. Addition operation is performed only if two matrices are of
same order.
101

102 CHAPTER 10. MATRIX

1(%i1) A:matrix([1,2,3],[2,1,3],[4,7,4]);
(%i2) B:matrix([1,2,3],[2,1,3],[4,7,4]);
3(%i3) A+B;

(%o3)


2 4 6
4 2 6
8 14 8


10.1.3 Scalar Subtraction of Matrices (-)
The operator-subtract two matrices element by element wise. IfA=Pijand
B=Qijare two matrices then the subtraction of matrixBfromAwill be
Cij=A−B=Pij−Qij
In subtraction of matrixBfrom matrixA, corresponding elements are sub-
tracted with each other and result is a matrix. Subtraction operation is per-
formed only if two matrices are of same order.

1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2) B:matrix([1,2,3],[2,1,3],[4,7,4]);
3(%i3) A-B;

(%o3)


1 0 0
0 3 0
0 0 0


10.1.4 Scalar Multiplication of Matrices (*)
The operator*multiply two matrices element by element wise. IfA=Pijand
B=Qijare two matrices then the multiplication of matrixBtoAwill be
Cij=A∗B=Pij∗Qij
In scalar multiplication of matrixBto matrixA, corresponding elements are
multiply with each other and result is a matrix. Multiplication operation is
performed only if two matrices are of same order.

1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2) B:matrix([1,2,3],[2,1,3],[4,7,4]);
3(%i3) A*B;

10.1. MATHEMATICAL OPERATON 103
(%o3)


2 4 9
4 4 9
16 49 16


10.1.5 Scalar Division of Matrix (/)
The operator/divides two matrices element by element wise. IfA=Pijand
B=Qijare two matrices then the division of matrixAby matrixBwill be
Cij=A/B=Pij/Qij
In scalar division of matrixAby matrixBis performed by dividing elements of
Aby corresponding elements ofB. Division operation is performed only if two
matrices are of same order.

1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2) B:matrix([1,2,3],[2,1,3],[4,7,4]);
3(%i3) A/B;

(%o3)


2 1 1
1 4 1
1 1 1


10.1.6 Exponent of Matrix (ˆ)
The operatorˆraises power of element of one matrix to the base of another
matrix element by element wise. IfA=PijandB=Qijare two matrices then
the exponentA
B
will be
Cij=A
B
=Pij
Qij
Exponent operation is performed only if two matrices are of same order.

1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2) B:matrix([1,2,3],[2,1,3],[4,7,4]);
3(%i3) A^B;

(%o3)


2 2 3
2 4 3
4 7 4






1 2 3
2 1 3
4 7 4



104 CHAPTER 10. MATRIX
If exponent power is not a matrix but is a number then all elements ofbase
matrix are raised to the power by the number.

1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2) A^2;

(%o3)


4 4 9
4 16 9
16 49 16


If exponent operator is ˆˆ then exponent is noncommutative matrix exponenti-
ation. A scalar base to a matrix power is carried out element by element.
10.1.7 Matrix Dot Product (.)
The dot operator,is for non-commutative multiplication of two matrices. When
“.” is preceded and followed by spaces e.g.A·B, then it distinguishes plainly
from a decimal point in a floating point number. If two vectors are
~
A= 1ˆi+
2ˆj+ 3
ˆ
kand
~
B= 3ˆi+ 4ˆj+ 5
ˆ
kthenA·Bis given by
A·B= (1ˆi+ 2ˆj+ 3
ˆ
k)·(3ˆi+ 4ˆj+ 5
ˆ
k)
On simplification
A·B= 26
In dot product, both lists or vectors or non-commutative matrices should be of
same order. An example is

(%i5) a:[1,2,3];
2(%i6) b:[3,4,5];
(%i7) a . b;

(%o7) 26
Another example

1(%i5) a:[1,2,3];
(%i6) b:[8,9];
3(%i7) a . b;


(%o7) MULTIPLYMATRICES:attempt to multiply nonconformable matrices.

10.2. INVERSE OF MATRIX 105
10.2 Inverse of Matrix
10.2.1 Invert of Matrix Elements (Aˆ-1)
If exponent power is−1 over a matrix then elementwise inversion of elements
of the matrix are take place. IfAijis an element of a matrixAthenA
−1
is a
matrix of the elements 1/Aij.

1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2) A^-1;

(%o3)


1/2 1/2 1/3
1/2 1/4 1/3
1/4 1/7 1/4


10.2.2 Inverse of a Matrix (Aˆˆ-1)
Noncommutative exponential ˆˆ is followed by ‘−1’ to a matrix is matrix inver-
sion. IfAis a square matrix then Aˆˆ-1 is matrix inverse.

(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
2(%i2) A^^-1;

(%o3)


5/8−13/8 3/4
−1/2 1/2 0
1/4 3/4−1/2


10.2.3 Append Columns (addcol)
addcolappends one or more lists or matrix,Bp×q, in given matrixAm×nas
columns of matrixAm×n. Row size of matrixBp×qiepshould be equal to the
row size of matrixAm×niem.

(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
2(%i6) B:matrix([2,1,3],[3,1,2],[3,4,4]);
(%i7) addcol(A,B)

(%o7)


1 2 3 2 1 3
4 1 2 3 1 2
5 4 2 3 4 4

106 CHAPTER 10. MATRIX
10.2.4 Append Rows (addrow)
addrowappends one or more lists or matrix,Bp×q, in given matrixAm×nas
rows of matrixAm×n. Column size of matrixBp×qieqshould be equal to the
column size of matrixAm×nien.

1(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
(%i6) B:matrix([2,1,3],[3,1,2],[3,4,4]);
3(%i7) addrow(A,B)

(%o7)








1 2 3
4 1 2
5 4 2
2 1 3
3 1 2
3 4 4








10.2.5 Ajoint of Matrix (adjoint)
adjointreturns the adjoint of a matrixA. Theadjointmatrix is the transpose
of the matrix of co-factors ofA. Co-factor about an elementAijis the (−1)
i+j
times determinant of sub-matrix found by removingi
th
row andj
th
column.
For obtaining adjoint matrix, the matrix must be a square matrix.

1(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
(%i6) adjoint(A)

(%o6)


−6 8 1
2−13 10
11 6 −7


10.2.6 Augmented Matrix (augcoefmatrix)
augcoefmatrixreturns the augmented coefficient matrix for the variablesx1,x2,
. . .,xnof the system of linear equationseqn1,. . .,eqnm. This is the coeffi-
cient matrix with a column adjoined for the constant terms in each equation.
In otherwords, each equation forms one row of the matrix and its coefficients
construct columns for that row. The syntax is

(%i6) augcoefmatrix(
2 <equaion lists>,
[<firstvariable>, <secondvariable>]
4 );

10.2. INVERSE OF MATRIX 107

(%i5) A:[2*x + 3*y=4, -x + 6*y=10]$
2(%i6) augcoefmatrix(A, [x,y]);

(%o6)

2 3 −4
−1 6−10

10.2.7 Cauchy Matrix (cauchymatrix)
cauchymatrixreturns an×mCauchy matrix with the elements
a[i, j] = 1/(xi+yi)
The second argument ofcauchymatrixis optional. In this case Cauchy matrix
with the elements
a[i, j] = 1/(xi+xi)
The syntax for Cauchy matrix is

(%i6) cauchy_matrix([x_1, x_2, ..., x_m],[y_1, y_2, ..., y_n]);

or

1(%i6) cauchy_matrix([x_1, x_2, ..., x_n]);

For example, With two input arguments for Cauchy matrix

1(%i5) cauchy_matrix([a,b],[c,d])

(%o5)



1
c+a
1
d+a
1
c+b
1
d+b



A single argument Cauchy matrix

1(%i5) cauchy_matrix([a,b])

(%o5)



1
2a
1
b+a
1
b+a
1
2b


108 CHAPTER 10. MATRIX
10.2.8 Characteristics Polynomial (charpoly)
charpolyreturns the characteristic polynomial of the matrixAwith respect to
variablex. The characteristics polynomial of a matrixAis given by
|A−λI|
The Maxima syntax equivalent tocharpolyis

1(%i5) determinant(A - diagmatrix(length(A), x))


1(%i5)matrix([1,2],[3,4])$
(%i6) charpoly(%,x);


(%o5) (1-x)(4-x)-6

10.2.9 Coefficient Matrix (coefmatrix)
coefmatrixreturns the coefficient matrix for the variablesx1,x2,. . .,xmof the
system of linear equationseqn1,. . .,eqnm. In otherwords, each equation forms
one row of the matrix and its coefficients construct columns for that row. The
syntax is

1(%i6) coefmatrix(
<equaion lists>,
3 [<firstvariable>, <secondvariable>]
);


(%i5) A:[2*x + 3*y=4, -x + 6*y=10]$
2(%i6) coefmatrix(A, [x,y]);

(%o6)

2 3
−1 6

It differs to theaugcoefmatrixas it ignores the linear equation equality value.
10.2.10 Columns of Matrix (col)
colreturns thei
th
column from a matrixA. The value ofimust be less than
or equal to the size of column of the matrixA. The return value is a matrix.
The syntax for the functioncolis

(%i1) col(<matrix>, <column number>);

10.2. INVERSE OF MATRIX 109
10.2.11 Column Vectors (columnvector)
It returns the column vector of size provided as argument to the functioncolum-
nvector. The syntax used is

1(%i1) columnvector(<number of rows>);

Another functioncovectcan also be used for the same purpose.
10.2.12 Copy Matrix (copymatrix)
It returns a copy of the matrixA. This is the only way to make a copy aside
from copyingAelement by element. The syntax used is

1(%i1) copymatrix(<matrixname>);

10.2.13 Determinant Of Matrix (determinant)
determinantcomputes the determinant value of a matrixA. Symbolically it is
represented by|A|.

1(%i1) A:matrix([2,1,1],[1,2,4],[1,3,4]);
(%i2) determinant(A);


(\%o2) -7

10.2.14 Determinant As Fraction (detout)
By default the variabledetoutis ‘false’. Whendetoutis ‘true’, the determinant
of a matrix whose inverse is computed is factored out of the inverse. For this
switch to have an effect ofdoallmxopsanddoscmxopsand these switches should
be set to ‘false’.

1(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2])$
(%i6) detout:true$
3(%i7) doallmxops:false$
(%i8) doscmxops:false$
5(%i6)invert(A);

(%o7)


−6 8 1
2−13 10
11 6 −7


31

110 CHAPTER 10. MATRIX
10.2.15 Diagonal Matrix (diagmatrix)
It returns a diagonal matrix of sizen×nwith the diagonal elements all equal
tox. The syntax is

1(%i1) diagmatrix(<squarematrixsize>, <diagonal variable x>)

For example

1(%i5) diagmatrix(3,"a")

(%o5)


a0 0
0a0
0 0a


10.2.16 Do All Matrix Operations (doallmxops)
Whendoallmxopsis ‘true’, all operations relating to matrices are carried out.
When it is ‘false’ then the setting of the individualdotswitches govern which
operations are performed. By defaultdoallmxopsis ‘true’.
10.2.17 Do Exponent Operations (domxexpt)
Whendomxexptis ‘true’, a matrix exponential,exp(A)whereAis a matrix, is
interpreted as a matrix with element [i, j] equals toexp (M[i, j]). Otherwise
exp(A)evaluates toexp (ev(A)).domxexptaffects all expressions of the form
base
power
where ‘base’ is an expression assumed scalar or constant, and ‘power’
is a list or matrix.
10.2.18 Do Matrix-Matrix Operations (domxmxops)
Whendomxmxopsis ‘true’, all matrix-matrix or matrix-list operations are car-
ried out (but not scalar-matrix operations); if this switch is ‘false’ such opera-
tions are not carried out. By default it is “false’.
10.2.19 Do Matrix Products (domxnctimes)
Whendomxnctimesis ‘true’, non-commutative products of matrices are carried
out. By default it is “false’.
10.2.20 Do Not Factorize (dontfactor)
dontfactormay be set to a list of variables with respect to which factoring is
not to occur.

10.2. INVERSE OF MATRIX 111
10.2.21 Do Scalar Matrix Operations (doscmxops)
Whendoscmxopsis ‘true’, scalar-matrix operations are carried out. By default
it is ‘false’.
10.2.22 Do Scalar Matrix Operation as Matrix (doscmx-
plus)
Whendoscmxplusis ‘true’, scalar-matrix operations yield a matrix result. This
switch is not subsumed underdoallmxops. By default it is ‘false’.
10.2.23 Product of Zero & Non-Scalar Term (dot0nscsimp)
By defaultdot0nscsimpis ‘true’. Whendot0nscsimpis ‘true’, a non-commutative
product of zero and a nonscalar term is simplified to a commutative product.
10.2.24 Product of Zero & Scalar Term (dot0simp)
By default it is ‘true’. Whendot0simpis ‘true’, a non-commutative product of
zero and a scalar term is simplified to a commutative product.
10.2.25 Product of One & Other Term (dot1simp)
By default it is ‘true’. Whendot1simpis ‘true’, a non-commutative product of
one and another term is simplified to a commutative product.
10.2.26 Associative of Dot Product (dotassoc)
By default it is ‘true’. Whendotassocis ‘true’, an expression (A·B)·Csimplifies
toA·(B·C).
10.2.27 Product of Constant & Other Term (dotconstrules)
By default it is ‘true’. Whendotconstrulesis ‘true’, a non-commutative product
of a constant and another term is simplified to a commutative product.
10.2.28 Distribution in Dot Product (dotdistrib)
By default it is ‘false’. Whendotdistribis ‘true’, an expressionA·(B+C)
simplifies toA·B+A·C.
10.2.29 Simplified to Exponent (dotexptsimp)
By default it is ‘true’. Whendotexptsimpis ‘true’, an expressionA·Asimplifies
toAˆˆ2.

112 CHAPTER 10. MATRIX
10.2.30 Zero Exponsnt (dotident)
Default value ofdotidentis ‘1’.dotidentis the value returned byXˆˆ0.
10.2.31 Dot Screw Rules (dotscrules)
By defaultdotscrulesis ‘false’. Whendotscrulesis true, an expressionA·Cor
C·Asimplifies toC∗AandA·(C∗B) simplifies toC∗(A·B).
10.3 Matrix Characteristics
10.3.1 Echelon Form of Matrix (echelon)
echeloncomputes and returns the echelon form of a matrix by using Gaussian
row elimination method. The echelon form is computed from matrixAby
elementary row operations such that the first non-zero element ineach row in
the resulting matrix is one and the column elements under the first one in each
row are all zero. The matrix used in this function is of the form ofm×n. The
syntax used is

1(%i2) echelon(<matrixname>);

For example

1(%i1) A:matrix([2,0,0],[2,2,4],[2,2,4])$
(%i2) echelon(A);

(%o2)


1 0 0
0 1 2
0 0 0


10.3.2 Eigenvalues (eivals)
The eigenvalue equation for a matrixAis
Av−λv= 0
which is equivalent to
(A−λI)v= 0
whereIis then×nidentity matrix. All possible values ofλare called eigenvalues
of the given matrix. The functioneivalsevaluates the eigenvalues of the given
matrix. This function returns two list of values. The first sublist of the return
value is the list of eigenvalues of the matrix, and the second sublist is the list of
the multiplicities of the eigenvalues in the corresponding order.

10.3. MATRIX CHARACTERISTICS 113

(%i1) A:matrix([2,0,0],[2,2,4],[2,2,4]);
2(%i2) eivals(A);


(%o2) [[0,2,6], [1,1,1]]

10.3.3 Eigenvectors (eivects)
Computes eigenvectors of the matrixA. The return value is a list of two ele-
ments. The first is a list of the eigenvalues ofAand a list of the multiplicities
of the eigenvalues. The second is a list of lists of eigenvectors. There is one list
of eigenvectors for each eigenvalue. There may be one or more eigenvectors in
each list.

1(%i1) A:matrix([2,0,0],[2,2,4],[2,2,4])$
(%i2) eivals(A)$
3(%i3) eivects(A);


(\%o2) [[0,1,-1/2],[1,-1/2,-1/2],[0,1,1]]

10.3.4 Except Matrix (ematrix)
The syntax used inematrixis

1(%i1) ematrix(<rows>, <cols>, <value>, <rowpos>, <col pos>)

It constructs a matrixAwhose all values are zero except thatAij=x. Where
x,iandjrepresents to the ‘value’, ‘row pos’ and ‘col pos’ respectively. For
example

1(%i1) ematrix(3,3,a,2,2)

(%o1)


0 0 0
0a0
0 0 0


10.3.5 User Matrix (entermatrix)
entermatrixreturns a matrix of sizem×nby accepting elements from the user
interactively. The syntax is

1(%i1) entermatrix(<rows>, <cols>)

After pressing enter key, total elements equals tom×nare asked to enter by
user in the console and laterly a matrix is returned using these entered elements.
This function is useful to create a matrix of own choice.

114 CHAPTER 10. MATRIX
10.3.6 Generate Matrix (genmatrix)
genmatrixgenerates a matrix of given size by using a function. The syntax of
functiongenmatrixis

1(%i2)genmatrix(<gen function>, <rows>, <cols>)

For example

1(%i1) h[i,j]:=i+j$
(%i2)genmatrix(h,3,3)

(%o2)


2 3 4
3 4 5
4 5 6


10.3.7 Identity Matrix (ident)
identstands for identity matrix. It generates a square matrix of sizenwhose
other than diagonal elements are zero. Syntax foridentis

(%i1}ident(<squarematrixsize>)

10.3.8 Inverse Matrix (invert)
invertreturns the inverse matrix of square matrixA. IfAis normal square
matrix then inverse matrix isA
−1
and relation between normal square matrix
and inverse matrix isA·A
−1
=I. A matrix is invertible if|A| 6= 0 or constant
terms in its characteristics polynomial is not zero.

1(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2])$
(%i6)invert(A)

(%o6)








6
31
8
31
1
31
2
31

13
31
10
31
11
31
6
31

7
31






10.3. MATRIX CHARACTERISTICS 115
10.3.9 List Elements of Matrix (listmatrixentries)
It returns the elements of a matrixAin form of list.

(%i1) A:matrix([2,0,0],[2,2,4],[2,2,4])$
2(%i2) list_matrix_entries(A);


(\%o2) [2, 0, 0, 2, 2, 4, 2, 2, 4]

10.3.10 Left Side Delimiter (lmxchar)
This variable sets the left side delimiter of the matrix. Default value is ‘[’.New
left side matrix delimiter is set by using this variable like

1(%i1)lmxchar:"|"% A vertical line

10.3.11 Right Side Delimiter (rmxchar)
This variable sets the right side delimiter of the matrix. Default value is‘]’.
New right side matrix delimiter is set by using this variable like

1(%i1)rmxchar:"|"% A vertical line

10.3.12 Adjoin Matrix (adjoin)
It returns the union of the setAwith matrix or listB.adjoincomplains ifA
is not a literal set.adjoinandunionare equivalent; however,adjoinmay be
somewhat faster thanunion.

1(%i5) adjoin (c, {a, b});
(%i6) adjoin (a, {a, b});


(\%o5) {a, b, c}
(\%o6) {a, b}

10.3.13 Transpose of a Matrix (transpose)
Transpose of a matrix is the replacement of rows with columns or viceverse. It
is represented byA

. Determinant of matrixAand its transpose are equal.

(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
2(%i6)transpose(A)

116 CHAPTER 10. MATRIX
(%o6)


1 4 5
2 1 4
3 2 2


10.3.14 Mapping of Matrix (matrixmap)
10.3.15 Expression As Matrix (matrixp)
Returns ‘true’ if the expression is a matrix. Syntax for the functionmatrixpis

(%i1)matrixp(<matrixname>)

10.3.16 Trace of Matrix (mattrace)
mattracereturns the trace of the square matrixA. Tracing of a matrix is the
sum of all elements in main diagonal of the matrixA. To evaluate tracing of
matrix, first load the “nchrpl” macro.

1(%i4)load("nchrpl");
(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
3(%i6)mattrace(A);


(%o6) 4

10.3.17 Minor of Matrix (minor)
minorreturns theMijminor of a matrixA. The syntax used is

1(%i6)minor(<matrix>, <row>, <column>);

MinorMij, of a matrixAis obtained by removingi
th
row andj
th
column. For
example

1(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
(%i6)minor(A,1,1)

(%o6)

1 2
4 2

10.3. MATRIX CHARACTERISTICS 117
10.3.18 Determinant of Matrix (newdet)
newdetcomputes the determinant of the matrixAby the Johnson-Gentleman
tree minor algorithm.newdetreturns the result in CRE form.
10.3.19 Permanent of Matrix (permanent)
permanentcomputes the permanent of the matrixAby the Johnson-Gentleman
tree minor algorithm. A permanent is like a determinant but with no sign
changes.permanentreturns the result in CRE form.
10.3.20 Rank of Matrix (rank)
Rank of a matrix is the number of non zero rows of a matrix when it is simplified
in echelon form. Rank of matrix
A=

1 2
4 2

is ‘2’ while rank of matrix
A=


1 2 3
1 1 4
0 0 0


is also ‘2’ though matricesAandBare of different orders. The syntax for
functionrankis

(%i3)rank(<matrix>)


1(%i1) A:matrix([2,2,3],[2,4,3],[4,7,4]);
(%i2)rank(A);


(%o2) 3

10.3.21 Rationalize to Matrix (ratmx)
Whenratmxis ‘false’, determinant and matrix addition, subtraction, and mul-
tiplication are performed in the representation of the matrix elements and cause
the result of matrix inversion to be left in general representation.
10.3.22 Row of Matrix (row)
rowreturns thej
th
row from a matrixA. The value ofjmust be less than or
equal to the size of row of the matrixA. The return value is a matrix. The
syntax for the functionrowis

1(%i1)row(<matrix>, <rownumber>);

118 CHAPTER 10. MATRIX
10.3.23 Solve To Scalar Matrix (scalarmatrixp)
By default it is ‘true’. Whenscalarmatrixpis ‘true’, then whenever a 1×1
matrix is produced as a result of computing thedotproduct of matrices it is
simplified to a scalar, namely the sole element of the matrix.
10.3.24 Sub Matrix (submatrix)
submatrixreturns the sub matrix from a given matrix by deleting rows and
columns supplied as arguments. Syntax for this function is

1(%i1)submatrix(
<rownumber as integers>,
3 <matrix>,
<col number as integers>
5 );

For example

1(%i5) A:matrix([1,2,3],[4,1,2],[5,4,2]);
(%i6)submatrix(1,A,1)

(%o6)

1 4
2 2

10.3.25 Triangularization of Matrix (triangularize)
triangularizereturns the upper triangular form of the matrixA, as produced
by Gaussian elimination. The return value is the same as echelon, except that
the leading nonzero coefficient in each row is not normalized to 1. Syntax for
the function is

(%i1)triangularize(<matrix>);

10.3.26 Zero Matix (zeromatrix)
zeromatrixreturns a matrix of sizem×nwhose all elements are zeros. Syntax
for this function is

1(%i1)zeromatrix(<rows>, <cols>)

10.3.27 Matrix Element Transpose (matrixelementtranspose)
matrixelementtransposeis the operation applied to each element of a matrix
when it is transposed. Default value ofmatrixelementtransposeis ‘false’.

10.4. SOLUTION OF MATRIX 119
10.3.28 Matrix Element Multiplication (matrixelementmult)
matrixelementmultis the operation invoked in place of multiplication in a ma-
trix multiplication.matrixelementmultcan be assigned any binary operator.
Default value is “*”.
10.3.29 Matrix Element Addition (matrixelementadd)
matrixelementaddis the operation invoked in place of addition in a matrix
multiplication.matrixelementaddcan be assigned any n-ary operator. The
default value is “+”.
10.4 Solution of Matrix

120 CHAPTER 10. MATRIX

Chapter 11
Array
arrayfunction creates an array having user defined elements. The syntax for
the functionarrayis

1(%i1) array(<array name>, <dim 1>, ..., <dim n>)

and it creates one array having ‘n’ elements. More than one arrayscan be
created ifarrayfunction is syntaxed as

1(%i1) array([<arr name 1>, ..., <arr name n>], <dim 1>, ..., <dim n>)

and it creates ‘n’ arrays having same elements.
121

122 CHAPTER 11. ARRAY

Chapter 12
Special Functions
Following functions are known as special functions.
12.1 airy
12.1.1 airyai
12.1.2 airybi
12.1.3 airydai
12.1.4 airydbi
12.2 Bessel Function
Bessel function are classified in four forms those are given below.
12.2.1 Bessel Function of First Kind (besselj)
Bessel functions are the canonical solutionsy(x) of Bessel’s differential equation
x
2
d
2
y
dx
2
+x
dy
dx
+ (x
2
−α
2
)y= 0
for an arbitrary complex numberα(the order of the Bessel function). The most
important cases forαare as integer or half-integer. Bessel functions of the first
kind, denoted asJα(x), are solutions of Bessel’s differential equation that are
finite at the origin (x = 0) for integer or positiveα, and diverge asxapproaches
zero for negative non-integerα. It is possible to define the function by its Taylor
series expansion around x = 0
Jα(x) =

X
m=0
(−1)
m
m! Γ(m+α+ 1)

x
2

2m+α
123

124 CHAPTER 12. SPECIAL FUNCTIONS
where Γ(z) is the gamma function. The syntax for Bessel function of first kind
is

1(%i5) ans=bessel_j (alpha, x)

The example is

1(%i5) bessel_j(1.5,2)


(%o5) 0.49129377868716

12.2.2 Bessel Function of Second Kind (bessely)
The Bessel functions of the second kind, denoted byYα(x) are solutions of the
Bessel differential equation that have a singularity at the origin (x= 0). These
are sometimes called Weber functions after Heinrich Martin Weber, and also
Neumann functions after Carl Neumann.
Yα(x) =
Jα(x) cos(απ)−J−α(x)
sin(απ)

1(%i5) ans=bessel_y (alpha, x)

The example is

1(%i5) bessel_y(1.5,2)


(%o5) -0.3956232813587

12.2.3 Hyperbolic Bessel Function of First Kind (besseli)
This is modified form of Bessel function (hyperbolic Bessel functions) of first
kind.
Iα(x) =i
−α
Jα(ix) =

X
m=0
1
m!Γ(m+α+ 1)

x
2

2m+α
The syntax is

1(%i5) ans=bessel_i (alpha, x)

Example is

1(%i5) bessel_i(1.5,2)


(%o5) 1.09947318863311

12.3. BETA FUNCTION (BETA) 125
12.2.4 Hyperbolic Bessel Function of Second Kind (besselk)
This is modified form of Bessel function (hyperbolic Bessel functions) of second
kind.
Kα(x) =
π
2
I−α(x)−Iα(x)
sin(απ)
The syntax is

1(%i5) ans=bessel_k (alpha, x)

Example is

1(%i5) bessel_k(1.5,2)


(%o5) 0.17990665795209

12.2.5 Expansion of Bessel Function (besselexpand)
If variable ‘x’ is not a number and order is half of an odd integer
1
then evaluation
of bessel functions is not perfomed due tobesselexpandis ‘false’ by default. For
example

1(%i5) bessel_k(3/2,x)


(%o5) bessel_k(3/2,x)

Ifbesselexpandis set to ‘true’ then the bessel function is expanded in terms of
other elementary functions. For example

1(%i4) besselexpand:true;
(%i5) bessel_k(3/2,x)

(%o6)

π

1
x
+ 1
·
e
−x

2

x
Whenbesselexpandis set to ‘true’, Bessel function returns a new identity that
can be used to evaluate various results by putting the value of ‘x’.
12.3 Beta Function (beta)
A beta function is defined as
B(a, b) =
ΓaΓb
Γ(a+b)
1
remember in rational p/q form

126 CHAPTER 12. SPECIAL FUNCTIONS

(%i6) beta(1,2)

(%o6)
1
2
12.4 Gamma Function (gamma)
A Gamma function is represented by
Γ(z) =
Z

0
t
z−1
e
−t
dt
The syntax is

1(%i6)gamma(<a numberorfraction>)

The normalized gamma function
γ(x, a) =
1
Γ(a)
Z
x
0
t
a−1
e
−t
dt
is computed by using the functiongammaincin the syntax like

1(%i6)gamma(0.25)


(%o6) 3.625609908221908

12.5 Euler Function (euler)
Returns then
th
Euler number for nonnegative integer ‘n’. The syntax used is

1(%i6) euler(<a non-negative number>)

Example is

1(%i6) euler(10)


(%o6) -50521

12.6. ERROR FUNCTION (ERF) 127
12.6 Error Function (erf)
It computes the error function according to the relation
erf(z) =
2

π
Z
z
0
e
−t
2
dt
The syntax is

1(%i6) erf(<a numberorfraction>)


1(%i6) erf(0.25)


(%o6) 0.27632639016824

12.7 Laplace Transform (laplace)
Laplace transform of a functionf(x) is given by
L[f(x)] =
Z

0
f(x)e
−sx
dx
Where ‘x’ is old variable and ‘s’ is new variable. Functionlaplacereturns the
laplace transformation of a function. The syntax used is

1(%i6)laplace(<expressionorfunction>, <old variable>, <new variable>)

Example is

1(%i4)laplace(sin(t), t, s);

(%o4)
1
s
2
+ 1
12.7.1 Inverse Laplace Transform (ilt)
Functioniltis abbreviation of “inverse Laplace Transformation”. It is use to
get the inverse of Laplace Transform function. The syntax is

1(%i6)ilt(<expressionorfunction>, <new variable>, <old variable>)

Example is

1(%i4)ilt(1/(x^2+1), s, t);

128 CHAPTER 12. SPECIAL FUNCTIONS
(%o4) sin(t)
12.8 Lagrange Polynomial (lagrange)
12.9 Laguerre Polynomial (laguerre)
A Laguerre equation, of type
x
d
2
y
dx
2
+ (1−x)
dy
dx
+n y= 0
is a second-order linear differential equation. This equation has nonsingular
solutions only ifnis a non-negative integer. The associated Laguerre polynomial
is
Ln(x) =
e
x
n!
d
n
dx
n

e
−x
x
n
·
=
(
d
dx
−1)
n
n!
x
n
Laguerre polynomials are represented asLn(x). Functionlaguerrereturns the
Laguerre polynomial. The syntax used is

1(%i6)laguerre(<degree n>, <independent variable x>)

Example is

1(%i4)laguerre(2, x);

(%o4)
x
2
2
−2x+ 1
12.10 Legendre Polynomial
A Legendre equation is given by
d
dx

(1−x
2
)
dy
dx
λ
+n(n+ 1)y= 0 n >0,|x|<1
and associated polynomial is given by
y=APn(x) +BQn(x) |x|<1
WherePn(x) is given by
Pn(x) =
1
2
n
n!
d
n
dx
n
×
(x
2
−1)
n

12.10. LEGENDRE POLYNOMIAL 129
and it is Legendre polynomial of first kind.Qn(x) is given by
Qn(x) =
1
2
Pn(x) ln

1 +x
1−x
λ
and it is Legendre polynomial of second kind. There are two kinds of Legendre
Polynomials.
12.10.1 Legendre Polynomial of First Kind(legendrep)
The first kind of Legendre polynomial is obtained by using functionlegendrep
like

1(%i6) legendre_p(<degree n>, <independent variable x>)

Example is

1(%i4) legendre_p(2, x);

(%o4)
3x
2
−1
2
12.10.2 Legendre Polynomial of Second Kind(legendre q)
The second kind of Legendre polynomial is obtained by using functionlegendreq
like

1(%i6) legendre_q(<degree n>, <independent variable x>)

Example is

1(%i4) legendre_q(2, x);

(%o4)

3x
2
−1
·
log


x+1
x−1

−6x
4

130 CHAPTER 12. SPECIAL FUNCTIONS
12.11 Jacobians
12.11.1 jacobi
12.11.2 jacobicd
12.11.3 jacobicn
12.11.4 jacobics
12.11.5 jacobidc
12.11.6 jacobidn
12.11.7 jacobids
12.11.8 jacobinc
12.11.9 jacobind
12.11.10 jacobins
12.11.11 jacobip
12.11.12 jacobisc
12.11.13 jacobisd
12.11.14 jacobisn
12.11.15 inversejacobicd
12.11.16 inversejacobicn
12.11.17 inversejacobics
12.11.18 inversejacobidc
12.11.19 inversejacobidn
12.11.20 inversejacobids
12.11.21 inversejacobinc
12.11.22 inversejacobind
12.11.23 inversejacobins
12.11.24 inversejacobisc
12.11.25 inversejacobisd
12.11.26 inversejacobisn
12.12 fourier
12.12.1 fourint
12.12.2 fourintcos
12.12.3 fourintsin
12.12.4 foursimp
12.12.5 foursin
12.13 elliptic
12.13.1 elliptice

Chapter 13
Graphics
13.1 Contour Plot (contourplot)
It plots the contours (curves of equal value) of expression overthe surface region.
Two dimensional contour plot syntax is like

1(%i6) contour_plot(<expression>, <range 1>, <range 2>, ...., [<options>])

Remember that the options are given like

1[<option keyword>, <option value 1>, <option value 2>]

Plotting of circle is given by

1(%i6) contour_plot(x^2 + y^2, [x, -4, 4], [y, -4, 4])

To set off the legends from the plot, use option [legend, false] like

1(%i6) contour_plot(x^2 + y^2, [x, -4, 4], [y, -4, 4],[legend, false])

131

132 CHAPTER 13. GRAPHICS
−4
−3
−2
−1
0
1
2
3
4
−4−3−2−1 0 1 2 3 4
(a)
x
2
+y
2
16
09
04
−4
−3
−2
−1
0
1
2
3
4
−4−3−2−1 0 1 2 3 4
(b)
Figure 13.1: (a) Contour plot of functionf(x) =x
2
+y
2
with radii of 2, 3 and
4 moving from inner to outer. (b) Same contour plot of functionf(xwithout
legends.
13.2 Plotting 2D Plot (plot2d)
plot2ddisplays a plot of one or more expressions as a function of one variable
or parameter. There are three ways of using ofplot2dfunction.

1(%i6)plot2d(
<expr>,
3 <range 1>,
[<options>]
5 ) % For single plot range

or

1(%i7)plot2d(
[<expr 1>, <expr 2>...],
3 [<options>]
) % For multiple plot without range range

or

(%i8)plot2d(
2 [<expr 1>, <expr 2>...],
<range 1>,
4 [<options>]
) % For multiple plot with range

There are two methods of two dimensional plot. First is “discrete” and second
is “parametric”. “Discrete” method can be used in two ways like

1(%i6)plot2d(<expr>, [discrete, [x1, y1], [x2, y2], ...], [<options>])

13.3. THREE DIMENSIONAL PLOTTING (PLOT3D) 133
or

1(%i7)plot2d(
<expr>,
3 [discrete, [[x1, x2, ....], [y1, y2, ...]]],
[<options>]
5 )

First method uses coordinate style while second method uses ‘x’ & ‘y’coordi-
nates separately. “Parametric” method is used like

1(%i6)plot2d(
[parametric,
3 <x expr>,
<y expr>,
5 <t range>,
[<options>]]
7 )

Example is

1(%i6)plot2d([sin(x)], [x,-5,5]);

13.3 Three Dimensional Plotting (plot3d)
plot3dplots a three dimensional plots. The function for three dimensionalplot
is given by
z=f(x, y)
Here, third dimension ‘z’ is calculated by using two dimensional value ‘x,’and
‘y’. The syntax for theplot3dis

1(%i6)plot3d(
[<expr 1>, <expr 2>, ... ],
3 <x range>,
<y range>,
5 [<options>]
)

13.4 Finding Plot Options (plotoptions)
This variable shows the list of all options used in plotting. The description of
these options is given below.
1.gridrepresents to the mess lines along x-axis and y-axis mutually perpen-
dicular to each others. The syntax forgridis like

[grid, <integer>, <integer>]

134 CHAPTER 13. GRAPHICS
2.axesare set either ‘true’ or ‘false’. If axis keyword is set to ‘true’ then
axes are visible in the plot otherwise invisible in the plot. The syntax for
axesis like

1 [axes, true]%forshowing axes in plot
[axes, false]%forhiding axes in plot
3 [axes, <sumbols>]%foruser defined symbolic axes names

3.colorsets the color of plot lines and plot points. There are seven primary
colors “blue”, “red”, “green”, “magenta”, “black” and “cyan”,The syntax
used is

1 [color, <color name>]

4.pointtypesets the plotting points in various forms. The point types are
“bullet”, “circle”, “plus”, “times”, “asterisk”, “box”, “square”, “triangle”,
“delta”, “wedge”, “nabla”, “diamond” and “lozenge”. The syntaxused is

1 [point_type, <type name>]

5.stylesets the style of plotting. The styles are “points” and “lines”. The
syntax used is

1 [style, <style name>]

6. Iflegendsis set ‘true’ then plot legends are shown in the plot figure oth-
erwise legends are not shown in the plot figure. User can assign legends
name by assigning a string value. The syntax used is

1 [legends, <legends name>]%user define name
[legends, true]%showlegends
3 [legends, false]%hide legends

7.xlabelrepresents the label name along the x-axis. The syntax used is

1 [xlabel, <label name>]%user define label name

8.ylabelrepresents the label name along the y-axis. The syntax used is

1 [ylabel, <label name>]%user define label name

9.zlabelrepresents the label name along the z-axis. The syntax used is

1 [zlabel, <label name>]%user define label name

10. Ifboxis set ‘true’ then box is shown around the plot figure and ifboxis
set ‘false’ then box around the plot figure is invisible. The syntax is

13.5. SET PLOT OPTIONS (SET PLOTOPTION) 135

1 [box, true]%showbox around plot figure
[box, false]%hide box around plot figure

11.sphericaltoxyzconverts spherical coordinates into cartesian coordinates.
The syntax is

[transform_xy, spherical_to_xyz]

12. Ifcolorboxis set ‘true’ then color box is shown around the plot figure and
ifcolorboxis set ‘false’ then color box around the plot figure is invisible.
The syntax is

1 [colorbox, true]%showcolor box around plot figure
[colorbox, false]%hide color box around plot figure

13. Iflogxis present in the option then x-axis is converts into logarithm scale.
The syntax is

[logx]%logarithmic scaled x-axis

14.ntickscontrols the number of plot points in theplot2dorplot3dplotting
function. The syntax is

1 [nticks, <integer>]%plot points

15. Axes ranges are controlled by ‘x’, ‘y’ and ‘z’ keyword. The syntax is

1 [x, <minimum value>, <maximum value>]%x range
[y, <minimum value>, <maximum value>]%y range
3 [z, <minimum value>, <maximum value>]%z range

16.elevation&azimuthare used to control the viewing point to a three
dimensional plot. The syntax is

1 [elevation, <integer value from 0 to 360>]%elevation
[azimuth, <integer value from 0 to 360>]%azimuth

13.5 Set Plot Options (setplotoption)
This function is used to set the plot options. The syntax used is

(%i11) set_plot_option([<option keyword>, <opt value 1>,<opt value 2>,
...])

136 CHAPTER 13. GRAPHICS
13.6 Spherical To Cartesian (sphericaltoxyz)
This variable is used to transform Spherical coordinates into Cartesian coordi-
nates.

Chapter 14
Binary Operations
14.1 AND Operation (and)
andis ann−aryinfix operator; its operands are Boolean expressions, and its
result is a Boolean value. It returns ‘true’ if all are ‘true’ logically. The global
flagprederroroperand cannot be determined to be ‘true’ or ‘false’.andprints
an error message whenprederroris ‘true’. Otherwise, operands which do not
evaluate to ‘true’ or ‘false’ are accepted, and the result is a boolean expression.
X Y Z
14.2 OR Operation (or)
oris ann−aryinfix operator; its operands are Boolean expressions, and its
result is a Boolean value. It returns ‘true’ if either of all is ‘true’ logically. The
global flagprederroroperand cannot be determined to be ‘true’ or ‘false’.or
prints an error message whenprederroris ‘true’. Otherwise, operands which
do not evaluate to ‘true’ or ‘false’ are accepted, and the result is aBoolean
expression.
X Y Z
14.3 NOT Operation (not)
notnot is a prefix operator; its operand is a Boolean expression, and itsresult
is a Boolean value. It inverts the supplied argument. The global flagprederror
operand cannot be determined to be ‘true’ or ‘false’.notprints an error message
whenprederroris ‘true’. Otherwise, operands which do not evaluate to ‘true’
or ‘false’ are accepted, and the result is a Boolean expression.
137

138 CHAPTER 14. BINARY OPERATIONS
X Y Z

Chapter 15
File Operations
Following functions are useful for file operations.
15.1 Reading
Now open the file ‘filename’ and see what is stored.
15.1.1 Append Console Transcript to File (appendfile)
appendfileappends the console transcript to a file. The syntax used is

1(%i11) appendfile(<filename>)

During the appending, previous contents of the file ‘filename’ are not erased.
appendfilemust be closed byclosefileat the end of session.
15.1.2 Read File & Evaluate (batch)
This function reads file and evaluates all the expressions. Scope ofthe function is
limited to those files which contains standard Maxima expressions andfunctions
or files written by the Maxima functionwritefile. Syntax of the function is

1(%i11) batch(<filename>)

15.1.3 Type of File (filetype)
filetypereturns a guess about the content of ‘filename’, based on the ‘filename’
extension. ‘filename’ need not refer to an actual file; no attempt ismade to
open the file and inspect the content. The syntax used is

1(%i11) file_type(<filename>)

139

140 CHAPTER 15. FILE OPERATIONS
15.1.4 Evaluation From File From Directory (load)
loadevaluates expressions in ‘filename’, thus bringing variables, functions, and
other objects into Maxima. The synax used is

1(%i11)load(<filename>)

15.1.5 Evaluation From File (loadfile)
loadfileevaluates Lisp expressions in filename.loadfiledoes not invokefilesearch,
as much of the path as needed to find the file.loadfilecan process files created
bysave,translatefileorcompilefile. The syntax used is

1(%i11)loadfile(<filename>)

15.1.6 File Load Path Name (loadpathname)
This variable tells the path from where a file was loaded by using the function
load. If, previously no file was loaded then it returns ‘false’ value.
15.1.7 File Load Print Message (loadprint)
By default it is ‘true’.loadprinttells whether to print a message when a file is
loaded.
1. Whenloadprintis ‘true’, always print a message.
2. Whenloadprintis “loadfile”, print a message only if a file is loaded by the
functionloadfile.
3. Whenloadprintis “autoload”, print a message only if a file is automatically
loaded.
4. Whenloadprintis ‘false’, never print a message.
15.1.8 Show File Contents In Console (printfile)
printfilereads a file and puts all the contents of the file into Maxima console.
The syntax for the function is

1(%i11) printfile(<filename>, all)

15.1.9 Evaluates Expression From File (batchload)
batchloadreads Maxima expressions from filename and evaluates them, with-
out displaying the input or output expressions and without assigninglabels to
output expressions. The syntax used is

1(%i11) batchload(<filename>)

15.2. WRITING 141
15.2 Writing
15.2.1 Write Transcript in File (writefile)
writefilecreats and starts a hook to write a transcript of the Maxima session
to the file specified as ‘filename’. All interaction between the user andMaxima
is then recorded in this file, just as it appears on the console. Remember that
the contents written to file can not be loaded back to Maxima. Afterthe end of
interaction, the file must be closed by using functionclosefile. The syntax for
starting of writting of a file is

1(%i1)writefile(<filename>)

After initiation of hook, do some thing in Maxima and then use the function
closefilelike

1(%i10) closefile(<filename>)

15.2.2 Write Expressions to File (stringout)
stringoutwrites the expressions to the file in the same form as they are written
in console.

1(%i1)stringout(<filename>,<options>)

The given options are “input”, “functions” and “values”. If optionis “input”
then all the inputs in the current session are written to the file name. Similarly,
options “functions” is for functions of the current session and “values” is for all
values of the current session to write in the file. For example

1(%i2)stringout(<filename>,input)

Writes all the inputs of current session to the file name ‘filename’. Expressions
can be directly written to the file by using syntax

1(%i3)stringout(<filename>, <expr 1>, <expr 2>, ....)

15.2.3 fileoutputappend
fileoutputappendgoverns whether file output functions append or truncate
their output file. Whenfileoutputappendis ‘true’, such functions append to
their output file. Otherwise, the output file is truncated. By default it is ‘false’.
15.2.4 Write Output To a File (withstdout)
It evaluates expressions and writes output to a file or output stream. The
evaluated expressions are not written to the output. Output maybe generated
by functionprint,displayorgrind. In otherwords, expression may be arguments
ofprintfunction. The syntax used is

142 CHAPTER 15. FILE OPERATIONS

1(%i11) with_stdout(<file name>, <expr_1>, <expr_2>, <expr_3>, ...)

For Example

1(%i11) with_stdout("c.txt",print(integrate(x,x)) )

It will write the output of the integration of function ‘x’ with respect to ‘x’ in
the file “c.txt”. To see the output, useprintfilefunction like

1(%i11) printfile("c.txt")

There will the output of the integration of function ‘x’ with respectto ‘x’ in the
console.
15.2.5 Save A File (save)
savefunction is used to save contents into a file in the current directoryor path.
If ‘filename’ is absolute path then file is saved in the directory of givenpath. If
‘filename’ is relative path then file is saved in current path. There aretwo main
methods of usingsavefunction.

1(%i1)save(<filename>, <values>, <functions>, <labels>, ...)

If ‘values’, ‘functions’ etc are processing identifications like (%i1), (%o1) etc
then these specific input output values will be saved in the file. Ifsavefunction
is used like

1(%i1)save(<filename>, all)

Then whole session will be saved in the file. For example

1(%i7)save("a.txt",%i5,%o2);

and see the file ‘a.txt’ in current working directory. Similarly second method is

1(%i8)save("a.txt", all);

Contents written to a file bysavefunction can be reloaded by using function
loadfile.
15.2.6 Close Opened File (closefile)
closefilecloses the previously opened file by functionwritefile. Syntax is

1(%i10) closefile(<filename>)

15.3. SEARCH 143
15.3 Search
15.3.1 filesearch
filesearchfunction searches the path or file name and returns the path or file
name if found. If file is not found then it returns ‘false’. The syntax is

1(%i11) file_search(<filename>, <pathlist>)

If argument ‘pathlist’ is omitted then file serach scope is for current directory and
if ‘pathlist’ argument is supplied then file search is restricted to that‘pathlist’
only. For example

1(%i11) file_search("/")

The output is

(%o11) false

15.3.2 filesearchdemo
This variable shows the path of files of demo directoies. The syntax is

1(%i11) file_search_demo;

15.3.3 filesearchmaxima
This variable shows the path of files where Maxima is installed. The syntax is

1(%i11) file_search_maxima;

The file names are expressed in form of $$${<ext 1>,<ext 2>,<ext 3>,...}.
15.3.4 filesearchusage
This variable shows the files of user’s document. The syntax is

1(%i11) file_search_usage;

The file names are expressed in form of $$${<ext 1>,<ext 2>,<ext 3>,...}.
15.3.5 filesearchlisp
This variable shows the files of lisp’s directories. The syntax is

1(%i11) file_search_lisp;

The file names are expressed in form of $$${<ext 1>,<ext 2>,<ext 3>,...}.

144 CHAPTER 15. FILE OPERATIONS
15.3.6 filesearchtests
This variable shows the files of tests directories. The syntax is

1(%i11) file_search_tests;

The file names are expressed in form of $$${<ext 1>,<ext 2>,<ext 3>,...}.
15.3.7 filetypelisp
This variable returns the list of lisp’s extensions.
15.4 Path
15.4.1 filetypemaxima
This variable returns the list of Maxima’s extensions.
15.4.2 pathnamedirectory
pathnamedirectoryreturns the directory path from the supplied path name.
The syntax is

1(%i11) pathname_directory(<pathname>)

For example

1(%i7) pathname_directory("C:/server/a.txt")


(%o7) C:/server/

15.4.3 pathnamename
pathnamenamereturns the name of file from the supplied path name. The
syntax is

1(%i11) pathname_name(<pathname>)

For example

1(%i7) pathname_name("C:/server/a.txt")


(%o7) a

15.4. PATH 145
15.4.4 pathnametype
pathnametypereturns the extension of file from the supplied path name. The
syntax is

1(%i11) pathname_type(<pathname>)

For example

1(%i7) pathname_type("C:/server/a.txt")


(%o7) txt

146 CHAPTER 15. FILE OPERATIONS

Chapter 16
Polynomial
An algebraic relation whose degree is more than two are known as polynomials.
For example
F(x) =ax
3
+bx
2
+cx+d
is a polynomial of third degree.
16.1 Roots
16.1.1 All Roots of Polynomial (allroots)
This command computes all roots, either complex or real, of a polynomial. The
precision value of roots depends on thefpprecvalue. For example

1(%i7) f:x^2-2*x+2$
(%i8) allroots(f);


(%o8) [ x=1.0i + 1.0, x=1.0 - 1.0i ]

16.1.2 All Big Float Roots of Polynomial (bfallroots)
This command computes all roots, either complex or real, of a polynomial. The
roots are big floats. For example

1(%i7) f:x^2-13*x+2$
(%i8) bfallroots(f);


(%o8) [x=1.557112297752398b-1, x=1.284428877022476b1 ]

147

148 CHAPTER 16. POLYNOMIAL
16.1.3 All Roots Within Limits (nroots)
It returns the all of real roots of the real univariate polynomial ranges between
self open interval of (min, max]. The syntax for this function is

1(%i1)nroots(<function>, <minimumlimit>, <maximumlimit>)

For example

1(%i7) f:x^3-4*x+2$
(%i8)nroots(f);


(%o8) 2

16.1.4 Nth Root of Base (nthroot)
Ifpis number whosen
th
root isqasq=
n

pthen
q
n
=P
In Maxima,nthrootis used like

1(%i1)nthroot(<base>, <nth root>)

For example

1(%i8)nthroot(16,4);


(%o8) 2

If there is no perfectnthrootof ‘base’ then there will be a warning message that
“base is not a false-th power”. To see this message, execute following example.

1(%i9)nthroot(15,4);

16.1.5 Real Roots (realroots)
It computes the roots of a uni-variable polynomial and returns onlyreal roots.
A tolerance value can be supplied as argument for rationalization of the real
root. Remember that the coeffiecients of polynomial should be literal numbers
not symbol constants such as %pi. Syntax used for this function is

1(%i1)realroots(<expression>, <tolerance>)


1(%i7) f:x^2-4*x+2$
(%i8)realroots(f);

16.2. FACTOR 149
(%o8)

x=
19655731
33554432
, x=
114561997
33554432
λ
16.2 Factor
16.2.1 Separation of Coefficients (bothcoef)
It returns a list whose first member is the coefficient of x in expression and
whose second member is the remaining part of expression. Assume an expression
A∗x+B. If it is called in functionbothcoefas

(%i1) bothcoef(A*x + B, x)

then it will return a list of both coefficients as

(%o1) [A, B]

16.2.2 Coefficient of Term (coeff)
The syntax forcoeffis

1(%i1) coeff(<expression>, <variable of expression>, <degree of term>)

The scope ofcoeffis list, vector and matrix. If degree of term is not supplied
as argument, then by default it is assumed as ‘1’.

1(%i1) coeff(2*x^2+1, x);
coeff(2*x^2+1, x, 1);
3 coeff(2*x^2+1, x, 2);


(%o1) 0
(%o2) 0
(%o3) 2

16.2.3 Divide Expression (divide)
This function dives first expression by second expression assumingthird argu-
ment as a eliminating variable. The syntax for this function is

1(%i1) divide(<expression 1>, <expression 2>, <main variable>)

It returns a list of two values, first is quotient and second is remainder.

1(%i1) divide(x-y,x+y);

150 CHAPTER 16. POLYNOMIAL

(%o1) [-1, 2x]

Similarly

1(%i1) divide(x-y,x+y,x);


(%o1) [-1, 2y]

16.2.4 Eliminate Variables (eliminate)
It eliminates one or more variables from two or more multi-variable algebraic
relations. This function consists two lists of expression and variables. Syntax is

1(%i1) eliminate([<expr 1>, <expr 2>, ...],[<var 1>, <var 2>, ...])

For example

1(%i1) f1:x^2*y-3*z+y$
(%i2) f2:x-z*y+4*z$
3(%i3) eliminate([f1,f2], [y,z]);

(%o3)
"√
4x
4
+ 3x
3
+ 8x
2
+ 3x+ 4 + 2x
2
+ 2
3
#
16.2.5 Factor of Expression (factor)
It returns the factor of a polynomial or a number. It is used like

1(%i1)factor(<expression>, <minimum poly>)

It factor expression over the field of rationals with an element adjoined whose
minimum polynomial is ‘minimum poly’. It checks following flags before factor-
ing.
1. Iffactorflagis ‘false’ suppresses the factoring of integer factors of rational
expressions.
2. Ifdontfactormay be set to a list of variables with respect to which fac-
toring is not to occur.
3. Ifsavefactorsis ‘true’ causes the factors of an expression which is a product
of factors to be saved by certain functions in order to speed up later
factorizations of expressions containing some of the same factors.
4. Ifberlefactis ‘false’ then the Kronecker factoring algorithm will be used
otherwise the Berlekamp algorithm, which is the default, will be used.

16.2. FACTOR 151
5. Ifintfaclimia ‘true’ Maxima will give up factorization of integers if no
factor is found after trial divisions and Pollard’s rho method. If setto
‘false’ complete factorization of the integer will be attempted.
16.2.6 Rearrange Factors (factorout)
It rearranges the expression in form of sum of terms for a given variable. The
syntax used is

1(%i1)factorout(<expression>, <variable>)

16.2.7 Rearrange Factors of Sum (factorsum)
It tries to group terms in factors of expression which are sums intogroups of
terms such that their sum is factorable.factorsumcan recover the result of

1(%i1)expand((x + y)^2 + (z + w)^2)

but it can’t recover

1(%i1)expand((x + 1)^2 + (x + y)^2)

because the terms have variables in common. Syntax for this function is

1(%i1)factorsum(<expression>)

16.2.8 Greatest Common Divisor (gcd)
It returns the greatest common divisor of two univariable polynomials. Syntax
for this function is

1(%i1)gcd(<poly 1>, <poly 2>, <var>)

Here ‘var’ is that variable for which greatest common divisor will be computed.
If ‘var’ is not supplied as argument to thegcdthen first variable will be consider
as ‘var’. If there is greatest common divisor of two expression thenit is returned
other wise ‘1’ is returned for all ‘var’. For example

1(%i1) f:x^2+y*x+c$
(%i2) g:x*y + x + c$
3(%i3)gcd(f,g);


(%o3) 1

Again

1(%i1) f:x^2 + 2*x + 1$
(%i2) g:x^3 + 1$
3(%i3)gcd(f,g);

152 CHAPTER 16. POLYNOMIAL

(%o3) x+1

16.2.9 Greatest Common Divisor (gcdex)
It returns a list [a, b, u] whereuis the greatest common divisor of univariable
polynomialsfandg, anduis equal toa∗f+b∗g. The syntax is

1(%i3)gcdex(<poly 1>, <poly 2>, <var>);

An example is

1(%i1) f:x^2 + 2*x + 1$
(%i2) g:x^3 + 1$
3(%i3)gcdex(f,g);


(%o3) [-y+2, 1, 3*y+3]

If the two polynomials are integer values then functionigcdexis used.
16.2.10 Gaussian Factor (gfactor)
gfactorcomputes factors of an expression over the Gaussian integer.

1(%i3)gfactor(<polynomial>);

16.2.11 Highest Power (hipow)
It returns the highest exponent of variable ‘x’ of a univariable polynomial. This
function is used like

1(%i1)hipow(<expression>, <variable>)

16.2.12 Lowest Power (lopow)
It returns the lowest exponent of variable ‘x’ of a univariable polynomial. This
function is used like

1(%i1)lopow(<expression>, <variable>)

16.2.13 Return The Coefficient (ratcoef)
ratcoefreturns the coefficient ofxhaving powernwhen used like

1(%i1)ratcoef(<expression>, <variable>, <power>)

16.3. EXPANSION 153
16.2.14 Remainder (remainder)
It returns the remainder of the polynomial ‘poly 1’ when divided by polynomial
‘poly 2’. This function is used as

1(%i1)remainder(<poly 1>, <poly 2>)

16.3 Expansion
16.3.1 rat
16.3.2 Return Denominator (ratdenom)
ratdenomreturns the denominator of the expression.
16.3.3 Expand Ratio (ratdenomdivide)
Whenratdenomdivideis ‘true’,ratexpandexpands a ratio in which the numera-
tor is a sum into a sum of ratios, all having a common denominator. Otherwise,
ratexpandcollapses a sum of ratios into a single ratio, the numerator of which
is the sum of the numerators of each ratio.
16.3.4 Derivative of Rational Number (ratdiff)
It differentiates the rational expression with respect tox. expression must be a
ratio of polynomials or a polynomial inx. The argumentxmay be a variable or a
subexpression of an expression. The result is equivalent todiff, although perhaps
in a different form.ratdiffmay be faster thandiff, for rational expressions.
16.3.5 Rational Expansion (ratexpand)
It expands expression by multiplying out products of sums and exponentiated
sums, combining fractions over a common denominator, cancelling the greatest
common divisor of the numerator and denominator, then splitting the numerator
(if a sum) into its respective terms divided by the denominator.
16.3.6 Rational Factor (ratfac)
Whenratfacis ‘true’, canonical rational expressions (CRE) are manipulated in
a partially factored form.
16.3.7 Is Rational (ratp)
It returns ‘true’ if an expression is a rational expression.

154 CHAPTER 16. POLYNOMIAL
16.3.8 Rational Simplification (ratsimp)
It simplifies to the rational function. The result is returned as the quotient of
two polynomials in a recursive form, that is, the coefficients of the main variable
are polynomials in the other variables.
16.3.9 Simplify Rational Exponent (ratsimpexpons)
When it is set to “true’ratsimpsimplify the rational function by using expo-
nents.
16.3.10 Rational Substitution (ratsubst)
ratsubstis used like

1(%i1)ratsubst(a, b, c)

ratsubstsubstitutes ‘a’ for ‘b’ in ‘c’ and returns the resulting expression. ‘b’
may be a sum, product, power, etc.
16.3.11 Resultant (resultant)
The functionresultantcomputes the resultant of the two polynomials ‘poly 1’
and ‘poly 2’, eliminating the variable ‘x’. This function is used as

1(%i1)resultant(<poly 1>, <poly 2>, <variable>)

Chapter 17
power series
In this section, Taylor series & Poisson series are explained.
17.1 Binomial Series
17.1.1 Define Taylor Function (deftaylor)
deftaylordefines a function as Taylor function. The syntax for the functionis

1(%i1) deftaylor(
<f>,
3 <function expression>,
<subscript var>,
5 <init value>,
<final value>
7 )

A Taylor function may be algebraic or trigonometric expression.
17.1.2 Max Taylor Order (maxtayorder)
Whenmaxtayorderis ‘true’, then during algebraic manipulation of Taylor series,
taylortries to retain as many terms as are known to be correct. By default it
is ‘true’.
17.1.3 Power Series (powerseries)
Iff(x) is given by a convergent power series in an open interval centeredatb
in the complex plane, it is said to be analytic in this interval. Thus forxin this
description,fis given by a convergent power series
f(x) =

X
n=0
an(x−b)
n
155

156 CHAPTER 17. POWER SERIES
powerseriesconverts a Taylor function in a series notation.

1(%i1)powerseries(<f>, <variable>, <pole point>)

17.1.4 Taylor Series (taylor)
The Taylor series of a real or complex-valued functionf(x) that is infinitely
differentiable at a real or complex numberais the power series
f(a) +
f

(a)
1!
(x−a) +
f
′′
(a)
2!
(x−a)
2
+
f
(3)
(a)
3!
(x−a)
3
+· · ·
which can be written in the more compact sigma notation as

X
n=0
f
(n)
(a)
n!
(x−a)
n
wheren! denotes the factorial ofnandf
(n)
(a) denotes then
th
derivative off
evaluated at the pointa. The derivative offof the zero order isfitself and
(x−a)
0
and 0! are both1. Whena= 0, the series is also called a Maclaurin
series. The functiontaylorexpands the expression in a truncated Taylor or
Laurent series of the variable ‘x’ around the point ‘a’, containing terms through
(x−a)
n
. Its syntax is

1(%i1)taylor(
<f>,
3 <variable>,
<pole point>,
5 <upto terms having power n>
)

For example

(%i2)taylor((sqrt(x)), x, a, 4)

(%o2)/T/

a+

a(x−a)
2a

(x−a)
2
8

a a
+
(x−a)
3
16

a a
2

5 (x−a)
4
128

a a
3
+...
17.1.5 taylorlogexpand
It is flag that controls the expansion of logarithmic function. If it is ‘true’ then
all logarithms are expanded fully so that zero-recognition problemsinvolving
logarithmic identities do not disturb the expansion process. If it is ‘false’ then
expansion of necessary logarithms take place to obtain a formal power series.
By default it is ‘true’.

17.1. BINOMIAL SERIES 157
17.1.6 taylorordercoefficients
This flag controls the ordering of coefficients in a Taylor series. By default it is
‘true’.
17.1.7 taylorsimplifier
taylorcalls this function to simplify the coefficients of the power series expres-
sion. Syntax for this function is

1(%i1) taylor_simplifier(<expression>)

17.1.8 taylortruncatepolynomials
Whentaylortruncatepolynomialsis ‘true’, polynomials are truncated based
upon the input truncation levels. Otherwise, polynomials input for taylor are
considered to have infinite precision. By default this flag is set to ‘true’.
17.1.9 Depth of Taylor Terms (taylordepth)
If there are not nonzero terms, taylor doubles the degree of theexpansion ofg(x)
so long as the degree of the expansion is less than or equal ton×2
taylordepth
.
17.1.10 Info of Taylor Series (taylorinfo)
Returns information about the Taylor series expression.
17.1.11 Check Series as Taylor (taylorp)
Returns ‘true’ if expr is a Taylor series, and ‘false’ otherwise.
17.1.12 Print Power Series Message (verbose)
When verbose is ‘true’,powerseriesprints progress messages. By default it is
‘false’.
17.1.13 Integer to Poisson (intopois)
It converts an integer into poisson encoding. Syntax for it is

1(%i1)verbose(<expression>)

158 CHAPTER 17. POWER SERIES
17.1.14 outofpois
The syntax for this function is

1(%i1)outofpois(<A>)

ConvertsAfrom Poisson encoding to general representation. IfAis not in
Poisson form, outofpois carries out the conversion, i.e., the return value is

1(%i1)outofpois(intopois($<$A$>$))

This function is thus a canonical simplified for sums of powers of sine and cosine
terms of a particular type.
17.2 Poisson Series
17.2.1 Poisson Differentiation (poisdiff)
The syntax for this function is

1(%i1)poisdiff(<A>, <B>)

Differentiates ‘A’ with respect to ‘B’.
17.2.2 Poisson Exponent (poisexpt)
The syntax for this function is

1(%i1)poisexpt(<A>, <B>)

Functionally identical tointopois(AˆB). ‘B’ must be a positive integer.
17.2.3 Poisson Integration (poisint)
The syntax for this function is

1(%i1)poisint(<A>, <B>)

Integrates in a similarly restricted sense (to poisdiff). Non-periodicterms in ‘B’
are dropped if ‘B’ is in the trig arguments.
17.2.4 Poisson Limit (poislim)
poislimdetermines the domain of the coefficients in the arguments of the trig
functions.

17.2. POISSON SERIES 159
17.2.5 Poisson Plus (poisplus)
The syntax for this function is

1(%i1)poisplus(<A>, <B>)

It is functionally identical tointopois(A + B).
17.2.6 Poisson Simplification (poissimp)
The syntax for this function is

1(%i1)poissimp(<A>)

This function converts ‘A’ into a Poisson series for ‘A’ in general representation.
17.2.7 Poisson Substitution (poissubst)
The syntax for this function is

1(%i1)poissubst(<A>, <B>, <c>)

This function substitutes ‘A’ for ‘B’ in ‘C’. ‘C’ is a Poisson series.
17.2.8 Poisson Multiplicaiton (poistimes)
The syntax for this function is

1(%i1) poistimest(<A>, <B>)

It is functionally identical tointopois(A*B).
17.2.9 Print Poisson Series (printpois)
The syntax for this function is

1(%i1)printpois()

This function prints a Poisson series in a readable format. In commonwith
outofpois, it will convert a into a Poisson encoding first, if necessary.

160 CHAPTER 17. POWER SERIES

Chapter 18
Sets
In this section, use of Maxima in Set is explained.
18.1 Properties of Sets
18.1.1 Distinct Elements of The Set (cardinality)
It returns the number of distinct elements of the set ‘A’. Syntax ofthe function
is

1(%i1) cardinality(<set handle>)

Example is

1(%i4) A:{1,2,4,8,6,5,8,4,7}$
(%i5) cardinality(A);


(%o5) 7

18.1.2 Disjoin of Sets (disjoin)
The syntax fordisjoinfunction is

1(%i1) disjoin(<Set A>, <Set B>)

disjoinreturns the set ‘B’ without the member of set ‘A’. If ‘A’ is not a member
of ‘B’, return ‘B’ unchanged. Example is

1(%i4) A:{8,7}$
(%i5) B:{2,4}$
3(%i6) disjoin(A, B);


(%o6) {2,4}

161

162 CHAPTER 18. SETS
18.1.3 Disjoint Sets (disjointp)
It returns ‘true’ if and only if both sets are disjoint.
18.1.4 Element of a Set (elementp)
It returns ‘true’ if and only if element ‘x’ is a member of set ‘A’ when this
function is used like

1(%i1) elementp(<element>, <Set A>)

Example is

1(%i5) A:{2,4}$
(%i6) elementp(2, A);


(%o6) true

18.1.5 Empty Set (emptyp)
It returns “true’ if and only if a set is an empty set.

1(%i1) emptyp(<Set A>)

18.1.6 External Subset (extremalsubset)
The syntax for this function is

1(%i1) extremal_subset(<Set A>, <f>, <predicate>)

It returns the subset of ‘A’ for which the function ‘f’ takes on predicate values.
The predicate value is either “minimum” or “maximum”.
18.1.7 flatten
18.1.8 fulllistify
18.1.9 List From a Set (listify)
It returns a list containing the members of ‘A’ when ‘A’ is a set. Otherwise,
listifyreturns ‘A’. Syntax for this function is

1(%i1)listify(<A>)

Example is

1(%i5) A:{2,4,6}$
(%i6)listify(A);


(%o6) [2,4,6]

18.1. PROPERTIES OF SETS 163
18.1.10 Construct a Set (makeset)

1(%i1)makeset(<expression>, <x>, <s>)

Returns a set with members generated from the expression, where ‘x’ is a list
of variables in expression, and ‘s’ is a set or list of lists. To generate each set
member, expression is evaluated with the variables ‘x’ bound in parallel to a
member of ‘s’. For example

1(%i1)makeset(j/k, [j,k], [[1,a],[3,v],[6,j],[a,b]])

(%o1)

1
a
,
a
b
,
6
j
,
3
v
σ
Again

1(%i1)makeset(k/j, [j,k], [[1,a],[3,v],[6,j],[a,b]])

(%o1)

a,
b
a
,
j
6
,
v
3
σ
18.1.11 Partition of Set (partitionset)
partitionsetreturns a list of two sets. The first set comprises the elements
of ‘A’ for which ‘predicate’ evaluates to ‘false’, and the second comprises any
other elements of set ‘A’.partitionsetdoes not apply to the return value of
‘predicate’. Syntax for this function is

1(%i1) partition_set(<A>, <predicate>)

18.1.12 Ordered Permutations of a Set (permutations)
This command returns a set of all distinct permutations of the members of the
list or set ‘A’. Each permutation is a list, not a set. When ‘A’ is a list, duplicate
members of ‘A’ are included in the permutations. The syntax of the function is

1(%i1)permutations(<A>)

18.1.13 Random Permutation (random permutation)
randompermutationreturns random permutations of the set or list ‘A’, as con-
structed by the Knuth shuffle algorithm.

164 CHAPTER 18. SETS
18.1.14 Check Set Equality (setequalp)

1(%i1) setequalp(<A>, <B>)

returns ‘true’ if sets ‘A’ and ‘B’ have the same number of elements andis(x =
y)is true for ‘x’ in the elements of ‘A’ and ‘y’ in the elements of ‘B’.
18.1.15 Check For argument as Set (setp)
This function returns ‘true’ if argument is a Maxima set. Syntax forthis function
is

1(%i1)setp(<Set A>)

18.2 Operations On Sets
18.2.1 Maximum Element Value of a Set (lmax)
It returns the element wich has maximum value in a list or in a set. The syntax
is

1(%i1) lmax(<A>)

When ‘A’ is not a list or a set, Maxima shows error. Example is

1(%i5) A:{2,4,6}$
(%i6) lmax(A);


(%o6) 6

18.2.2 Minimum Element Value of a Set (lmin)
It returns the element wich has minimum value in a list or in a set. The syntax
is

1(%i1) lmin(<A>)

When ‘A’ is not a list or a set, Maxima shows error. Example is

1(%i5) A:{2,4,6}$
(%i6) lmin(A);


(%o6) 2

18.2. OPERATIONS ON SETS 165
18.2.3 Sub Set (subset)
The syntax for this function is

1(%i1)subset(<Set A>, <predicate>)

The argument ‘predicate’ controls the elemetns of subset being extracted from
the set ‘A’. Few examples of ‘predicate’ are “atom”, “evenp”, “oddp”, “min”,
“max” etc. For example

1(%i1)subset({1,2,3,4,5,6}, evenp)


(%o1) [2, 4, 6]

18.2.4 Predicate Subset (subsetp)
It returns ‘true’ if ‘A’ is a sub set of ‘B’ when this fucntion is used like

1(%i1)subsetp(<A>, <B>)

18.2.5 Symmentric Difference (symmdifference)
It returns the symmetric difference of set ‘B’ from set ‘A’ if used like

1(%i1)symmdifference(<A>, <B>)

18.2.6 Subtraction of Sets (setdifference)
Returns a set containing the elements in the set ‘A’ that are not in the set ‘B’.
Syntax for this function is

1(%i1)setdifference(<A>, <B>)

18.2.7 Cartesian Product (cartesianproduct)
It returns the set of list of cartesian product of two sets. Syntax for this function
is

1(%i1) cartesian_product(<Set A>, <Set B>)

Example is

1(%i4) A:{8,7}$
(%i5) B:{2,4}$
3(%i6) cartesian_product(A, B);


(%o6) {[7,2],[7,4],[8,2],[8,4]}

166 CHAPTER 18. SETS
18.2.8 Intersection of Sets (intersection)
This function returns a set containing the elements that are common to the sets
‘A1’ through ‘An’.intersectioncomplains if any argument is not a literal set.
This function is used like

1(%i1)intersection(<Set A>, <Set B>, ...., <Set Z>)

Example is

1(%i4) A:{2,4,6}$
(%i5) B:{3,4}$
3(%i6)intersection(A, B);


(%o6) {4}

18.2.9 Power Set (powerset)
The function

1(%i1)powerset(<A>)

returns the set of all subsets of the set ‘A’. If cardinality of the set ‘A’ isnthen
powerset(<A>)has 2
n
members. The cardinality of the set is calculated by
using the functioncardinalityas

1(%i1) cardinality(<A>)

18.2.10 Union Of Sets (union)
It returns the union of two or more sets. This function is used like

1(%i1)union(<Set A>, <Set B>, ...., <Set Z>)

Example is

1(%i4) A:{2,4,6}$
(%i5) B:{3,4}$
3(%i6)union(A, B);


(%o6) {2,3,4,6}

Chapter 19
Statistics
Package “descriptive” contains a set of functions for making descriptive sta-
tistical computations and graphing. Following functions, commands, flags and
variables are defined in this package and to use it, first load the “descriptive”
packege by using the syntax of functionloadlike

1(%i1)load(descriptive)$

19.1 Plotting
19.1.1 Bar Plot of Data (barsplot)
It plots bars diagrams for discrete statistical variables, both forone or multiple
samples. Syntax for this function is

1(%i1) barsplot(<data 1>, ..., <data n>, <option 1>, ...., <option n>);

Options, those can be used in bar plots are
1.boxwidth: width of bar rectangles.
2.grouping: indicates how multiple samples are shown. Valid values are:
“clustered” and “stacked”.
3.groupsgap: a positive integer number representing the gap between two
consecutive groups of bars.
4.barscolors: a list of colors for multiple samples. When there are more
samples than specified colors, the extra necesary colors are chosen at ran-
dom.
5.frequency: indicates the scale of the ordinates. Possible values are: “ab-
solute”, “relative”, and “percent”.
167

168 CHAPTER 19. STATISTICS
6.ordering: possible values are “orderlessp” or “ordergreatp”, indicating
how statistical outcomes should be ordered on the x-axis.
7.samplekeys: a list with the strings to be used in the legend. When the
list length is other than 0 or the number of samples, an error message is
returned.
8.startat: indicates where the plot begins to be plotted on the x axis.
All global draw options, exceptxtics, which is internally assigned by barsplot.
If, there is requirement for custom values for this option or build a complex
scenes, usebarsplotdescriptionas in following example

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) <list 2>:makelist(<rules of list>)$
(%i4) <bp descr 1>:barsplot_description(<list 1>, <optionvalues>)$
5(%i5) <bp descr 2>:barsplot_description(<list 2>, <optionvalues>)$
(%i6) draw(gr2d(<bp descr 1>), gr2d(<bp descr 2>))$

19.1.2 Error Box Plot of Data (boxplot)
19.1.3 Stem Plot (stemplot)
19.1.4 Pie Chart (piechart)
19.1.5 Scatterin Plot of Data (scatterplot)
19.1.6 Asterisk Plot of Data (starplot)
19.1.7 Histogram Plot (histogram)
19.2 Regression & Correlation
19.2.1 Building a Sample (buildsample)
19.2.2 Correlation (cor)
19.2.3 Covariance Matrix (cov)
The covariance matrix of the multivariate sample, defined as
S=
1
n
n
X
j=1
(Xj−
ˉ
X)(Xj−
ˉ
X)

WhereXjis the element of thej
th
row of a matrix. Syntax for this command
is

19.3. MEAN, MEDIAN & DEVIATION 169

(%i1)load(descriptive)$
2(%i2) m:<amatrix>$
(%i3) cov(m)

For example

1(%i4) s: matrix([1,2,4],[8,6,5],[8,4,7])$
(%i5) cov(s);

(%o4)










98
9
14
3
28
9
14
3
8
3
2
3
28
9
2
3
14
9










19.2.4 Covariance of Type One (cov1)
The covariance matrix of the multivariate sample, defined as
S1=
1
n−1
n
X
j=1
(Xj−
ˉ
X)(Xj−
ˉ
X)

WhereXjis the element of thej
th
row of a matrix.
19.2.5 Coefficient Variation (cv)
The variation coefficient is the quotient between the sample standard deviation
(std) and the mean. It is obtained by functioncv. Syntax for this function is

(%i4) cv(<listor matrix>)

19.2.6 List Correlation (listcorrelations)
19.3 Mean, Median & Deviation
19.3.1 Average or Mean (mean)
The mean of samples of data is given by
ˉx=
1
n
n
X
i=1
xi
Syntax formeanis

170 CHAPTER 19. STATISTICS

1(%i1)load(descriptive)$
(%i2) s:makelist(<rules of list>)$
3(%i3) mean(s),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) mean(s),numer;


(%o4) 5

The samples may be in a list or in a matrix form.
19.3.2 Mean Deviation (mean deviation)
The mean deviation of samples of data is given by
dm=
1
n
n
X
i=1
|xi−ˉx|
Syntax formeandeviationis

1(%i1)load(descriptive)$
(%i2) s:makelist(<rules of list>)$
3(%i3) mean_deviation(s),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) mean_deviation(s),numer;


(%o4) 2

The samples may be in a list or in a matrix form.
19.3.3 Median (median)
Once the sample is ordered, if the sample size is odd the median is the central
value, otherwise it is the mean of the two central values.

1(%i1)load(descriptive)$
(%i2) s:makelist(<rules of list>)$
3(%i3) median(s),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) median(s),numer;


(%o4) 5

19.3. MEAN, MEDIAN & DEVIATION 171
19.3.4 Deviation from Median (median deviation)
The median deviation of samples of data is given by
Dm=
1
n
n
X
i=1
|xi−med|
Syntax formeandeviationis

1(%i1)load(descriptive)$
(%i2) s:makelist(<rules of list>)$
3(%i3) median_deviation(s),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) median_deviation(s),numer;


(%o4) 2

The samples may be in a list or in a matrix form.
19.3.5 Continuous Frequency (continuousfreq)
19.3.6 Discrete Frequency (discretefreq)
19.3.7 Geometric Means (geometric mean)
Geometric mean of given sample statistical data of lengthnis given by
GM=

n
Y
i=1
xi
!
1/n
The syntax used for this commmand is

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) geometric_mean(<list 1>),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) geometric_mean(s),numer;


(%o4) 4.226198741306655

The samples may be in a list or in a matrix form.

172 CHAPTER 19. STATISTICS
19.3.8 Harmonic Mean (harmonic mean)
Harmonic mean of given sample statistical data of lengthnis given by
HM=
n
P
n
i=1
1
xi
The syntax used for this commmand is

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) harmonic_mean(<list 1>),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) harmonic_mean(s),numer;


(%o4) 3.261432269197584

The samples may be in a list or in a matrix form.
19.3.9 Range of Data (range)
The range is the difference between the extreme values of a list or a matrix.
Syntax forrangeis

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) range(<list 1>),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) range(s),numer;


(%o4) 6

19.3.10 Maximum Value of Sample List (smax)
It returns the maximum value of a sample list or matrix. When the argument
is a matrix,smaxreturns a list containing the maximum values of the columns,
which are associated to statistical variables. Syntax for thesmaxis

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) smax(<list 1>),numer;

19.3. MEAN, MEDIAN & DEVIATION 173
19.3.11 Minimum Value of Sample List (smin)
It returns the minimum value of a sample list or matrix. When the argument
is a matrix,sminreturns a list containing the minimum values of the columns,
which are associated to statistical variables. Syntax for thesmaxis

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) smin(<list 1>),numer;

19.3.12 Standard Deviation (std)
This is the the square root of variance when variance is calculated with denom-
inatorn.
SD=

σn
19.3.13 Standard Deviation Type One (std1)
This is the the square root of variance when variance is calculated with denom-
inatorn−1.
SD=

σn−1
19.3.14 Transforming Samples (tranform sample)
The syntax for this function is

1(%i1)load(descriptive)$
(%i2) tranform_sample (<matrix>, <varlist>, <exprlist>)

It transforms the sample matrix, where each column is called according to
‘varlist’, following expressions in ‘exprlist’.
19.3.15 Variance (var)
This is sample variance, defined as
σ=
1
n
n
X
i=1
(xi−ˉx)
2
Syntax for thevaris

(%i1)load(descriptive)$
2(%i2) <list 1>:makelist(<rules of list>)$
(%i3) var(<list 1>),numer;

The sample may be a list or a matrix. For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) var(s),numer;

174 CHAPTER 19. STATISTICS

(%o4) 5.555555555555555

19.3.16 Variance of Type One (var1)
This is sample variance, defined as
σ=
1
n−1
n
X
i=1
(xi−ˉx)
2
Syntax for thevaris

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) var1(<list 1>),numer;

The sample may be a list or a matrix. For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) var1(s),numer;


(%o4) 6.25

19.4 Skew, Kurosis & Moment
19.4.1 Skewness of Data (skewness)
The coeffcient of skewness of given sample statistical data of lengthnis given
by
ks=
1
n s
3
n
X
i=1
(xi−ˉx)
3
The syntax used for this commmand is

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) skewness(<list 1>),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) skewness(s),numer;


(%o4) -0.25455844122716

The samples may be in a list or in a matrix form.

19.4. SKEW, KUROSIS & MOMENT 175
19.4.2 Pearson Skewness (pearsonskewness)
Coefficient of Pearson’s Skewness is given by
Ps=
3(ˉx−med)
s
Heremedis median of the list. The sample data here may be in form of a
matrix. Syntax for this function is

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) pearson_skewness(<list 1>),numer;

For example

1(%i4) s:[2,2,4,8,6,5,8,4,7]$
(%i5) pearson_skewness(s),numer;


(%o4) 0.14396315014974

19.4.3 Quartile Skewness (quartileskewness)
The coeffcient of quartile skewness of given sample statistical dataof lengthn
is given by
Qs=
C
3/4−2C
1/2+C
1/4
C
3/4−C
1/4
WhereCpis thep−quantile of sample list. The syntax used for this commmand
is

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) quartile_skewness(<list 1>),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) quartile_skewness(s),numer;


(%o4) 0.33333333333333

The samples may be in a list or in a matrix form.
19.4.4 Kurtosis (kurtosis)
The coeffcient of kurtosis of given sample statistical data of lengthnis given by
k=
1
n s
4
n
X
i=1
(xi−ˉx)
4
−3
The syntax used for this commmand is

176 CHAPTER 19. STATISTICS

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) kurtosis(<list 1>),numer;

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) kurtosis(s),numer;


(%o4) -1.1352

The samples may be in a list or in a matrix form.
19.4.5 noncentralmoment
19.4.6 Central Moment of Data (centralmoment)
Central moment of orderkof given statistical data about mean or average value
is given by
µ=
1
n
n
X
i=1
(xi−ˉx)
k
The syntax used for this commmand is

1(%i1)load(descriptive)$
(%i2) <list 1>:makelist(<rules of list>)$
3(%i3) central_moment(<list 1>, <order k>)

For example

1(%i4) s:[1,2,4,8,6,5,8,4,7]$
(%i5) central_moment(s, 2);


(%o4) 50/9

The samples may be in a list or in a matrix form.