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/>.
22 (defvar calc-arithmetic-menu
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)]
40 (let ((calc-inverse-flag t
))
41 (call-interactively 'calc-power
)))
43 :active
(>= (calc-stack-size) 2)
44 :help
"The (1:)th root of (2:)"]
48 (call-interactively 'calc-abs
))
50 :active
(>= (calc-stack-size) 1)
51 :help
"Absolute value"]
55 (call-interactively 'calc-inv
))
57 :active
(>= (calc-stack-size) 1)]
61 (call-interactively 'calc-sqrt
))
63 :active
(>= (calc-stack-size) 1)]
67 (call-interactively 'calc-idiv
))
69 :active
(>= (calc-stack-size) 2)
70 :help
"The integer quotient of (2:) over (1:)"]
74 (call-interactively 'calc-mod
))
76 :active
(>= (calc-stack-size) 2)
77 :help
"The remainder when (2:) is divided by (1:)"])
82 (call-interactively 'calc-floor
))
84 :active
(>= (calc-stack-size) 1)
85 :help
"The greatest integer less than or equal to (1:)"]
89 (call-interactively 'calc-ceiling
))
91 :active
(>= (calc-stack-size) 1)
92 :help
"The smallest integer greater than or equal to (1:)"]
96 (call-interactively 'calc-round
))
98 :active
(>= (calc-stack-size) 1)
99 :help
"The nearest integer to (1:)"]
102 (require 'calc-arith
)
103 (call-interactively 'calc-trunc
))
105 :active
(>= (calc-stack-size) 1)
106 :help
"The integer part of (1:)"])
107 (list "Complex Numbers"
111 (call-interactively 'calc-re
))
113 :active
(>= (calc-stack-size) 1)]
117 (call-interactively 'calc-im
))
119 :active
(>= (calc-stack-size) 1)]
123 (call-interactively 'calc-conj
))
125 :active
(>= (calc-stack-size) 1)
126 :help
"The complex conjugate of (1:)"]
128 (progn (require 'calc-arith
)
129 (call-interactively 'calc-abs
))
131 :active
(>= (calc-stack-size) 1)
132 :help
"The length (absolute value) of (1:)"]
136 (call-interactively 'calc-argument
))
138 :active
(>= (calc-stack-size) 1)
139 :help
"The argument (polar angle) of (1:)"])
141 ["Convert (1:) to a float"
144 (call-interactively 'calc-float
))
146 :active
(>= (calc-stack-size) 1)]
147 ["Convert (1:) to a fraction"
150 (call-interactively 'calc-fraction
))
152 :active
(>= (calc-stack-size) 1)])
157 (call-interactively 'calc-word-size
))
159 ["Clip (1:) to word size"
162 (call-interactively 'calc-clip
))
164 :active
(>= (calc-stack-size) 1)
165 :help
"Reduce (1:) modulo 2^wordsize"]
169 (call-interactively 'calc-and
))
171 :active
(>= (calc-stack-size) 2)
172 :help
"Bitwise AND [modulo 2^wordsize]"]
176 (call-interactively 'calc-or
))
178 :active
(>= (calc-stack-size) 2)
179 :help
"Bitwise inclusive OR [modulo 2^wordsize]"]
183 (call-interactively 'calc-xor
))
185 :active
(>= (calc-stack-size) 2)
186 :help
"Bitwise exclusive OR [modulo 2^wordsize]"]
190 (call-interactively 'calc-diff
))
192 :active
(>= (calc-stack-size) 2)
193 :help
"Bitwise difference [modulo 2^wordsize]"]
197 (call-interactively 'calc-not
))
199 :active
(>= (calc-stack-size) 1)
200 :help
"Bitwise NOT [modulo 2^wordsize]"]
204 (call-interactively 'calc-lshift-binary
))
206 :active
(>= (calc-stack-size) 1)
207 :help
"Shift (1:)[modulo 2^wordsize] one bit left"]
211 (call-interactively 'calc-rshift-binary
))
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:)"
218 (call-interactively 'calc-rshift-arith
))
220 :active
(>= (calc-stack-size) 1)
221 :help
"Shift (1:)[modulo 2^wordsize] one bit right, duplicating the leftmost bit"]
225 (call-interactively 'calc-rotate-binary
))
227 :active
(>= (calc-stack-size) 1)
228 :help
"Rotate (1:)[modulo 2^wordsize] one bit left"])
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"
240 (call-interactively 'calc-pi
))
245 (let ((calc-hyperbolic-flag t
))
246 (call-interactively 'calc-pi
)))
251 (let ((calc-inverse-flag t
)
252 (calc-hyperbolic-flag t
))
253 (call-interactively 'calc-pi
)))
255 :help
"The golden ratio"]
259 (let ((calc-inverse-flag t
))
260 (call-interactively 'calc-pi
)))
262 :help
"Euler's constant"])
263 (list "Logs and Exps"
267 (call-interactively 'calc-ln
))
269 :active
(>= (calc-stack-size) 1)
270 :help
"The natural logarithm"]
274 (call-interactively 'calc-exp
))
276 :active
(>= (calc-stack-size) 1)]
280 (call-interactively 'calc-log10
))
282 :active
(>= (calc-stack-size) 1)
283 :help
"The common logarithm"]
287 (let ((calc-inverse-flag t
))
288 (call-interactively 'calc-log10
)))
290 :active
(>= (calc-stack-size) 1)]
291 ["log(2:) [base(1:)]"
294 (call-interactively 'calc-log
))
296 :active
(>= (calc-stack-size) 2)
297 :help
"The logarithm with an arbitrary base"]
301 :active
(>= (calc-stack-size) 2)])
302 (list "Trigonometric Functions"
306 (call-interactively 'calc-sin
))
308 :active
(>= (calc-stack-size) 1)]
312 (call-interactively 'calc-cos
))
314 :active
(>= (calc-stack-size) 1)]
318 (call-interactively 'calc-tan
))
320 :active
(>= (calc-stack-size) 1)]
324 (call-interactively 'calc-arcsin
))
326 :active
(>= (calc-stack-size) 1)]
330 (call-interactively 'calc-arccos
))
332 :active
(>= (calc-stack-size) 1)]
336 (call-interactively 'calc-arctan
))
338 :active
(>= (calc-stack-size) 1)]
342 (call-interactively 'calc-arctan2
))
344 :active
(>= (calc-stack-size) 2)]
352 :selected
(eq calc-angle-mode
'rad
)]
359 :selected
(eq calc-angle-mode
'deg
)]
366 :selected
(eq calc-angle-mode
'hms
)])
367 (list "Hyperbolic Functions"
371 (call-interactively 'calc-sinh
))
373 :active
(>= (calc-stack-size) 1)]
377 (call-interactively 'calc-cosh
))
379 :active
(>= (calc-stack-size) 1)]
383 (call-interactively 'calc-tanh
))
385 :active
(>= (calc-stack-size) 1)]
389 (call-interactively 'calc-arcsinh
))
391 :active
(>= (calc-stack-size) 1)]
395 (call-interactively 'calc-arccosh
))
397 :active
(>= (calc-stack-size) 1)]
401 (call-interactively 'calc-arctanh
))
403 :active
(>= (calc-stack-size) 1)])
404 (list "Advanced Math Functions"
408 (call-interactively 'calc-gamma
))
410 :active
(>= (calc-stack-size) 1)
411 :help
"The Euler Gamma function"]
414 (require 'calc-funcs
)
415 (call-interactively 'calc-inc-gamma
))
417 :active
(>= (calc-stack-size) 2)
418 :help
"The lower incomplete Gamma function"]
421 (require 'calc-funcs
)
422 (call-interactively 'calc-beta
))
424 :active
(>= (calc-stack-size) 2)
425 :help
"The Euler Beta function"]
428 (require 'calc-funcs
)
429 (call-interactively 'calc-inc-beta
))
431 :active
(>= (calc-stack-size) 3)
432 :help
"The incomplete Beta function"]
435 (require 'calc-funcs
)
436 (call-interactively 'calc-erf
))
438 :active
(>= (calc-stack-size) 1)
439 :help
"The error function"]
442 (require 'calc-funcs
)
443 (call-interactively 'calc-bessel-J
))
445 :active
(>= (calc-stack-size) 2)
446 :help
"The Bessel function of the first kind (of order (2:))"]
449 (require 'calc-funcs
)
450 (call-interactively 'calc-bessel-Y
))
452 :active
(>= (calc-stack-size) 2)
453 :help
"The Bessel function of the second kind (of order (2:))"])
454 (list "Combinatorial Functions"
458 (call-interactively 'calc-gcd
))
460 :active
(>= (calc-stack-size) 2)]
464 (call-interactively 'calc-lcm
))
466 :active
(>= (calc-stack-size) 2)]
470 (call-interactively 'calc-factorial
))
472 :active
(>= (calc-stack-size) 1)]
476 (call-interactively 'calc-choose
))
478 :active
(>= (calc-stack-size) 2)]
479 ["permutations(2:,1:)"
482 (call-interactively 'calc-perm
))
484 :active
(>= (calc-stack-size) 2)]
485 ["Primality test for (1:)"
488 (call-interactively 'calc-prime-test
))
490 :active
(>= (calc-stack-size) 1)
491 :help
"For large (1:), a probabilistic test"]
492 ["Factor (1:) into primes"
495 (call-interactively 'calc-prime-factors
))
497 :active
(>= (calc-stack-size) 1)]
498 ["Next prime after (1:)"
501 (call-interactively 'calc-next-prime
))
503 :active
(>= (calc-stack-size) 1)]
504 ["Previous prime before (1:)"
507 (call-interactively 'calc-prev-prime
))
509 :active
(>= (calc-stack-size) 1)]
513 (call-interactively 'calc-totient
))
515 :active
(>= (calc-stack-size) 1)
516 :help
"Euler's totient function"]
520 (call-interactively 'calc-random
))
522 :active
(>= (calc-stack-size) 1)
523 :help
"A random number >=1 and < (1:)"])
525 ["Help on Scientific Functions"
526 (calc-info-goto-node "Scientific Functions")])
527 "Menu for Calc's scientific functions.")
529 (defvar calc-algebra-menu
531 (list "Simplification"
535 (call-interactively 'calc-simplify
))
537 :active
(>= (calc-stack-size) 1)]
538 ["Simplify (1:) with extended rules"
541 (call-interactively 'calc-simplify-extended
))
543 :active
(>= (calc-stack-size) 1)
544 :help
"Apply possibly unsafe simplifications"])
546 ["Expand formula (1:)"
549 (call-interactively 'calc-expand-formula
))
551 :active
(>= (calc-stack-size) 1)
552 :help
"Expand (1:) into its defining formula, if possible"]
553 ["Evaluate variables in (1:)"
556 (call-interactively 'calc-evaluate
))
558 :active
(>= (calc-stack-size) 1)]
559 ["Make substitution in (1:)"
562 (call-interactively 'calc-substitute
))
564 :active
(>= (calc-stack-size) 1)
566 "Substitute all occurrences of a sub-expression with a new sub-expression"])
571 (call-interactively 'calc-factor
))
573 :active
(>= (calc-stack-size) 1)]
574 ["Collect terms in (1:)"
577 (call-interactively 'calc-collect
))
579 :active
(>= (calc-stack-size) 1)
580 :help
"Arrange as a polynomial in a given variable"]
584 (call-interactively 'calc-expand
))
586 :active
(>= (calc-stack-size) 1)
587 :help
"Apply distributive law everywhere"]
588 ["Find roots of (1:)"
591 (call-interactively 'calc-poly-roots
))
593 :active
(>= (calc-stack-size) 1)])
595 ["Differentiate (1:)"
598 (call-interactively 'calc-derivative
))
600 :active
(>= (calc-stack-size) 1)]
601 ["Integrate (1:) [indefinite]"
604 (call-interactively 'calc-integral
))
606 :active
(>= (calc-stack-size) 1)]
607 ["Integrate (1:) [definite]"
610 (let ((var (read-string "Integration variable: ")))
611 (calc-tabular-command 'calcFunc-integ
"Integration"
612 "intg" nil var nil nil
)))
614 :active
(>= (calc-stack-size) 1)]
615 ["Integrate (1:) [numeric]"
618 (call-interactively 'calc-num-integral
))
620 :active
(>= (calc-stack-size) 1)
621 :help
"Integrate using the open Romberg method"]
622 ["Taylor expand (1:)"
625 (call-interactively 'calc-taylor
))
627 :active
(>= (calc-stack-size) 1)]
628 ["Minimize (2:) [initial guess = (1:)]"
631 (call-interactively 'calc-find-minimum
))
633 :active
(>= (calc-stack-size) 2)
634 :help
"Find a local minimum"]
635 ["Maximize (2:) [initial guess = (1:)]"
638 (call-interactively 'calc-find-maximum
))
640 :active
(>= (calc-stack-size) 2)
641 :help
"Find a local maximum"])
643 ["Solve equation (1:)"
646 (call-interactively 'calc-solve-for
))
648 :active
(>= (calc-stack-size) 1)]
649 ["Solve equation (2:) numerically [initial guess = (1:)]"
652 (call-interactively 'calc-find-root
))
654 :active
(>= (calc-stack-size) 2)]
655 ["Find roots of polynomial (1:)"
658 (call-interactively 'calc-poly-roots
))
660 :active
(>= (calc-stack-size) 1)])
661 (list "Curve Fitting"
662 ["Fit (1:)=[x values, y values] to a curve"
665 (call-interactively 'calc-curve-fit
))
667 :active
(>= (calc-stack-size) 1)])
670 (calc-info-goto-node "Algebra")])
671 "Menu for Calc's algebraic facilities.")
674 (defvar calc-graphics-menu
676 ["Graph 2D [(1:)= y values, (2:)= x values]"
678 (require 'calc-graph
)
679 (call-interactively 'calc-graph-fast
))
681 :active
(>= (calc-stack-size) 2)]
682 ["Graph 3D [(1:)= z values, (2:)= y values, (3:)= x values]"
684 (require 'calc-graph
)
685 (call-interactively 'calc-graph-fast-3d
))
687 :active
(>= (calc-stack-size) 3)]
690 (calc-info-goto-node "Graphics")])
691 "Menu for Calc's graphics.")
694 (defvar calc-vectors-menu
695 (list "Matrices/Vectors"
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)]
705 (require 'calc-arith
)
706 (call-interactively 'calc-inv
))
708 :active
(>= (calc-stack-size) 1)]
709 ["Create an identity matrix"
712 (call-interactively 'calc-ident
))
717 (call-interactively 'calc-transpose
))
719 :active
(>= (calc-stack-size) 1)]
723 (call-interactively 'calc-mdet
))
725 :active
(>= (calc-stack-size) 1)]
729 (call-interactively 'calc-mtrace
))
731 :active
(>= (calc-stack-size) 1)]
732 ["LUD decompose (1:)"
735 (call-interactively 'calc-mlud
))
737 :active
(>= (calc-stack-size) 1)]
738 ["Extract a row from (1:)"
741 (call-interactively 'calc-mrow
))
743 :active
(>= (calc-stack-size) 1)]
744 ["Extract a column from (1:)"
747 (call-interactively 'calc-mcol
))
749 :active
(>= (calc-stack-size) 1)])
751 ["Extract the first element of (1:)"
754 (call-interactively 'calc-head
))
756 :active
(>= (calc-stack-size) 1)]
757 ["Extract an element from (1:)"
760 (call-interactively 'calc-mrow
))
762 :active
(>= (calc-stack-size) 1)]
766 (call-interactively 'calc-reverse-vector
))
768 :active
(>= (calc-stack-size) 1)]
772 (call-interactively 'calc-unpack
))
774 :active
(>= (calc-stack-size) 1)
775 :help
"Separate the elements of (1:)"]
779 (call-interactively 'calc-cross
))
781 :active
(>= (calc-stack-size) 2)
782 :help
"The cross product in R^3"]
786 :active
(>= (calc-stack-size) 2)
787 :help
"The dot product"]
788 ["Map a function across (1:)"
791 (call-interactively 'calc-map
))
793 :active
(>= (calc-stack-size) 1)
794 :help
"Apply a function to each element"])
795 (list "Vectors As Sets"
796 ["Remove duplicates from (1:)"
799 (call-interactively 'calc-remove-duplicates
))
801 :active
(>= (calc-stack-size) 1)]
805 (call-interactively 'calc-set-union
))
807 :active
(>= (calc-stack-size) 2)]
808 ["(2:) intersect (1:)"
811 (call-interactively 'calc-set-intersect
))
813 :active
(>= (calc-stack-size) 2)]
817 (call-interactively 'calc-set-difference
))
819 :help
"Set difference"
820 :active
(>= (calc-stack-size) 2)])
821 (list "Statistics On Vectors"
825 (call-interactively 'calc-vector-count
))
827 :active
(>= (calc-stack-size) 1)
828 :help
"The number of data values"]
832 (call-interactively 'calc-vector-sum
))
834 :active
(>= (calc-stack-size) 1)
835 :help
"The sum of the data values"]
839 (call-interactively 'calc-vector-max
))
841 :active
(>= (calc-stack-size) 1)
842 :help
"The maximum of the data values"]
846 (call-interactively 'calc-vector-min
))
848 :active
(>= (calc-stack-size) 1)
849 :help
"The minimum of the data values"]
853 (call-interactively 'calc-vector-mean
))
855 :active
(>= (calc-stack-size) 1)
856 :help
"The average (arithmetic mean) of the data values"]
857 ["mean(1:) with error"
860 (call-interactively 'calc-vector-mean-error
))
862 :active
(>= (calc-stack-size) 1)
863 :help
"The average (arithmetic mean) of the data values as an error form"]
867 (call-interactively 'calc-vector-rms
))
869 :active
(>= (calc-stack-size) 1)
870 :help
"The root mean square of the data values"]
874 (call-interactively 'calc-vector-sdev
))
876 :active
(>= (calc-stack-size) 1)
877 :help
"The sample sdev, sqrt[sum((values - mean)^2)/(N-1)]"]
881 (call-interactively 'calc-vector-variance
))
883 :active
(>= (calc-stack-size) 1)
884 :help
"The sample variance, sum((values - mean)^2)/(N-1)"]
885 ["population sdev(1:)"
888 (call-interactively 'calc-vector-pop-sdev
))
890 :active
(>= (calc-stack-size) 1)
891 :help
"The population sdev, sqrt[sum((values - mean)^2)/N]"]
892 ["population variance(1:)"
895 (call-interactively 'calc-vector-pop-variance
))
897 :active
(>= (calc-stack-size) 1)
898 :help
"The population variance, sum((values - mean)^2)/N"]
902 (call-interactively 'calc-vector-median
))
904 :active
(>= (calc-stack-size) 1)
905 :help
"The median of the data values"]
909 (call-interactively 'calc-vector-harmonic-mean
))
911 :active
(>= (calc-stack-size) 1)]
912 ["geometric mean(1:)"
915 (call-interactively 'calc-vector-geometric-mean
))
917 :active
(>= (calc-stack-size) 1)]
918 ["arithmetic-geometric mean(1:)"
921 (let ((calc-hyperbolic-flag t
))
922 (call-interactively 'calc-vector-geometric-mean
)))
924 :active
(>= (calc-stack-size) 1)]
926 ;; (progn (require 'calc-arith)
927 ;; (call-interactively 'calc-abs))
929 ;; :active (>= (calc-stack-size) 1)
930 ;; :help "The root-mean-square, or quadratic mean"]
932 ["Abbreviate long vectors"
935 (call-interactively 'calc-full-vectors
))
938 :selected
(not calc-full-vectors
)]
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
946 ["Convert units in (1:)"
948 (require 'calc-units
)
949 (call-interactively 'calc-convert-units
))
951 :active
(>= (calc-stack-size) 1)]
952 ["Convert temperature in (1:)"
954 (require 'calc-units
)
955 (call-interactively 'calc-convert-temperature
))
957 :active
(>= (calc-stack-size) 1)]
958 ["Simplify units in (1:)"
960 (require 'calc-units
)
961 (call-interactively 'calc-simplify-units
))
963 :active
(>= (calc-stack-size) 1)]
966 (require 'calc-units
)
967 (call-interactively 'calc-view-units-table
))
969 (list "Logarithmic Units"
970 ["Convert (1:) to dB (power)"
972 (require 'calc-units
)
973 (call-interactively 'calc-db
))
975 :active
(>= (calc-stack-size) 1)]
976 ["Convert (2:) to dB (power) with reference level (1:)"
978 (require 'calc-units
)
979 (let ((calc-option-flag t
))
980 (call-interactively 'calc-db
)))
982 :active
(>= (calc-stack-size) 2)]
983 ["Convert (1:) to Np (power)"
985 (require 'calc-units
)
986 (call-interactively 'calc-np
))
988 :active
(>= (calc-stack-size) 1)]
989 ["Convert (2:) to Np (power) with reference level (1:)"
991 (require 'calc-units
)
992 (let ((calc-option-flag t
))
993 (call-interactively 'calc-np
)))
995 :active
(>= (calc-stack-size) 2)]
996 ["Convert (1:) to power quantity"
998 (require 'calc-units
)
999 (call-interactively 'calc-lu-quant
))
1001 :active
(>= (calc-stack-size) 1)]
1002 ["Convert (2:) to power quantity with reference level (1:)"
1004 (require 'calc-units
)
1005 (let ((calc-option-flag t
))
1006 (call-interactively 'calc-lu-quant
)))
1008 :active
(>= (calc-stack-size) 2)]
1010 ["Convert (1:) to dB (field)"
1012 (require 'calc-units
)
1013 (let ((calc-hyperbolic-flag t
))
1014 (call-interactively 'calc-db
)))
1016 :active
(>= (calc-stack-size) 1)]
1017 ["Convert (2:) to dB (field) with reference level (1:)"
1019 (require 'calc-units
)
1020 (let ((calc-option-flag t
)
1021 (calc-hyperbolic-flag t
))
1022 (call-interactively 'calc-db
)))
1024 :active
(>= (calc-stack-size) 2)]
1025 ["Convert (1:) to Np (field)"
1027 (require 'calc-units
)
1028 (let ((calc-hyperbolic-flag t
))
1029 (call-interactively 'calc-np
)))
1031 :active
(>= (calc-stack-size) 1)]
1032 ["Convert (2:) to Np (field) with reference level (1:)"
1034 (require 'calc-units
)
1035 (let ((calc-option-flag t
)
1036 (calc-hyperbolic-flag t
))
1037 (call-interactively 'calc-np
)))
1039 :active
(>= (calc-stack-size) 2)]
1040 ["Convert (1:) to field quantity"
1042 (require 'calc-units
)
1043 (let ((calc-hyperbolic-flag t
))
1044 (call-interactively 'calc-lu-quant
)))
1046 :active
(>= (calc-stack-size) 1)]
1047 ["Convert (2:) to field quantity with reference level (1:)"
1049 (require 'calc-units
)
1050 (let ((calc-option-flag t
)
1051 (calc-hyperbolic-flag))
1052 (call-interactively 'calc-lu-quant
)))
1054 :active
(>= (calc-stack-size) 2)])
1055 (list "Musical Notes"
1056 ["Convert (1:) to scientific pitch notation"
1058 (require 'calc-units
)
1059 (call-interactively 'calc-spn
))
1061 :active
(>= (calc-stack-size) 1)]
1062 ["Convert (1:) to midi number"
1064 (require 'calc-units
)
1065 (call-interactively 'calc-midi
))
1067 :active
(>= (calc-stack-size) 1)]
1068 ["Convert (1:) to frequency"
1070 (require 'calc-units
)
1071 (call-interactively 'calc-freq
))
1073 :active
(>= (calc-stack-size) 1)])
1076 (calc-info-goto-node "Units")])
1077 "Menu for Calc's units functions.")
1079 (defvar calc-variables-menu
1081 ["Store (1:) into a variable"
1083 (require 'calc-store
)
1084 (call-interactively 'calc-store
))
1086 :active
(>= (calc-stack-size) 1)]
1087 ["Recall a variable value"
1089 (require 'calc-store
)
1090 (call-interactively 'calc-recall
))
1092 ["Edit the value of a variable"
1094 (require 'calc-store
)
1095 (call-interactively 'calc-edit-variable
))
1097 ["Exchange (1:) with a variable value"
1099 (require 'calc-store
)
1100 (call-interactively 'calc-store-exchange
))
1102 :active
(>= (calc-stack-size) 1)]
1103 ["Clear variable value"
1105 (require 'calc-store
)
1106 (call-interactively 'calc-unstore
))
1108 ["Evaluate variables in (1:)"
1111 (call-interactively 'calc-evaluate
))
1113 :active
(>= (calc-stack-size) 1)]
1114 ["Evaluate (1:), assigning a value to a variable"
1116 (require 'calc-store
)
1117 (call-interactively 'calc-let
))
1119 :active
(>= (calc-stack-size) 1)
1120 :help
"Evaluate (1:) under a temporary assignment of a variable"]
1122 ["Help on Variables"
1123 (calc-info-goto-node "Store and Recall")])
1124 "Menu for Calc's variables.")
1126 (defvar calc-stack-menu
1131 :active
(>= (calc-stack-size) 1)]
1132 ["Switch (1:) and (2:)"
1135 :active
(>= (calc-stack-size) 2)]
1139 :active
(>= (calc-stack-size) 1)]
1142 (require 'calc-yank
)
1143 (call-interactively calc-edit
))
1145 :active
(>= (calc-stack-size) 1)]
1148 (calc-info-goto-node "Stack and Trail")])
1149 "Menu for Calc's stack functions.")
1151 (defvar calc-errors-menu
1155 (require 'calc-undo
)
1156 (call-interactively 'calc-undo
))
1160 (require 'calc-undo
)
1161 (call-interactively 'calc-redo
))
1166 (calc-info-goto-node "Introduction")
1167 (Info-goto-node "Undo"))]))
1169 (defvar calc-modes-menu
1174 (call-interactively 'calc-precision
))
1176 :help
"Set the precision for floating point calculations"]
1179 (require 'calc-frac
)
1180 (call-interactively 'calc-frac-mode
))
1183 :selected calc-prefer-frac
1184 :help
"Leave integer quotients as fractions"]
1188 (require 'calc-mode
)
1189 (calc-symbolic-mode nil
))
1192 :selected calc-symbolic-mode
1193 :help
"Leave functions producing inexact answers in symbolic form"]
1197 (require 'calc-mode
)
1198 (calc-infinite-mode nil
))
1201 :selected calc-infinite-mode
1202 :help
"Let expressions like 1/0 produce infinite results"]
1203 ["Abbreviate long vectors"
1205 (require 'calc-mode
)
1206 (call-interactively 'calc-full-vectors
))
1209 :selected
(not calc-full-vectors
)]
1210 (list "Simplification"
1211 ["No simplification mode"
1213 (require 'calc-mode
)
1214 (calc-no-simplify-mode t
))
1217 :selected
(eq calc-simplify-mode
'none
)
1218 :help
"No simplifications are done automatically"]
1219 ["Numeric simplification mode"
1221 (require 'calc-mode
)
1222 (calc-num-simplify-mode t
))
1225 :selected
(eq calc-simplify-mode
'num
)
1226 :help
"Only numeric simplifications are done automatically"]
1227 ["Basic simplification mode"
1229 (require 'calc-mode
)
1230 (calc-basic-simplify-mode t
))
1233 :selected
(eq calc-simplify-mode nil
)
1234 :help
"Only basic simplifications are done automatically"]
1235 ["Binary simplification mode"
1237 (require 'calc-mode
)
1238 (calc-bin-simplify-mode t
))
1241 :selected
(eq calc-simplify-mode
'binary
)
1242 :help
"Basic simplifications with binary clipping are done automatically"]
1243 ["Algebraic simplification mode"
1245 (require 'calc-mode
)
1246 (calc-alg-simplify-mode t
))
1249 :selected
(eq calc-simplify-mode
'alg
)
1250 :help
"Standard algebraic simplifications are done automatically"]
1251 ["Extended simplification mode"
1253 (require 'calc-mode
)
1254 (calc-ext-simplify-mode t
))
1257 :selected
(eq calc-simplify-mode
'ext
)
1258 :help
"Extended (unsafe) simplifications are done automatically"]
1259 ["Units simplification mode"
1261 (require 'calc-mode
)
1262 (calc-units-simplify-mode t
))
1265 :selected
(eq calc-simplify-mode
'units
)
1266 :help
"Algebraic and unit simplifications are done automatically"])
1267 (list "Angle Measure"
1270 (require 'calc-math
)
1271 (call-interactively 'calc-radians-mode
))
1274 :selected
(eq calc-angle-mode
'rad
)]
1277 (require 'calc-math
)
1278 (call-interactively 'calc-degrees-mode
))
1281 :selected
(eq calc-angle-mode
'deg
)]
1284 (require 'calc-math
)
1285 (call-interactively 'calc-hms-mode
))
1288 :selected
(eq calc-angle-mode
'hms
)])
1293 (call-interactively 'calc-decimal-radix
))
1296 :selected
(and (= calc-number-radix
10)
1297 (not calc-twos-complement-mode
))]
1301 (call-interactively 'calc-binary-radix
))
1304 :selected
(and (= calc-number-radix
2)
1305 (not calc-twos-complement-mode
))]
1309 (call-interactively 'calc-octal-radix
))
1312 :selected
(and (= calc-number-radix
8)
1313 (not calc-twos-complement-mode
))]
1317 (call-interactively 'calc-hex-radix
))
1320 :selected
(and (= calc-number-radix
16)
1321 (not calc-twos-complement-mode
))]
1325 (call-interactively 'calc-radix
))
1329 (not calc-twos-complement-mode
)
1332 (= calc-number-radix
10)
1333 (= calc-number-radix
2)
1334 (= calc-number-radix
8)
1335 (= calc-number-radix
16))))]
1336 ["--Two's Complement--"
1344 (lambda () (interactive) (calc-binary-radix t
))))
1347 :selected
(and (= calc-number-radix
2)
1348 calc-twos-complement-mode
)]
1353 (lambda () (interactive) (calc-octal-radix t
))))
1356 :selected
(and (= calc-number-radix
8)
1357 calc-twos-complement-mode
)]
1362 (lambda () (interactive) (calc-hex-radix t
))))
1365 :selected
(and (= calc-number-radix
16)
1366 calc-twos-complement-mode
)])
1367 (list "Float Format"
1370 (require 'calc-mode
)
1371 (call-interactively 'calc-normal-notation
))
1374 :selected
(eq (car-safe calc-float-format
) 'float
)]
1377 (require 'calc-mode
)
1378 (call-interactively 'calc-fix-notation
))
1381 :selected
(eq (car-safe calc-float-format
) 'fix
)]
1382 ["Scientific notation"
1384 (require 'calc-mode
)
1385 (call-interactively 'calc-sci-notation
))
1388 :selected
(eq (car-safe calc-float-format
) 'sci
)]
1389 ["Engineering notation"
1391 (require 'calc-mode
)
1392 (call-interactively 'calc-eng-notation
))
1395 :selected
(eq (car-safe calc-float-format
) 'eng
)])
1396 (list "Complex Format"
1399 (require 'calc-cplx
)
1400 (calc-complex-notation))
1402 :selected
(not calc-complex-format
)
1404 :help
"Display complex numbers as ordered pairs."]
1407 (require 'calc-cplx
)
1410 :selected
(eq calc-complex-format
'i
)
1412 :help
"Display complex numbers as a+bi."]
1415 (require 'calc-cplx
)
1418 :selected
(eq calc-complex-format
'j
)
1420 :help
"Display complex numbers as a+bj."]
1422 (calc-complex-notation)
1424 :selected
(and calc-complex-format
1425 (not (eq calc-complex-format
'i
))
1426 (not (eq calc-complex-format
'j
)))
1431 (require 'calc-cplx
)
1432 (calc-polar-mode nil
))
1434 :selected
(eq calc-complex-mode
'polar
)
1436 :help
"Prefer polar form for complex numbers."])
1440 (require 'calc-mode
)
1442 (calc-incomplete-algebraic-mode
1443 (calc-algebraic-mode t
))
1444 (calc-algebraic-mode
1445 (calc-algebraic-mode nil
))))
1447 :selected
(not calc-algebraic-mode
)]
1450 (require 'calc-mode
)
1452 calc-incomplete-algebraic-mode
1453 (not calc-algebraic-mode
))
1454 (calc-algebraic-mode nil
)))
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"
1462 (require 'calc-mode
)
1463 (unless calc-incomplete-algebraic-mode
1464 (calc-algebraic-mode t
)))
1467 :selected calc-incomplete-algebraic-mode
1468 :help
"Only ( and [ begin algebraic entry"]
1469 ["Total algebraic mode"
1471 (require 'calc-mode
)
1472 (unless (eq calc-algebraic-mode
'total
)
1473 (calc-total-algebraic-mode nil
)))
1476 :selected
(eq calc-algebraic-mode
'total
)
1477 :help
"All regular letters and punctuation begin algebraic entry"])
1481 (require 'calc-mode
)
1482 (calc-matrix-mode -
1))
1484 :selected
(eq calc-matrix-mode nil
)
1485 :help
"Variables are not assumed to be matrix or scalar"]
1488 (require 'calc-mode
)
1489 (calc-matrix-mode -
2))
1491 :selected
(eq calc-matrix-mode
'matrix
)
1492 :help
"Variables are assumed to be matrices"]
1493 ["Square matrix mode"
1495 (require 'calc-mode
)
1496 (calc-matrix-mode '(4)))
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: "))))
1504 (require 'calc-mode
)
1505 (calc-matrix-mode dim
))
1506 (error "The dimension must be a positive integer")))
1508 :selected
(and (integerp calc-matrix-mode
) (> calc-matrix-mode
0))
1509 :help
"Variables are assumed to be NxN matrices"]
1512 (require 'calc-mode
)
1513 (calc-matrix-mode 0))
1515 :selected
(eq calc-matrix-mode
'scalar
)
1516 :help
"Variables are assumed to be scalars"])
1520 (require 'calc-lang
)
1521 (call-interactively 'calc-normal-language
))
1524 :selected
(eq calc-language nil
)]
1527 (require 'calc-lang
)
1528 (call-interactively 'calc-big-language
))
1531 :selected
(eq calc-language
'big
)
1532 :help
"Use textual approximations to various mathematical notations"]
1535 (require 'calc-lang
)
1536 (call-interactively 'calc-flat-language
))
1539 :selected
(eq calc-language
'flat
)
1540 :help
"Write matrices on a single line"]
1543 (require 'calc-lang
)
1544 (call-interactively 'calc-c-language
))
1547 :selected
(eq calc-language
'c
)]
1550 (require 'calc-lang
)
1551 (call-interactively 'calc-pascal-language
))
1554 :selected
(eq calc-language
'pascal
)]
1557 (require 'calc-lang
)
1558 (call-interactively 'calc-fortran-language
))
1561 :selected
(eq calc-language
'fortran
)]
1564 (require 'calc-lang
)
1565 (call-interactively 'calc-tex-language
))
1568 :selected
(eq calc-language
'tex
)]
1571 (require 'calc-lang
)
1572 (call-interactively 'calc-latex-language
))
1575 :selected
(eq calc-language
'latex
)]
1578 (require 'calc-lang
)
1579 (call-interactively 'calc-eqn-language
))
1582 :selected
(eq calc-language
'eqn
)]
1585 (require 'calc-lang
)
1586 (call-interactively 'calc-yacas-language
))
1589 :selected
(eq calc-language
'yacas
)]
1592 (require 'calc-lang
)
1593 (call-interactively 'calc-maxima-language
))
1596 :selected
(eq calc-language
'maxima
)]
1599 (require 'calc-lang
)
1600 (call-interactively 'calc-giac-language
))
1603 :selected
(eq calc-language
'giac
)]
1606 (require 'calc-lang
)
1607 (call-interactively 'calc-mathematica-language
))
1610 :selected
(eq calc-language
'math
)]
1613 (require 'calc-lang
)
1614 (call-interactively 'calc-maple-language
))
1617 :selected
(eq calc-language
'maple
)])
1619 ["Save mode settings" calc-save-modes
:keys
"m m"]
1622 (calc-info-goto-node "Mode settings")])
1623 "Menu for Calc's mode settings.")
1625 (defvar calc-help-menu
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.
1652 :visible
'(eq major-mode
'calc-mode
)
1653 calc-arithmetic-menu
1654 calc-scientific-function-menu
1667 (call-interactively 'calc-reset
))
1668 :help
"Reset Calc to its initial state"]
1669 ["Quit" calc-quit
]))
1671 (provide 'calc-menu
)