Fix the call to set_network_coding_system
[emacs.git] / lisp / calc / calc-menu.el
blobff9a3d3d5f03ff07dd1f6eb0fd7c354d2cc604a0
1 ;;; calc-menu.el --- a menu for Calc
3 ;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20 ;;; Commentary:
22 (defvar calc-arithmetic-menu
23 (list "Arithmetic"
24 (list "Basic"
25 ["-(1:)" calc-change-sign
26 :keys "n" :active (>= (calc-stack-size) 1)]
27 ["(2:) + (1:)" calc-plus
28 :keys "+" :active (>= (calc-stack-size) 2)]
29 ["(2:) - (1:)" calc-minus
30 :keys "-" :active (>= (calc-stack-size) 2)]
31 ["(2:) * (1:)" calc-times
32 :keys "*" :active (>= (calc-stack-size) 2)]
33 ["(2:) / (1:)" calc-divide
34 :keys "/" :active (>= (calc-stack-size) 2)]
35 ["(2:) ^ (1:)" calc-power
36 :keys "^" :active (>= (calc-stack-size) 2)]
37 ["(2:) ^ (1/(1:))"
38 (progn
39 (require 'calc-ext)
40 (let ((calc-inverse-flag t))
41 (call-interactively 'calc-power)))
42 :keys "I ^"
43 :active (>= (calc-stack-size) 2)
44 :help "The (1:)th root of (2:)"]
45 ["abs(1:)"
46 (progn
47 (require 'calc-arith)
48 (call-interactively 'calc-abs))
49 :keys "A"
50 :active (>= (calc-stack-size) 1)
51 :help "Absolute value"]
52 ["1/(1:)"
53 (progn
54 (require 'calc-arith)
55 (call-interactively 'calc-inv))
56 :keys "&"
57 :active (>= (calc-stack-size) 1)]
58 ["sqrt(1:)"
59 (progn
60 (require 'calc-math)
61 (call-interactively 'calc-sqrt))
62 :keys "Q"
63 :active (>= (calc-stack-size) 1)]
64 ["idiv(2:,1:)"
65 (progn
66 (require 'calc-arith)
67 (call-interactively 'calc-idiv))
68 :keys "\\"
69 :active (>= (calc-stack-size) 2)
70 :help "The integer quotient of (2:) over (1:)"]
71 ["(2:) mod (1:)"
72 (progn
73 (require 'calc-misc)
74 (call-interactively 'calc-mod))
75 :keys "%"
76 :active (>= (calc-stack-size) 2)
77 :help "The remainder when (2:) is divided by (1:)"])
78 (list "Rounding"
79 ["floor(1:)"
80 (progn
81 (require 'calc-arith)
82 (call-interactively 'calc-floor))
83 :keys "F"
84 :active (>= (calc-stack-size) 1)
85 :help "The greatest integer less than or equal to (1:)"]
86 ["ceiling(1:)"
87 (progn
88 (require 'calc-arith)
89 (call-interactively 'calc-ceiling))
90 :keys "I F"
91 :active (>= (calc-stack-size) 1)
92 :help "The smallest integer greater than or equal to (1:)"]
93 ["round(1:)"
94 (progn
95 (require 'calc-arith)
96 (call-interactively 'calc-round))
97 :keys "R"
98 :active (>= (calc-stack-size) 1)
99 :help "The nearest integer to (1:)"]
100 ["truncate(1:)"
101 (progn
102 (require 'calc-arith)
103 (call-interactively 'calc-trunc))
104 :keys "I R"
105 :active (>= (calc-stack-size) 1)
106 :help "The integer part of (1:)"])
107 (list "Complex Numbers"
108 ["Re(1:)"
109 (progn
110 (require 'calc-cplx)
111 (call-interactively 'calc-re))
112 :keys "f r"
113 :active (>= (calc-stack-size) 1)]
114 ["Im(1:)"
115 (progn
116 (require 'calc-cplx)
117 (call-interactively 'calc-im))
118 :keys "f i"
119 :active (>= (calc-stack-size) 1)]
120 ["conj(1:)"
121 (progn
122 (require 'calc-cplx)
123 (call-interactively 'calc-conj))
124 :keys "J"
125 :active (>= (calc-stack-size) 1)
126 :help "The complex conjugate of (1:)"]
127 ["length(1:)"
128 (progn (require 'calc-arith)
129 (call-interactively 'calc-abs))
130 :keys "A"
131 :active (>= (calc-stack-size) 1)
132 :help "The length (absolute value) of (1:)"]
133 ["arg(1:)"
134 (progn
135 (require 'calc-cplx)
136 (call-interactively 'calc-argument))
137 :keys "G"
138 :active (>= (calc-stack-size) 1)
139 :help "The argument (polar angle) of (1:)"])
140 (list "Conversion"
141 ["Convert (1:) to a float"
142 (progn
143 (require 'calc-ext)
144 (call-interactively 'calc-float))
145 :keys "c f"
146 :active (>= (calc-stack-size) 1)]
147 ["Convert (1:) to a fraction"
148 (progn
149 (require 'calc-ext)
150 (call-interactively 'calc-fraction))
151 :keys "c F"
152 :active (>= (calc-stack-size) 1)])
153 (list "Binary"
154 ["Set word size"
155 (progn
156 (require 'calc-bin)
157 (call-interactively 'calc-word-size))
158 :keys "b w"]
159 ["Clip (1:) to word size"
160 (progn
161 (require 'calc-bin)
162 (call-interactively 'calc-clip))
163 :keys "b c"
164 :active (>= (calc-stack-size) 1)
165 :help "Reduce (1:) modulo 2^wordsize"]
166 ["(2:) and (1:)"
167 (progn
168 (require 'calc-bin)
169 (call-interactively 'calc-and))
170 :keys "b a"
171 :active (>= (calc-stack-size) 2)
172 :help "Bitwise AND [modulo 2^wordsize]"]
173 ["(2:) or (1:)"
174 (progn
175 (require 'calc-bin)
176 (call-interactively 'calc-or))
177 :keys "b o"
178 :active (>= (calc-stack-size) 2)
179 :help "Bitwise inclusive OR [modulo 2^wordsize]"]
180 ["(2:) xor (1:)"
181 (progn
182 (require 'calc-bin)
183 (call-interactively 'calc-xor))
184 :keys "b x"
185 :active (>= (calc-stack-size) 2)
186 :help "Bitwise exclusive OR [modulo 2^wordsize]"]
187 ["diff(2:,1:)"
188 (progn
189 (require 'calc-bin)
190 (call-interactively 'calc-diff))
191 :keys "b d"
192 :active (>= (calc-stack-size) 2)
193 :help "Bitwise difference [modulo 2^wordsize]"]
194 ["not (1:)"
195 (progn
196 (require 'calc-bin)
197 (call-interactively 'calc-not))
198 :keys "b n"
199 :active (>= (calc-stack-size) 1)
200 :help "Bitwise NOT [modulo 2^wordsize]"]
201 ["left shift(1:)"
202 (progn
203 (require 'calc-bin)
204 (call-interactively 'calc-lshift-binary))
205 :keys "b l"
206 :active (>= (calc-stack-size) 1)
207 :help "Shift (1:)[modulo 2^wordsize] one bit left"]
208 ["right shift(1:)"
209 (progn
210 (require 'calc-bin)
211 (call-interactively 'calc-rshift-binary))
212 :keys "b r"
213 :active (>= (calc-stack-size) 1)
214 :help "Shift (1:)[modulo 2^wordsize] one bit right, putting 0s on the left"]
215 ["arithmetic right shift(1:)"
216 (progn
217 (require 'calc-bin)
218 (call-interactively 'calc-rshift-arith))
219 :keys "b R"
220 :active (>= (calc-stack-size) 1)
221 :help "Shift (1:)[modulo 2^wordsize] one bit right, duplicating the leftmost bit"]
222 ["rotate(1:)"
223 (progn
224 (require 'calc-bin)
225 (call-interactively 'calc-rotate-binary))
226 :keys "b t"
227 :active (>= (calc-stack-size) 1)
228 :help "Rotate (1:)[modulo 2^wordsize] one bit left"])
229 "-------"
230 ["Help on Arithmetic"
231 (calc-info-goto-node "Arithmetic")])
232 "Menu for Calc's arithmetic functions.")
234 (defvar calc-scientific-function-menu
235 (list "Scientific Functions"
236 (list "Constants"
237 ["pi"
238 (progn
239 (require 'calc-math)
240 (call-interactively 'calc-pi))
241 :keys "P"]
242 ["e"
243 (progn
244 (require 'calc-math)
245 (let ((calc-hyperbolic-flag t))
246 (call-interactively 'calc-pi)))
247 :keys "H P"]
248 ["phi"
249 (progn
250 (require 'calc-math)
251 (let ((calc-inverse-flag t)
252 (calc-hyperbolic-flag t))
253 (call-interactively 'calc-pi)))
254 :keys "I H P"
255 :help "The golden ratio"]
256 ["gamma"
257 (progn
258 (require 'calc-math)
259 (let ((calc-inverse-flag t))
260 (call-interactively 'calc-pi)))
261 :keys "I P"
262 :help "Euler's constant"])
263 (list "Logs and Exps"
264 ["ln(1:)"
265 (progn
266 (require 'calc-math)
267 (call-interactively 'calc-ln))
268 :keys "L"
269 :active (>= (calc-stack-size) 1)
270 :help "The natural logarithm"]
271 ["e^(1:)"
272 (progn
273 (require 'calc-math)
274 (call-interactively 'calc-exp))
275 :keys "E"
276 :active (>= (calc-stack-size) 1)]
277 ["log(1:) [base 10]"
278 (progn
279 (require 'calc-math)
280 (call-interactively 'calc-log10))
281 :keys "H L"
282 :active (>= (calc-stack-size) 1)
283 :help "The common logarithm"]
284 ["10^(1:)"
285 (progn
286 (require 'calc-math)
287 (let ((calc-inverse-flag t))
288 (call-interactively 'calc-log10)))
289 :keys "I H L"
290 :active (>= (calc-stack-size) 1)]
291 ["log(2:) [base(1:)]"
292 (progn
293 (require 'calc-math)
294 (call-interactively 'calc-log))
295 :keys "B"
296 :active (>= (calc-stack-size) 2)
297 :help "The logarithm with an arbitrary base"]
298 ["(2:) ^ (1:)"
299 calc-power
300 :keys "^"
301 :active (>= (calc-stack-size) 2)])
302 (list "Trigonometric Functions"
303 ["sin(1:)"
304 (progn
305 (require 'calc-math)
306 (call-interactively 'calc-sin))
307 :keys "S"
308 :active (>= (calc-stack-size) 1)]
309 ["cos(1:)"
310 (progn
311 (require 'calc-math)
312 (call-interactively 'calc-cos))
313 :keys "C"
314 :active (>= (calc-stack-size) 1)]
315 ["tan(1:)"
316 (progn
317 (require 'calc-math)
318 (call-interactively 'calc-tan))
319 :keys "T"
320 :active (>= (calc-stack-size) 1)]
321 ["arcsin(1:)"
322 (progn
323 (require 'calc-math)
324 (call-interactively 'calc-arcsin))
325 :keys "I S"
326 :active (>= (calc-stack-size) 1)]
327 ["arccos(1:)"
328 (progn
329 (require 'calc-math)
330 (call-interactively 'calc-arccos))
331 :keys "I C"
332 :active (>= (calc-stack-size) 1)]
333 ["arctan(1:)"
334 (progn
335 (require 'calc-math)
336 (call-interactively 'calc-arctan))
337 :keys "I T"
338 :active (>= (calc-stack-size) 1)]
339 ["arctan2(2:,1:)"
340 (progn
341 (require 'calc-math)
342 (call-interactively 'calc-arctan2))
343 :keys "f T"
344 :active (>= (calc-stack-size) 2)]
345 "--Angle Measure--"
346 ["Radians"
347 (progn
348 (require 'calc-math)
349 (calc-radians-mode))
350 :keys "m r"
351 :style radio
352 :selected (eq calc-angle-mode 'rad)]
353 ["Degrees"
354 (progn
355 (require 'calc-math)
356 (calc-degrees-mode))
357 :keys "m d"
358 :style radio
359 :selected (eq calc-angle-mode 'deg)]
360 ["HMS"
361 (progn
362 (require 'calc-math)
363 (calc-hms-mode))
364 :keys "m h"
365 :style radio
366 :selected (eq calc-angle-mode 'hms)])
367 (list "Hyperbolic Functions"
368 ["sinh(1:)"
369 (progn
370 (require 'calc-math)
371 (call-interactively 'calc-sinh))
372 :keys "H S"
373 :active (>= (calc-stack-size) 1)]
374 ["cosh(1:)"
375 (progn
376 (require 'calc-math)
377 (call-interactively 'calc-cosh))
378 :keys "H C"
379 :active (>= (calc-stack-size) 1)]
380 ["tanh(1:)"
381 (progn
382 (require 'calc-math)
383 (call-interactively 'calc-tanh))
384 :keys "H T"
385 :active (>= (calc-stack-size) 1)]
386 ["arcsinh(1:)"
387 (progn
388 (require 'calc-math)
389 (call-interactively 'calc-arcsinh))
390 :keys "I H S"
391 :active (>= (calc-stack-size) 1)]
392 ["arccosh(1:)"
393 (progn
394 (require 'calc-math)
395 (call-interactively 'calc-arccosh))
396 :keys "I H C"
397 :active (>= (calc-stack-size) 1)]
398 ["arctanh(1:)"
399 (progn
400 (require 'calc-math)
401 (call-interactively 'calc-arctanh))
402 :keys "I H T"
403 :active (>= (calc-stack-size) 1)])
404 (list "Advanced Math Functions"
405 ["Gamma(1:)"
406 (progn
407 (require 'calc-comb)
408 (call-interactively 'calc-gamma))
409 :keys "f g"
410 :active (>= (calc-stack-size) 1)
411 :help "The Euler Gamma function"]
412 ["GammaP(2:,1:)"
413 (progn
414 (require 'calc-funcs)
415 (call-interactively 'calc-inc-gamma))
416 :keys "f G"
417 :active (>= (calc-stack-size) 2)
418 :help "The lower incomplete Gamma function"]
419 ["Beta(2:,1:)"
420 (progn
421 (require 'calc-funcs)
422 (call-interactively 'calc-beta))
423 :keys "f b"
424 :active (>= (calc-stack-size) 2)
425 :help "The Euler Beta function"]
426 ["BetaI(3:,2:,1:)"
427 (progn
428 (require 'calc-funcs)
429 (call-interactively 'calc-inc-beta))
430 :keys "f B"
431 :active (>= (calc-stack-size) 3)
432 :help "The incomplete Beta function"]
433 ["erf(1:)"
434 (progn
435 (require 'calc-funcs)
436 (call-interactively 'calc-erf))
437 :keys "f e"
438 :active (>= (calc-stack-size) 1)
439 :help "The error function"]
440 ["BesselJ(2:,1:)"
441 (progn
442 (require 'calc-funcs)
443 (call-interactively 'calc-bessel-J))
444 :keys "f j"
445 :active (>= (calc-stack-size) 2)
446 :help "The Bessel function of the first kind (of order (2:))"]
447 ["BesselY(2:,1:)"
448 (progn
449 (require 'calc-funcs)
450 (call-interactively 'calc-bessel-Y))
451 :keys "f y"
452 :active (>= (calc-stack-size) 2)
453 :help "The Bessel function of the second kind (of order (2:))"])
454 (list "Combinatorial Functions"
455 ["gcd(2:,1:)"
456 (progn
457 (require 'calc-comb)
458 (call-interactively 'calc-gcd))
459 :keys "k g"
460 :active (>= (calc-stack-size) 2)]
461 ["lcm(2:,1:)"
462 (progn
463 (require 'calc-comb)
464 (call-interactively 'calc-lcm))
465 :keys "k l"
466 :active (>= (calc-stack-size) 2)]
467 ["factorial(1:)"
468 (progn
469 (require 'calc-comb)
470 (call-interactively 'calc-factorial))
471 :keys "!"
472 :active (>= (calc-stack-size) 1)]
473 ["(2:) choose (1:)"
474 (progn
475 (require 'calc-comb)
476 (call-interactively 'calc-choose))
477 :keys "k c"
478 :active (>= (calc-stack-size) 2)]
479 ["permutations(2:,1:)"
480 (progn
481 (require 'calc-comb)
482 (call-interactively 'calc-perm))
483 :keys "H k c"
484 :active (>= (calc-stack-size) 2)]
485 ["Primality test for (1:)"
486 (progn
487 (require 'calc-comb)
488 (call-interactively 'calc-prime-test))
489 :keys "k p"
490 :active (>= (calc-stack-size) 1)
491 :help "For large (1:), a probabilistic test"]
492 ["Factor (1:) into primes"
493 (progn
494 (require 'calc-comb)
495 (call-interactively 'calc-prime-factors))
496 :keys "k f"
497 :active (>= (calc-stack-size) 1)]
498 ["Next prime after (1:)"
499 (progn
500 (require 'calc-comb)
501 (call-interactively 'calc-next-prime))
502 :keys "k n"
503 :active (>= (calc-stack-size) 1)]
504 ["Previous prime before (1:)"
505 (progn
506 (require 'calc-comb)
507 (call-interactively 'calc-prev-prime))
508 :keys "I k n"
509 :active (>= (calc-stack-size) 1)]
510 ["phi(1:)"
511 (progn
512 (require 'calc-comb)
513 (call-interactively 'calc-totient))
514 :keys "k n"
515 :active (>= (calc-stack-size) 1)
516 :help "Euler's totient function"]
517 ["random(1:)"
518 (progn
519 (require 'calc-comb)
520 (call-interactively 'calc-random))
521 :keys "k r"
522 :active (>= (calc-stack-size) 1)
523 :help "A random number >=1 and < (1:)"])
524 "----"
525 ["Help on Scientific Functions"
526 (calc-info-goto-node "Scientific Functions")])
527 "Menu for Calc's scientific functions.")
529 (defvar calc-algebra-menu
530 (list "Algebra"
531 (list "Simplification"
532 ["Simplify (1:)"
533 (progn
534 (require 'calc-alg)
535 (call-interactively 'calc-simplify))
536 :keys "a s"
537 :active (>= (calc-stack-size) 1)]
538 ["Simplify (1:) with extended rules"
539 (progn
540 (require 'calc-alg)
541 (call-interactively 'calc-simplify-extended))
542 :keys "a e"
543 :active (>= (calc-stack-size) 1)
544 :help "Apply possibly unsafe simplifications"])
545 (list "Manipulation"
546 ["Expand formula (1:)"
547 (progn
548 (require 'calc-alg)
549 (call-interactively 'calc-expand-formula))
550 :keys "a \""
551 :active (>= (calc-stack-size) 1)
552 :help "Expand (1:) into its defining formula, if possible"]
553 ["Evaluate variables in (1:)"
554 (progn
555 (require 'calc-ext)
556 (call-interactively 'calc-evaluate))
557 :keys "="
558 :active (>= (calc-stack-size) 1)]
559 ["Make substitution in (1:)"
560 (progn
561 (require 'calc-alg)
562 (call-interactively 'calc-substitute))
563 :keys "a b"
564 :active (>= (calc-stack-size) 1)
565 :help
566 "Substitute all occurrences of a sub-expression with a new sub-expression"])
567 (list "Polynomials"
568 ["Factor (1:)"
569 (progn
570 (require 'calc-alg)
571 (call-interactively 'calc-factor))
572 :keys "a f"
573 :active (>= (calc-stack-size) 1)]
574 ["Collect terms in (1:)"
575 (progn
576 (require 'calc-alg)
577 (call-interactively 'calc-collect))
578 :keys "a c"
579 :active (>= (calc-stack-size) 1)
580 :help "Arrange as a polynomial in a given variable"]
581 ["Expand (1:)"
582 (progn
583 (require 'calc-alg)
584 (call-interactively 'calc-expand))
585 :keys "a x"
586 :active (>= (calc-stack-size) 1)
587 :help "Apply distributive law everywhere"]
588 ["Find roots of (1:)"
589 (progn
590 (require 'calcalg2)
591 (call-interactively 'calc-poly-roots))
592 :keys "a P"
593 :active (>= (calc-stack-size) 1)])
594 (list "Calculus"
595 ["Differentiate (1:)"
596 (progn
597 (require 'calcalg2)
598 (call-interactively 'calc-derivative))
599 :keys "a d"
600 :active (>= (calc-stack-size) 1)]
601 ["Integrate (1:) [indefinite]"
602 (progn
603 (require 'calcalg2)
604 (call-interactively 'calc-integral))
605 :keys "a i"
606 :active (>= (calc-stack-size) 1)]
607 ["Integrate (1:) [definite]"
608 (progn
609 (require 'calcalg2)
610 (let ((var (read-string "Integration variable: ")))
611 (calc-tabular-command 'calcFunc-integ "Integration"
612 "intg" nil var nil nil)))
613 :keys "C-u a i"
614 :active (>= (calc-stack-size) 1)]
615 ["Integrate (1:) [numeric]"
616 (progn
617 (require 'calcalg2)
618 (call-interactively 'calc-num-integral))
619 :keys "a I"
620 :active (>= (calc-stack-size) 1)
621 :help "Integrate using the open Romberg method"]
622 ["Taylor expand (1:)"
623 (progn
624 (require 'calcalg2)
625 (call-interactively 'calc-taylor))
626 :keys "a t"
627 :active (>= (calc-stack-size) 1)]
628 ["Minimize (2:) [initial guess = (1:)]"
629 (progn
630 (require 'calcalg3)
631 (call-interactively 'calc-find-minimum))
632 :keys "a N"
633 :active (>= (calc-stack-size) 2)
634 :help "Find a local minimum"]
635 ["Maximize (2:) [initial guess = (1:)]"
636 (progn
637 (require 'calcalg3)
638 (call-interactively 'calc-find-maximum))
639 :keys "a X"
640 :active (>= (calc-stack-size) 2)
641 :help "Find a local maximum"])
642 (list "Solving"
643 ["Solve equation (1:)"
644 (progn
645 (require 'calcalg2)
646 (call-interactively 'calc-solve-for))
647 :keys "a S"
648 :active (>= (calc-stack-size) 1)]
649 ["Solve equation (2:) numerically [initial guess = (1:)]"
650 (progn
651 (require 'calcalg3)
652 (call-interactively 'calc-find-root))
653 :keys "a R"
654 :active (>= (calc-stack-size) 2)]
655 ["Find roots of polynomial (1:)"
656 (progn
657 (require 'calcalg2)
658 (call-interactively 'calc-poly-roots))
659 :keys "a P"
660 :active (>= (calc-stack-size) 1)])
661 (list "Curve Fitting"
662 ["Fit (1:)=[x values, y values] to a curve"
663 (progn
664 (require 'calcalg3)
665 (call-interactively 'calc-curve-fit))
666 :keys "a F"
667 :active (>= (calc-stack-size) 1)])
668 "----"
669 ["Help on Algebra"
670 (calc-info-goto-node "Algebra")])
671 "Menu for Calc's algebraic facilities.")
674 (defvar calc-graphics-menu
675 (list "Graphics"
676 ["Graph 2D [(1:)= y values, (2:)= x values]"
677 (progn
678 (require 'calc-graph)
679 (call-interactively 'calc-graph-fast))
680 :keys "g f"
681 :active (>= (calc-stack-size) 2)]
682 ["Graph 3D [(1:)= z values, (2:)= y values, (3:)= x values]"
683 (progn
684 (require 'calc-graph)
685 (call-interactively 'calc-graph-fast-3d))
686 :keys "g F"
687 :active (>= (calc-stack-size) 3)]
688 "----"
689 ["Help on Graphics"
690 (calc-info-goto-node "Graphics")])
691 "Menu for Calc's graphics.")
694 (defvar calc-vectors-menu
695 (list "Matrices/Vectors"
696 (list "Matrices"
697 ["(2:) + (1:)" calc-plus
698 :keys "+" :active (>= (calc-stack-size) 2)]
699 ["(2:) - (1:)" calc-minus
700 :keys "-" :active (>= (calc-stack-size) 2)]
701 ["(2:) * (1:)" calc-times
702 :keys "*" :active (>= (calc-stack-size) 2)]
703 ["(1:)^(-1)"
704 (progn
705 (require 'calc-arith)
706 (call-interactively 'calc-inv))
707 :keys "&"
708 :active (>= (calc-stack-size) 1)]
709 ["Create an identity matrix"
710 (progn
711 (require 'calc-vec)
712 (call-interactively 'calc-ident))
713 :keys "v i"]
714 ["transpose(1:)"
715 (progn
716 (require 'calc-vec)
717 (call-interactively 'calc-transpose))
718 :keys "v t"
719 :active (>= (calc-stack-size) 1)]
720 ["det(1:)"
721 (progn
722 (require 'calc-mtx)
723 (call-interactively 'calc-mdet))
724 :keys "V D"
725 :active (>= (calc-stack-size) 1)]
726 ["trace(1:)"
727 (progn
728 (require 'calc-mtx)
729 (call-interactively 'calc-mtrace))
730 :keys "V T"
731 :active (>= (calc-stack-size) 1)]
732 ["LUD decompose (1:)"
733 (progn
734 (require 'calc-mtx)
735 (call-interactively 'calc-mlud))
736 :keys "V L"
737 :active (>= (calc-stack-size) 1)]
738 ["Extract a row from (1:)"
739 (progn
740 (require 'calc-vec)
741 (call-interactively 'calc-mrow))
742 :keys "v r"
743 :active (>= (calc-stack-size) 1)]
744 ["Extract a column from (1:)"
745 (progn
746 (require 'calc-vec)
747 (call-interactively 'calc-mcol))
748 :keys "v c"
749 :active (>= (calc-stack-size) 1)])
750 (list "Vectors"
751 ["Extract the first element of (1:)"
752 (progn
753 (require 'calc-vec)
754 (call-interactively 'calc-head))
755 :keys "v h"
756 :active (>= (calc-stack-size) 1)]
757 ["Extract an element from (1:)"
758 (progn
759 (require 'calc-vec)
760 (call-interactively 'calc-mrow))
761 :keys "v r"
762 :active (>= (calc-stack-size) 1)]
763 ["Reverse (1:)"
764 (progn
765 (require 'calc-vec)
766 (call-interactively 'calc-reverse-vector))
767 :keys "v v"
768 :active (>= (calc-stack-size) 1)]
769 ["Unpack (1:)"
770 (progn
771 (require 'calc-vec)
772 (call-interactively 'calc-unpack))
773 :keys "v u"
774 :active (>= (calc-stack-size) 1)
775 :help "Separate the elements of (1:)"]
776 ["(2:) cross (1:)"
777 (progn
778 (require 'calc-vec)
779 (call-interactively 'calc-cross))
780 :keys "V C"
781 :active (>= (calc-stack-size) 2)
782 :help "The cross product in R^3"]
783 ["(2:) dot (1:)"
784 calc-mult
785 :keys "*"
786 :active (>= (calc-stack-size) 2)
787 :help "The dot product"]
788 ["Map a function across (1:)"
789 (progn
790 (require 'calc-map)
791 (call-interactively 'calc-map))
792 :keys "V M"
793 :active (>= (calc-stack-size) 1)
794 :help "Apply a function to each element"])
795 (list "Vectors As Sets"
796 ["Remove duplicates from (1:)"
797 (progn
798 (require 'calc-vec)
799 (call-interactively 'calc-remove-duplicates))
800 :keys "V +"
801 :active (>= (calc-stack-size) 1)]
802 ["(2:) union (1:)"
803 (progn
804 (require 'calc-vec)
805 (call-interactively 'calc-set-union))
806 :keys "V V"
807 :active (>= (calc-stack-size) 2)]
808 ["(2:) intersect (1:)"
809 (progn
810 (require 'calc-vec)
811 (call-interactively 'calc-set-intersect))
812 :keys "V ^"
813 :active (>= (calc-stack-size) 2)]
814 ["(2:) \\ (1:)"
815 (progn
816 (require 'calc-vec)
817 (call-interactively 'calc-set-difference))
818 :keys "V -"
819 :help "Set difference"
820 :active (>= (calc-stack-size) 2)])
821 (list "Statistics On Vectors"
822 ["length(1:)"
823 (progn
824 (require 'calc-stat)
825 (call-interactively 'calc-vector-count))
826 :keys "u #"
827 :active (>= (calc-stack-size) 1)
828 :help "The number of data values"]
829 ["sum(1:)"
830 (progn
831 (require 'calc-stat)
832 (call-interactively 'calc-vector-sum))
833 :keys "u +"
834 :active (>= (calc-stack-size) 1)
835 :help "The sum of the data values"]
836 ["max(1:)"
837 (progn
838 (require 'calc-stat)
839 (call-interactively 'calc-vector-max))
840 :keys "u x"
841 :active (>= (calc-stack-size) 1)
842 :help "The maximum of the data values"]
843 ["min(1:)"
844 (progn
845 (require 'calc-stat)
846 (call-interactively 'calc-vector-min))
847 :keys "u N"
848 :active (>= (calc-stack-size) 1)
849 :help "The minimum of the data values"]
850 ["mean(1:)"
851 (progn
852 (require 'calc-stat)
853 (call-interactively 'calc-vector-mean))
854 :keys "u M"
855 :active (>= (calc-stack-size) 1)
856 :help "The average (arithmetic mean) of the data values"]
857 ["mean(1:) with error"
858 (progn
859 (require 'calc-stat)
860 (call-interactively 'calc-vector-mean-error))
861 :keys "I u M"
862 :active (>= (calc-stack-size) 1)
863 :help "The average (arithmetic mean) of the data values as an error form"]
864 ["rms(1:)"
865 (progn
866 (require 'calc-stat)
867 (call-interactively 'calc-vector-rms))
868 :keys "u R"
869 :active (>= (calc-stack-size) 1)
870 :help "The root mean square of the data values"]
871 ["sdev(1:)"
872 (progn
873 (require 'calc-stat)
874 (call-interactively 'calc-vector-sdev))
875 :keys "u S"
876 :active (>= (calc-stack-size) 1)
877 :help "The sample sdev, sqrt[sum((values - mean)^2)/(N-1)]"]
878 ["variance(1:)"
879 (progn
880 (require 'calc-stat)
881 (call-interactively 'calc-vector-variance))
882 :keys "H u S"
883 :active (>= (calc-stack-size) 1)
884 :help "The sample variance, sum((values - mean)^2)/(N-1)"]
885 ["population sdev(1:)"
886 (progn
887 (require 'calc-stat)
888 (call-interactively 'calc-vector-pop-sdev))
889 :keys "I u S"
890 :active (>= (calc-stack-size) 1)
891 :help "The population sdev, sqrt[sum((values - mean)^2)/N]"]
892 ["population variance(1:)"
893 (progn
894 (require 'calc-stat)
895 (call-interactively 'calc-vector-pop-variance))
896 :keys "H I u S"
897 :active (>= (calc-stack-size) 1)
898 :help "The population variance, sum((values - mean)^2)/N"]
899 ["median(1:)"
900 (progn
901 (require 'calc-stat)
902 (call-interactively 'calc-vector-median))
903 :keys "H u M"
904 :active (>= (calc-stack-size) 1)
905 :help "The median of the data values"]
906 ["harmonic mean(1:)"
907 (progn
908 (require 'calc-stat)
909 (call-interactively 'calc-vector-harmonic-mean))
910 :keys "H I u M"
911 :active (>= (calc-stack-size) 1)]
912 ["geometric mean(1:)"
913 (progn
914 (require 'calc-stat)
915 (call-interactively 'calc-vector-geometric-mean))
916 :keys "u G"
917 :active (>= (calc-stack-size) 1)]
918 ["arithmetic-geometric mean(1:)"
919 (progn
920 (require 'calc-stat)
921 (let ((calc-hyperbolic-flag t))
922 (call-interactively 'calc-vector-geometric-mean)))
923 :keys "H u G"
924 :active (>= (calc-stack-size) 1)]
925 ;; ["RMS(1:)"
926 ;; (progn (require 'calc-arith)
927 ;; (call-interactively 'calc-abs))
928 ;; :keys "A"
929 ;; :active (>= (calc-stack-size) 1)
930 ;; :help "The root-mean-square, or quadratic mean"]
932 ["Abbreviate long vectors"
933 (progn
934 (require 'calc-mode)
935 (call-interactively 'calc-full-vectors))
936 :keys "v ."
937 :style toggle
938 :selected (not calc-full-vectors)]
939 "----"
940 ["Help on Matrices/Vectors"
941 (calc-info-goto-node "Matrix Functions")])
942 "Menu for Calc's vector and matrix functions.")
944 (defvar calc-units-menu
945 (list "Units"
946 ["Convert units in (1:)"
947 (progn
948 (require 'calc-units)
949 (call-interactively 'calc-convert-units ))
950 :keys "u c"
951 :active (>= (calc-stack-size) 1)]
952 ["Convert temperature in (1:)"
953 (progn
954 (require 'calc-units)
955 (call-interactively 'calc-convert-temperature))
956 :keys "u t"
957 :active (>= (calc-stack-size) 1)]
958 ["Simplify units in (1:)"
959 (progn
960 (require 'calc-units)
961 (call-interactively 'calc-simplify-units))
962 :keys "u s"
963 :active (>= (calc-stack-size) 1)]
964 ["View units table"
965 (progn
966 (require 'calc-units)
967 (call-interactively 'calc-view-units-table))
968 :keys "u V"]
969 (list "Logarithmic Units"
970 ["Convert (1:) to dB (power)"
971 (progn
972 (require 'calc-units)
973 (call-interactively 'calc-db))
974 :keys "l d"
975 :active (>= (calc-stack-size) 1)]
976 ["Convert (2:) to dB (power) with reference level (1:)"
977 (progn
978 (require 'calc-units)
979 (let ((calc-option-flag t))
980 (call-interactively 'calc-db)))
981 :keys "O l d"
982 :active (>= (calc-stack-size) 2)]
983 ["Convert (1:) to Np (power)"
984 (progn
985 (require 'calc-units)
986 (call-interactively 'calc-np))
987 :keys "l n"
988 :active (>= (calc-stack-size) 1)]
989 ["Convert (2:) to Np (power) with reference level (1:)"
990 (progn
991 (require 'calc-units)
992 (let ((calc-option-flag t))
993 (call-interactively 'calc-np)))
994 :keys "O l n"
995 :active (>= (calc-stack-size) 2)]
996 ["Convert (1:) to power quantity"
997 (progn
998 (require 'calc-units)
999 (call-interactively 'calc-lu-quant))
1000 :keys "l q"
1001 :active (>= (calc-stack-size) 1)]
1002 ["Convert (2:) to power quantity with reference level (1:)"
1003 (progn
1004 (require 'calc-units)
1005 (let ((calc-option-flag t))
1006 (call-interactively 'calc-lu-quant)))
1007 :keys "O l q"
1008 :active (>= (calc-stack-size) 2)]
1009 "----"
1010 ["Convert (1:) to dB (field)"
1011 (progn
1012 (require 'calc-units)
1013 (let ((calc-hyperbolic-flag t))
1014 (call-interactively 'calc-db)))
1015 :keys "H l d"
1016 :active (>= (calc-stack-size) 1)]
1017 ["Convert (2:) to dB (field) with reference level (1:)"
1018 (progn
1019 (require 'calc-units)
1020 (let ((calc-option-flag t)
1021 (calc-hyperbolic-flag t))
1022 (call-interactively 'calc-db)))
1023 :keys "O H l d"
1024 :active (>= (calc-stack-size) 2)]
1025 ["Convert (1:) to Np (field)"
1026 (progn
1027 (require 'calc-units)
1028 (let ((calc-hyperbolic-flag t))
1029 (call-interactively 'calc-np)))
1030 :keys "H l n"
1031 :active (>= (calc-stack-size) 1)]
1032 ["Convert (2:) to Np (field) with reference level (1:)"
1033 (progn
1034 (require 'calc-units)
1035 (let ((calc-option-flag t)
1036 (calc-hyperbolic-flag t))
1037 (call-interactively 'calc-np)))
1038 :keys "O H l d"
1039 :active (>= (calc-stack-size) 2)]
1040 ["Convert (1:) to field quantity"
1041 (progn
1042 (require 'calc-units)
1043 (let ((calc-hyperbolic-flag t))
1044 (call-interactively 'calc-lu-quant)))
1045 :keys "H l q"
1046 :active (>= (calc-stack-size) 1)]
1047 ["Convert (2:) to field quantity with reference level (1:)"
1048 (progn
1049 (require 'calc-units)
1050 (let ((calc-option-flag t)
1051 (calc-hyperbolic-flag))
1052 (call-interactively 'calc-lu-quant)))
1053 :keys "O H l q"
1054 :active (>= (calc-stack-size) 2)])
1055 (list "Musical Notes"
1056 ["Convert (1:) to scientific pitch notation"
1057 (progn
1058 (require 'calc-units)
1059 (call-interactively 'calc-spn))
1060 :keys "l s"
1061 :active (>= (calc-stack-size) 1)]
1062 ["Convert (1:) to midi number"
1063 (progn
1064 (require 'calc-units)
1065 (call-interactively 'calc-midi))
1066 :keys "l m"
1067 :active (>= (calc-stack-size) 1)]
1068 ["Convert (1:) to frequency"
1069 (progn
1070 (require 'calc-units)
1071 (call-interactively 'calc-freq))
1072 :keys "l f"
1073 :active (>= (calc-stack-size) 1)])
1074 "----"
1075 ["Help on Units"
1076 (calc-info-goto-node "Units")])
1077 "Menu for Calc's units functions.")
1079 (defvar calc-variables-menu
1080 (list "Variables"
1081 ["Store (1:) into a variable"
1082 (progn
1083 (require 'calc-store)
1084 (call-interactively 'calc-store))
1085 :keys "s s"
1086 :active (>= (calc-stack-size) 1)]
1087 ["Recall a variable value"
1088 (progn
1089 (require 'calc-store)
1090 (call-interactively 'calc-recall ))
1091 :keys "s r"]
1092 ["Edit the value of a variable"
1093 (progn
1094 (require 'calc-store)
1095 (call-interactively 'calc-edit-variable))
1096 :keys "s e"]
1097 ["Exchange (1:) with a variable value"
1098 (progn
1099 (require 'calc-store)
1100 (call-interactively 'calc-store-exchange))
1101 :keys "s x"
1102 :active (>= (calc-stack-size) 1)]
1103 ["Clear variable value"
1104 (progn
1105 (require 'calc-store)
1106 (call-interactively 'calc-unstore))
1107 :keys "s u"]
1108 ["Evaluate variables in (1:)"
1109 (progn
1110 (require 'calc-ext)
1111 (call-interactively 'calc-evaluate))
1112 :keys "="
1113 :active (>= (calc-stack-size) 1)]
1114 ["Evaluate (1:), assigning a value to a variable"
1115 (progn
1116 (require 'calc-store)
1117 (call-interactively 'calc-let))
1118 :keys "s l"
1119 :active (>= (calc-stack-size) 1)
1120 :help "Evaluate (1:) under a temporary assignment of a variable"]
1121 "----"
1122 ["Help on Variables"
1123 (calc-info-goto-node "Store and Recall")])
1124 "Menu for Calc's variables.")
1126 (defvar calc-stack-menu
1127 (list "Stack"
1128 ["Remove (1:)"
1129 calc-pop
1130 :keys "DEL"
1131 :active (>= (calc-stack-size) 1)]
1132 ["Switch (1:) and (2:)"
1133 calc-roll-down
1134 :keys "TAB"
1135 :active (>= (calc-stack-size) 2)]
1136 ["Duplicate (1:)"
1137 calc-enter
1138 :keys "RET"
1139 :active (>= (calc-stack-size) 1)]
1140 ["Edit (1:)"
1141 (progn
1142 (require 'calc-yank)
1143 (call-interactively calc-edit))
1144 :keys "`"
1145 :active (>= (calc-stack-size) 1)]
1146 "----"
1147 ["Help on Stack"
1148 (calc-info-goto-node "Stack and Trail")])
1149 "Menu for Calc's stack functions.")
1151 (defvar calc-errors-menu
1152 (list "Undo"
1153 ["Undo"
1154 (progn
1155 (require 'calc-undo)
1156 (call-interactively 'calc-undo))
1157 :keys "U"]
1158 ["Redo"
1159 (progn
1160 (require 'calc-undo)
1161 (call-interactively 'calc-redo))
1162 :keys "D"]
1163 "----"
1164 ["Help on Undo"
1165 (progn
1166 (calc-info-goto-node "Introduction")
1167 (Info-goto-node "Undo"))]))
1169 (defvar calc-modes-menu
1170 (list "Modes"
1171 ["Precision"
1172 (progn
1173 (require 'calc-ext)
1174 (call-interactively 'calc-precision))
1175 :keys "p"
1176 :help "Set the precision for floating point calculations"]
1177 ["Fraction mode"
1178 (progn
1179 (require 'calc-frac)
1180 (call-interactively 'calc-frac-mode))
1181 :keys "m f"
1182 :style toggle
1183 :selected calc-prefer-frac
1184 :help "Leave integer quotients as fractions"]
1185 ["Symbolic mode"
1186 (lambda ()
1187 (interactive)
1188 (require 'calc-mode)
1189 (calc-symbolic-mode nil))
1190 :keys "m s"
1191 :style toggle
1192 :selected calc-symbolic-mode
1193 :help "Leave functions producing inexact answers in symbolic form"]
1194 ["Infinite mode"
1195 (lambda ()
1196 (interactive)
1197 (require 'calc-mode)
1198 (calc-infinite-mode nil))
1199 :keys "m i"
1200 :style toggle
1201 :selected calc-infinite-mode
1202 :help "Let expressions like 1/0 produce infinite results"]
1203 ["Abbreviate long vectors"
1204 (progn
1205 (require 'calc-mode)
1206 (call-interactively 'calc-full-vectors))
1207 :keys "v ."
1208 :style toggle
1209 :selected (not calc-full-vectors)]
1210 (list "Simplification"
1211 ["No simplification mode"
1212 (progn
1213 (require 'calc-mode)
1214 (calc-no-simplify-mode t))
1215 :keys "m O"
1216 :style radio
1217 :selected (eq calc-simplify-mode 'none)
1218 :help "No simplifications are done automatically"]
1219 ["Numeric simplification mode"
1220 (progn
1221 (require 'calc-mode)
1222 (calc-num-simplify-mode t))
1223 :keys "m N"
1224 :style radio
1225 :selected (eq calc-simplify-mode 'num)
1226 :help "Only numeric simplifications are done automatically"]
1227 ["Basic simplification mode"
1228 (progn
1229 (require 'calc-mode)
1230 (calc-basic-simplify-mode t))
1231 :keys "m I"
1232 :style radio
1233 :selected (eq calc-simplify-mode nil)
1234 :help "Only basic simplifications are done automatically"]
1235 ["Binary simplification mode"
1236 (progn
1237 (require 'calc-mode)
1238 (calc-bin-simplify-mode t))
1239 :keys "m B"
1240 :style radio
1241 :selected (eq calc-simplify-mode 'binary)
1242 :help "Basic simplifications with binary clipping are done automatically"]
1243 ["Algebraic simplification mode"
1244 (progn
1245 (require 'calc-mode)
1246 (calc-alg-simplify-mode t))
1247 :keys "m A"
1248 :style radio
1249 :selected (eq calc-simplify-mode 'alg)
1250 :help "Standard algebraic simplifications are done automatically"]
1251 ["Extended simplification mode"
1252 (progn
1253 (require 'calc-mode)
1254 (calc-ext-simplify-mode t))
1255 :keys "m E"
1256 :style radio
1257 :selected (eq calc-simplify-mode 'ext)
1258 :help "Extended (unsafe) simplifications are done automatically"]
1259 ["Units simplification mode"
1260 (progn
1261 (require 'calc-mode)
1262 (calc-units-simplify-mode t))
1263 :keys "m U"
1264 :style radio
1265 :selected (eq calc-simplify-mode 'units)
1266 :help "Algebraic and unit simplifications are done automatically"])
1267 (list "Angle Measure"
1268 ["Radians"
1269 (progn
1270 (require 'calc-math)
1271 (call-interactively 'calc-radians-mode))
1272 :keys "m r"
1273 :style radio
1274 :selected (eq calc-angle-mode 'rad)]
1275 ["Degrees"
1276 (progn
1277 (require 'calc-math)
1278 (call-interactively 'calc-degrees-mode))
1279 :keys "m d"
1280 :style radio
1281 :selected (eq calc-angle-mode 'deg)]
1282 ["HMS"
1283 (progn
1284 (require 'calc-math)
1285 (call-interactively 'calc-hms-mode))
1286 :keys "m h"
1287 :style radio
1288 :selected (eq calc-angle-mode 'hms)])
1289 (list "Radix"
1290 ["Decimal"
1291 (progn
1292 (require 'calc-bin)
1293 (call-interactively 'calc-decimal-radix))
1294 :keys "d 0"
1295 :style radio
1296 :selected (and (= calc-number-radix 10)
1297 (not calc-twos-complement-mode))]
1298 ["Binary"
1299 (progn
1300 (require 'calc-bin)
1301 (call-interactively 'calc-binary-radix))
1302 :keys "d 2"
1303 :style radio
1304 :selected (and (= calc-number-radix 2)
1305 (not calc-twos-complement-mode))]
1306 ["Octal"
1307 (progn
1308 (require 'calc-bin)
1309 (call-interactively 'calc-octal-radix))
1310 :keys "d 8"
1311 :style radio
1312 :selected (and (= calc-number-radix 8)
1313 (not calc-twos-complement-mode))]
1314 ["Hexadecimal"
1315 (progn
1316 (require 'calc-bin)
1317 (call-interactively 'calc-hex-radix))
1318 :keys "d 6"
1319 :style radio
1320 :selected (and (= calc-number-radix 16)
1321 (not calc-twos-complement-mode))]
1322 ["Other"
1323 (progn
1324 (require 'calc-bin)
1325 (call-interactively 'calc-radix))
1326 :keys "d r"
1327 :style radio
1328 :selected (and
1329 (not calc-twos-complement-mode)
1330 (not
1332 (= calc-number-radix 10)
1333 (= calc-number-radix 2)
1334 (= calc-number-radix 8)
1335 (= calc-number-radix 16))))]
1336 ["--Two's Complement--"
1337 (lambda () ())
1338 :style radio
1339 :selected nil]
1340 ["Binary"
1341 (progn
1342 (require 'calc-bin)
1343 (call-interactively
1344 (lambda () (interactive) (calc-binary-radix t))))
1345 :keys "C-u d 2"
1346 :style radio
1347 :selected (and (= calc-number-radix 2)
1348 calc-twos-complement-mode)]
1349 ["Octal"
1350 (progn
1351 (require 'calc-bin)
1352 (call-interactively
1353 (lambda () (interactive) (calc-octal-radix t))))
1354 :keys "C-u d 8"
1355 :style radio
1356 :selected (and (= calc-number-radix 8)
1357 calc-twos-complement-mode)]
1358 ["Hexadecimal"
1359 (progn
1360 (require 'calc-bin)
1361 (call-interactively
1362 (lambda () (interactive) (calc-hex-radix t))))
1363 :keys "C-u d 6"
1364 :style radio
1365 :selected (and (= calc-number-radix 16)
1366 calc-twos-complement-mode)])
1367 (list "Float Format"
1368 ["Normal"
1369 (progn
1370 (require 'calc-mode)
1371 (call-interactively 'calc-normal-notation))
1372 :keys "d n"
1373 :style radio
1374 :selected (eq (car-safe calc-float-format) 'float)]
1375 ["Fixed point"
1376 (progn
1377 (require 'calc-mode)
1378 (call-interactively 'calc-fix-notation))
1379 :keys "d f"
1380 :style radio
1381 :selected (eq (car-safe calc-float-format) 'fix)]
1382 ["Scientific notation"
1383 (progn
1384 (require 'calc-mode)
1385 (call-interactively 'calc-sci-notation))
1386 :keys "d s"
1387 :style radio
1388 :selected (eq (car-safe calc-float-format) 'sci)]
1389 ["Engineering notation"
1390 (progn
1391 (require 'calc-mode)
1392 (call-interactively 'calc-eng-notation))
1393 :keys "d e"
1394 :style radio
1395 :selected (eq (car-safe calc-float-format) 'eng)])
1396 (list "Complex Format"
1397 ["Default"
1398 (progn
1399 (require 'calc-cplx)
1400 (calc-complex-notation))
1401 :style radio
1402 :selected (not calc-complex-format)
1403 :keys "d c"
1404 :help "Display complex numbers as ordered pairs."]
1405 ["i notation"
1406 (progn
1407 (require 'calc-cplx)
1408 (calc-i-notation))
1409 :style radio
1410 :selected (eq calc-complex-format 'i)
1411 :keys "d i"
1412 :help "Display complex numbers as a+bi."]
1413 ["j notation"
1414 (progn
1415 (require 'calc-cplx)
1416 (calc-i-notation))
1417 :style radio
1418 :selected (eq calc-complex-format 'j)
1419 :keys "d j"
1420 :help "Display complex numbers as a+bj."]
1421 ["Other"
1422 (calc-complex-notation)
1423 :style radio
1424 :selected (and calc-complex-format
1425 (not (eq calc-complex-format 'i))
1426 (not (eq calc-complex-format 'j)))
1427 :active nil]
1428 "----"
1429 ["Polar mode"
1430 (progn
1431 (require 'calc-cplx)
1432 (calc-polar-mode nil))
1433 :style toggle
1434 :selected (eq calc-complex-mode 'polar)
1435 :keys "m p"
1436 :help "Prefer polar form for complex numbers."])
1437 (list "Algebraic"
1438 ["Normal"
1439 (progn
1440 (require 'calc-mode)
1441 (cond
1442 (calc-incomplete-algebraic-mode
1443 (calc-algebraic-mode t))
1444 (calc-algebraic-mode
1445 (calc-algebraic-mode nil))))
1446 :style radio
1447 :selected (not calc-algebraic-mode)]
1448 ["Algebraic mode"
1449 (progn
1450 (require 'calc-mode)
1451 (if (or
1452 calc-incomplete-algebraic-mode
1453 (not calc-algebraic-mode))
1454 (calc-algebraic-mode nil)))
1455 :keys "m a"
1456 :style radio
1457 :selected (and calc-algebraic-mode
1458 (not calc-incomplete-algebraic-mode))
1459 :help "Keys which start numeric entry also start algebraic entry"]
1460 ["Incomplete algebraic mode"
1461 (progn
1462 (require 'calc-mode)
1463 (unless calc-incomplete-algebraic-mode
1464 (calc-algebraic-mode t)))
1465 :keys "C-u m a"
1466 :style radio
1467 :selected calc-incomplete-algebraic-mode
1468 :help "Only ( and [ begin algebraic entry"]
1469 ["Total algebraic mode"
1470 (progn
1471 (require 'calc-mode)
1472 (unless (eq calc-algebraic-mode 'total)
1473 (calc-total-algebraic-mode nil)))
1474 :keys "m t"
1475 :style radio
1476 :selected (eq calc-algebraic-mode 'total)
1477 :help "All regular letters and punctuation begin algebraic entry"])
1478 (list "Matrix"
1479 ["Off"
1480 (progn
1481 (require 'calc-mode)
1482 (calc-matrix-mode -1))
1483 :style radio
1484 :selected (eq calc-matrix-mode nil)
1485 :help "Variables are not assumed to be matrix or scalar"]
1486 ["Matrix mode"
1487 (progn
1488 (require 'calc-mode)
1489 (calc-matrix-mode -2))
1490 :style radio
1491 :selected (eq calc-matrix-mode 'matrix)
1492 :help "Variables are assumed to be matrices"]
1493 ["Square matrix mode"
1494 (progn
1495 (require 'calc-mode)
1496 (calc-matrix-mode '(4)))
1497 :style radio
1498 :selected (eq calc-matrix-mode 'sqmatrix)
1499 :help "Variables are assumed to be square matrices"]
1500 ["Dimensioned matrix mode"
1501 (let ((dim (string-to-number (read-from-minibuffer "Dimension: "))))
1502 (if (natnump dim)
1503 (progn
1504 (require 'calc-mode)
1505 (calc-matrix-mode dim))
1506 (error "The dimension must be a positive integer")))
1507 :style radio
1508 :selected (and (integerp calc-matrix-mode) (> calc-matrix-mode 0))
1509 :help "Variables are assumed to be NxN matrices"]
1510 ["Scalar mode"
1511 (progn
1512 (require 'calc-mode)
1513 (calc-matrix-mode 0))
1514 :style radio
1515 :selected (eq calc-matrix-mode 'scalar)
1516 :help "Variables are assumed to be scalars"])
1517 (list "Language"
1518 ["Normal"
1519 (progn
1520 (require 'calc-lang)
1521 (call-interactively 'calc-normal-language))
1522 :keys "d N"
1523 :style radio
1524 :selected (eq calc-language nil)]
1525 ["Big"
1526 (progn
1527 (require 'calc-lang)
1528 (call-interactively 'calc-big-language))
1529 :keys "d B"
1530 :style radio
1531 :selected (eq calc-language 'big)
1532 :help "Use textual approximations to various mathematical notations"]
1533 ["Flat"
1534 (progn
1535 (require 'calc-lang)
1536 (call-interactively 'calc-flat-language))
1537 :keys "d O"
1538 :style radio
1539 :selected (eq calc-language 'flat)
1540 :help "Write matrices on a single line"]
1541 ["C"
1542 (progn
1543 (require 'calc-lang)
1544 (call-interactively 'calc-c-language))
1545 :keys "d C"
1546 :style radio
1547 :selected (eq calc-language 'c)]
1548 ["Pascal"
1549 (progn
1550 (require 'calc-lang)
1551 (call-interactively 'calc-pascal-language))
1552 :keys "d P"
1553 :style radio
1554 :selected (eq calc-language 'pascal)]
1555 ["Fortran"
1556 (progn
1557 (require 'calc-lang)
1558 (call-interactively 'calc-fortran-language))
1559 :keys "d F"
1560 :style radio
1561 :selected (eq calc-language 'fortran)]
1562 ["TeX"
1563 (progn
1564 (require 'calc-lang)
1565 (call-interactively 'calc-tex-language))
1566 :keys "d T"
1567 :style radio
1568 :selected (eq calc-language 'tex)]
1569 ["LaTeX"
1570 (progn
1571 (require 'calc-lang)
1572 (call-interactively 'calc-latex-language))
1573 :keys "d L"
1574 :style radio
1575 :selected (eq calc-language 'latex)]
1576 ["Eqn"
1577 (progn
1578 (require 'calc-lang)
1579 (call-interactively 'calc-eqn-language))
1580 :keys "d E"
1581 :style radio
1582 :selected (eq calc-language 'eqn)]
1583 ["Yacas"
1584 (progn
1585 (require 'calc-lang)
1586 (call-interactively 'calc-yacas-language))
1587 :keys "d Y"
1588 :style radio
1589 :selected (eq calc-language 'yacas)]
1590 ["Maxima"
1591 (progn
1592 (require 'calc-lang)
1593 (call-interactively 'calc-maxima-language))
1594 :keys "d X"
1595 :style radio
1596 :selected (eq calc-language 'maxima)]
1597 ["Giac"
1598 (progn
1599 (require 'calc-lang)
1600 (call-interactively 'calc-giac-language))
1601 :keys "d A"
1602 :style radio
1603 :selected (eq calc-language 'giac)]
1604 ["Mma"
1605 (progn
1606 (require 'calc-lang)
1607 (call-interactively 'calc-mathematica-language))
1608 :keys "d M"
1609 :style radio
1610 :selected (eq calc-language 'math)]
1611 ["Maple"
1612 (progn
1613 (require 'calc-lang)
1614 (call-interactively 'calc-maple-language))
1615 :keys "d W"
1616 :style radio
1617 :selected (eq calc-language 'maple)])
1618 "----"
1619 ["Save mode settings" calc-save-modes :keys "m m"]
1620 "----"
1621 ["Help on Modes"
1622 (calc-info-goto-node "Mode settings")])
1623 "Menu for Calc's mode settings.")
1625 (defvar calc-help-menu
1626 (list "Help"
1627 ["Manual"
1628 calc-info
1629 :keys "h i"]
1630 ["Tutorial"
1631 calc-tutorial
1632 :keys "h t"]
1633 ["Summary"
1634 calc-info-summary
1635 :keys "h s"]
1636 "----"
1637 ["Help on Help"
1638 (progn
1639 (calc-info-goto-node "Introduction")
1640 (Info-goto-node "Help Commands"))])
1641 "Menu for Calc's help functions.")
1643 ;; Needed to make this file loadable in isolation.
1644 ;; Another option would be to use calc-load-hook.
1645 (require 'calc)
1647 (easy-menu-define
1648 calc-menu
1649 calc-mode-map
1650 "Menu for Calc."
1651 (list "Calc"
1652 :visible '(eq major-mode 'calc-mode)
1653 calc-arithmetic-menu
1654 calc-scientific-function-menu
1655 calc-algebra-menu
1656 calc-graphics-menu
1657 calc-vectors-menu
1658 calc-units-menu
1659 calc-variables-menu
1660 calc-stack-menu
1661 calc-errors-menu
1662 calc-modes-menu
1663 calc-help-menu
1664 ["Reset"
1665 (progn
1666 (require 'calc-ext)
1667 (call-interactively 'calc-reset))
1668 :help "Reset Calc to its initial state"]
1669 ["Quit" calc-quit]))
1671 (provide 'calc-menu)