1 ;;; calc-menu.el --- a menu for Calc
3 ;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
5 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 (defvar calc-arithmetic-menu
27 ["-(1:)" calc-change-sign
28 :keys
"n" :active
(>= (calc-stack-size) 1)]
29 ["(2:) + (1:)" calc-plus
30 :keys
"+" :active
(>= (calc-stack-size) 2)]
31 ["(2:) - (1:)" calc-minus
32 :keys
"-" :active
(>= (calc-stack-size) 2)]
33 ["(2:) * (1:)" calc-times
34 :keys
"*" :active
(>= (calc-stack-size) 2)]
35 ["(2:) / (1:)" calc-divide
36 :keys
"/" :active
(>= (calc-stack-size) 2)]
37 ["(2:) ^ (1:)" calc-power
38 :keys
"^" :active
(>= (calc-stack-size) 2)]
42 (let ((calc-inverse-flag t
))
43 (call-interactively 'calc-power
)))
45 :active
(>= (calc-stack-size) 2)
46 :help
"The (1:)th root of (2:)"]
50 (call-interactively 'calc-abs
))
52 :active
(>= (calc-stack-size) 1)
53 :help
"Absolute value"]
57 (call-interactively 'calc-inv
))
59 :active
(>= (calc-stack-size) 1)]
63 (call-interactively 'calc-sqrt
))
65 :active
(>= (calc-stack-size) 1)]
69 (call-interactively 'calc-idiv
))
71 :active
(>= (calc-stack-size) 2)
72 :help
"The integer quotient of (2:) over (1:)"]
76 (call-interactively 'calc-mod
))
78 :active
(>= (calc-stack-size) 2)
79 :help
"The remainder when (2:) is divided by (1:)"])
84 (call-interactively 'calc-floor
))
86 :active
(>= (calc-stack-size) 1)
87 :help
"The greatest integer less than or equal to (1:)"]
91 (call-interactively 'calc-ceiling
))
93 :active
(>= (calc-stack-size) 1)
94 :help
"The smallest integer greater than or equal to (1:)"]
98 (call-interactively 'calc-round
))
100 :active
(>= (calc-stack-size) 1)
101 :help
"The nearest integer to (1:)"]
104 (require 'calc-arith
)
105 (call-interactively 'calc-trunc
))
107 :active
(>= (calc-stack-size) 1)
108 :help
"The integer part of (1:)"])
109 (list "Complex Numbers"
113 (call-interactively 'calc-re
))
115 :active
(>= (calc-stack-size) 1)]
119 (call-interactively 'calc-im
))
121 :active
(>= (calc-stack-size) 1)]
125 (call-interactively 'calc-conj
))
127 :active
(>= (calc-stack-size) 1)
128 :help
"The complex conjugate of (1:)"]
130 (progn (require 'calc-arith
)
131 (call-interactively 'calc-abs
))
133 :active
(>= (calc-stack-size) 1)
134 :help
"The length (absolute value) of (1:)"]
138 (call-interactively 'calc-argument
))
140 :active
(>= (calc-stack-size) 1)
141 :help
"The argument (polar angle) of (1:)"])
143 ["Convert (1:) to a float"
146 (call-interactively 'calc-float
))
148 :active
(>= (calc-stack-size) 1)]
149 ["Convert (1:) to a fraction"
152 (call-interactively 'calc-fraction
))
154 :active
(>= (calc-stack-size) 1)])
159 (call-interactively 'calc-word-size
))
161 ["Clip (1:) to word size"
164 (call-interactively 'calc-clip
))
166 :active
(>= (calc-stack-size) 1)
167 :help
"Reduce (1:) modulo 2^wordsize"]
171 (call-interactively 'calc-and
))
173 :active
(>= (calc-stack-size) 2)
174 :help
"Bitwise AND [modulo 2^wordsize]"]
178 (call-interactively 'calc-or
))
180 :active
(>= (calc-stack-size) 2)
181 :help
"Bitwise inclusive OR [modulo 2^wordsize]"]
185 (call-interactively 'calc-xor
))
187 :active
(>= (calc-stack-size) 2)
188 :help
"Bitwise exclusive OR [modulo 2^wordsize]"]
192 (call-interactively 'calc-diff
))
194 :active
(>= (calc-stack-size) 2)
195 :help
"Bitwise difference [modulo 2^wordsize]"]
199 (call-interactively 'calc-not
))
201 :active
(>= (calc-stack-size) 1)
202 :help
"Bitwise NOT [modulo 2^wordsize]"]
206 (call-interactively 'calc-lshift-binary
))
208 :active
(>= (calc-stack-size) 1)
209 :help
"Shift (1:)[modulo 2^wordsize] one bit left"]
213 (call-interactively 'calc-rshift-binary
))
215 :active
(>= (calc-stack-size) 1)
216 :help
"Shift (1:)[modulo 2^wordsize] one bit right, putting 0s on the left"]
217 ["arithmetic right shift(1:)"
220 (call-interactively 'calc-rshift-arith
))
222 :active
(>= (calc-stack-size) 1)
223 :help
"Shift (1:)[modulo 2^wordsize] one bit right, duplicating the leftmost bit"]
227 (call-interactively 'calc-rotate-binary
))
229 :active
(>= (calc-stack-size) 1)
230 :help
"Rotate (1:)[modulo 2^wordsize] one bit left"])
232 ["Help on Arithmetic"
233 (calc-info-goto-node "Arithmetic")])
234 "Menu for Calc's arithmetic functions.")
236 (defvar calc-scientific-function-menu
237 (list "Scientific Functions"
242 (call-interactively 'calc-pi
))
247 (let ((calc-hyperbolic-flag t
))
248 (call-interactively 'calc-pi
)))
253 (let ((calc-inverse-flag t
)
254 (calc-hyperbolic-flag t
))
255 (call-interactively 'calc-pi
)))
257 :help
"The golden ratio"]
261 (let ((calc-inverse-flag t
))
262 (call-interactively 'calc-pi
)))
264 :help
"Euler's constant"])
265 (list "Logs and Exps"
269 (call-interactively 'calc-ln
))
271 :active
(>= (calc-stack-size) 1)
272 :help
"The natural logarithm"]
276 (call-interactively 'calc-exp
))
278 :active
(>= (calc-stack-size) 1)]
282 (call-interactively 'calc-log10
))
284 :active
(>= (calc-stack-size) 1)
285 :help
"The common logarithm"]
289 (let ((calc-inverse-flag t
))
290 (call-interactively 'calc-log10
)))
292 :active
(>= (calc-stack-size) 1)]
293 ["log(2:) [base(1:)]"
296 (call-interactively 'calc-log
))
298 :active
(>= (calc-stack-size) 2)
299 :help
"The logarithm with an arbitrary base"]
303 :active
(>= (calc-stack-size) 2)])
304 (list "Trigonometric Functions"
308 (call-interactively 'calc-sin
))
310 :active
(>= (calc-stack-size) 1)]
314 (call-interactively 'calc-cos
))
316 :active
(>= (calc-stack-size) 1)]
320 (call-interactively 'calc-tan
))
322 :active
(>= (calc-stack-size) 1)]
326 (call-interactively 'calc-arcsin
))
328 :active
(>= (calc-stack-size) 1)]
332 (call-interactively 'calc-arccos
))
334 :active
(>= (calc-stack-size) 1)]
338 (call-interactively 'calc-arctan
))
340 :active
(>= (calc-stack-size) 1)]
344 (call-interactively 'calc-arctan2
))
346 :active
(>= (calc-stack-size) 2)]
354 :selected
(eq calc-angle-mode
'rad
)]
361 :selected
(eq calc-angle-mode
'deg
)]
368 :selected
(eq calc-angle-mode
'hms
)])
369 (list "Hyperbolic Functions"
373 (call-interactively 'calc-sinh
))
375 :active
(>= (calc-stack-size) 1)]
379 (call-interactively 'calc-cosh
))
381 :active
(>= (calc-stack-size) 1)]
385 (call-interactively 'calc-tanh
))
387 :active
(>= (calc-stack-size) 1)]
391 (call-interactively 'calc-arcsinh
))
393 :active
(>= (calc-stack-size) 1)]
397 (call-interactively 'calc-arccosh
))
399 :active
(>= (calc-stack-size) 1)]
403 (call-interactively 'calc-arctanh
))
405 :active
(>= (calc-stack-size) 1)])
406 (list "Advanced Math Functions"
410 (call-interactively 'calc-gamma
))
412 :active
(>= (calc-stack-size) 1)
413 :help
"The Euler Gamma function"]
416 (require 'calc-funcs
)
417 (call-interactively 'calc-inc-gamma
))
419 :active
(>= (calc-stack-size) 2)
420 :help
"The lower incomplete Gamma function"]
423 (require 'calc-funcs
)
424 (call-interactively 'calc-beta
))
426 :active
(>= (calc-stack-size) 2)
427 :help
"The Euler Beta function"]
430 (require 'calc-funcs
)
431 (call-interactively 'calc-inc-beta
))
433 :active
(>= (calc-stack-size) 3)
434 :help
"The incomplete Beta function"]
437 (require 'calc-funcs
)
438 (call-interactively 'calc-erf
))
440 :active
(>= (calc-stack-size) 1)
441 :help
"The error function"]
444 (require 'calc-funcs
)
445 (call-interactively 'calc-bessel-J
))
447 :active
(>= (calc-stack-size) 2)
448 :help
"The Bessel function of the first kind (of order (2:))"]
451 (require 'calc-funcs
)
452 (call-interactively 'calc-bessel-Y
))
454 :active
(>= (calc-stack-size) 2)
455 :help
"The Bessel function of the second kind (of order (2:))"])
456 (list "Combinatorial Functions"
460 (call-interactively 'calc-gcd
))
462 :active
(>= (calc-stack-size) 2)]
466 (call-interactively 'calc-lcm
))
468 :active
(>= (calc-stack-size) 2)]
472 (call-interactively 'calc-factorial
))
474 :active
(>= (calc-stack-size) 1)]
478 (call-interactively 'calc-choose
))
480 :active
(>= (calc-stack-size) 2)]
481 ["permutations(2:,1:)"
484 (call-interactively 'calc-perm
))
486 :active
(>= (calc-stack-size) 2)]
487 ["Primality test for (1:)"
490 (call-interactively 'calc-prime-test
))
492 :active
(>= (calc-stack-size) 1)
493 :help
"For large (1:), a probabilistic test"]
494 ["Factor (1:) into primes"
497 (call-interactively 'calc-prime-factors
))
499 :active
(>= (calc-stack-size) 1)]
500 ["Next prime after (1:)"
503 (call-interactively 'calc-next-prime
))
505 :active
(>= (calc-stack-size) 1)]
506 ["Previous prime before (1:)"
509 (call-interactively 'calc-prev-prime
))
511 :active
(>= (calc-stack-size) 1)]
515 (call-interactively 'calc-totient
))
517 :active
(>= (calc-stack-size) 1)
518 :help
"Euler's totient function"]
522 (call-interactively 'calc-random
))
524 :active
(>= (calc-stack-size) 1)
525 :help
"A random number >=1 and < (1:)"])
527 ["Help on Scientific Functions"
528 (calc-info-goto-node "Scientific Functions")])
529 "Menu for Calc's scientific functions.")
531 (defvar calc-algebra-menu
533 (list "Simplification"
537 (call-interactively 'calc-simplify
))
539 :active
(>= (calc-stack-size) 1)]
540 ["Simplify (1:) with extended rules"
543 (call-interactively 'calc-simplify-extended
))
545 :active
(>= (calc-stack-size) 1)
546 :help
"Apply possibly unsafe simplifications"])
548 ["Expand formula (1:)"
551 (call-interactively 'calc-expand-formula
))
553 :active
(>= (calc-stack-size) 1)
554 :help
"Expand (1:) into its defining formula, if possible"]
555 ["Evaluate variables in (1:)"
558 (call-interactively 'calc-evaluate
))
560 :active
(>= (calc-stack-size) 1)]
561 ["Make substitution in (1:)"
564 (call-interactively 'calc-substitute
))
566 :active
(>= (calc-stack-size) 1)
568 "Substitute all occurrences of a sub-expression with a new sub-expression"])
573 (call-interactively 'calc-factor
))
575 :active
(>= (calc-stack-size) 1)]
576 ["Collect terms in (1:)"
579 (call-interactively 'calc-collect
))
581 :active
(>= (calc-stack-size) 1)
582 :help
"Arrange as a polynomial in a given variable"]
586 (call-interactively 'calc-expand
))
588 :active
(>= (calc-stack-size) 1)
589 :help
"Apply distributive law everywhere"]
590 ["Find roots of (1:)"
593 (call-interactively 'calc-poly-roots
))
595 :active
(>= (calc-stack-size) 1)])
597 ["Differentiate (1:)"
600 (call-interactively 'calc-derivative
))
602 :active
(>= (calc-stack-size) 1)]
603 ["Integrate (1:) [indefinite]"
606 (call-interactively 'calc-integral
))
608 :active
(>= (calc-stack-size) 1)]
609 ["Integrate (1:) [definite]"
612 (let ((var (read-string "Integration variable: ")))
613 (calc-tabular-command 'calcFunc-integ
"Integration"
614 "intg" nil var nil nil
)))
616 :active
(>= (calc-stack-size) 1)]
617 ["Integrate (1:) [numeric]"
620 (call-interactively 'calc-num-integral
))
622 :active
(>= (calc-stack-size) 1)
623 :help
"Integrate using the open Romberg method"]
624 ["Taylor expand (1:)"
627 (call-interactively 'calc-taylor
))
629 :active
(>= (calc-stack-size) 1)]
630 ["Minimize (2:) [initial guess = (1:)]"
633 (call-interactively 'calc-find-minimum
))
635 :active
(>= (calc-stack-size) 2)
636 :help
"Find a local minimum"]
637 ["Maximize (2:) [initial guess = (1:)]"
640 (call-interactively 'calc-find-maximum
))
642 :active
(>= (calc-stack-size) 2)
643 :help
"Find a local maximum"])
645 ["Solve equation (1:)"
648 (call-interactively 'calc-solve-for
))
650 :active
(>= (calc-stack-size) 1)]
651 ["Solve equation (2:) numerically [initial guess = (1:)]"
654 (call-interactively 'calc-find-root
))
656 :active
(>= (calc-stack-size) 2)]
657 ["Find roots of polynomial (1:)"
660 (call-interactively 'calc-poly-roots
))
662 :active
(>= (calc-stack-size) 1)])
663 (list "Curve Fitting"
664 ["Fit (1:)=[x values, y values] to a curve"
667 (call-interactively 'calc-curve-fit
))
669 :active
(>= (calc-stack-size) 1)])
672 (calc-info-goto-node "Algebra")])
673 "Menu for Calc's algebraic facilities.")
676 (defvar calc-graphics-menu
678 ["Graph 2D [(1:)= y values, (2:)= x values]"
680 (require 'calc-graph
)
681 (call-interactively 'calc-graph-fast
))
683 :active
(>= (calc-stack-size) 2)]
684 ["Graph 3D [(1:)= z values, (2:)= y values, (3:)= x values]"
686 (require 'calc-graph
)
687 (call-interactively 'calc-graph-fast-3d
))
689 :active
(>= (calc-stack-size) 3)]
692 (calc-info-goto-node "Graphics")])
693 "Menu for Calc's graphics.")
696 (defvar calc-vectors-menu
697 (list "Matrices/Vectors"
699 ["(2:) + (1:)" calc-plus
700 :keys
"+" :active
(>= (calc-stack-size) 2)]
701 ["(2:) - (1:)" calc-minus
702 :keys
"-" :active
(>= (calc-stack-size) 2)]
703 ["(2:) * (1:)" calc-times
704 :keys
"*" :active
(>= (calc-stack-size) 2)]
707 (require 'calc-arith
)
708 (call-interactively 'calc-inv
))
710 :active
(>= (calc-stack-size) 1)]
711 ["Create an identity matrix"
714 (call-interactively 'calc-ident
))
719 (call-interactively 'calc-transpose
))
721 :active
(>= (calc-stack-size) 1)]
725 (call-interactively 'calc-mdet
))
727 :active
(>= (calc-stack-size) 1)]
731 (call-interactively 'calc-mtrace
))
733 :active
(>= (calc-stack-size) 1)]
734 ["LUD decompose (1:)"
737 (call-interactively 'calc-mlud
))
739 :active
(>= (calc-stack-size) 1)]
740 ["Extract a row from (1:)"
743 (call-interactively 'calc-mrow
))
745 :active
(>= (calc-stack-size) 1)]
746 ["Extract a column from (1:)"
749 (call-interactively 'calc-mcol
))
751 :active
(>= (calc-stack-size) 1)])
753 ["Extract the first element of (1:)"
756 (call-interactively 'calc-head
))
758 :active
(>= (calc-stack-size) 1)]
759 ["Extract an element from (1:)"
762 (call-interactively 'calc-mrow
))
764 :active
(>= (calc-stack-size) 1)]
768 (call-interactively 'calc-reverse-vector
))
770 :active
(>= (calc-stack-size) 1)]
774 (call-interactively 'calc-unpack
))
776 :active
(>= (calc-stack-size) 1)
777 :help
"Separate the elements of (1:)"]
781 (call-interactively 'calc-cross
))
783 :active
(>= (calc-stack-size) 2)
784 :help
"The cross product in R^3"]
788 :active
(>= (calc-stack-size) 2)
789 :help
"The dot product"]
790 ["Map a function across (1:)"
793 (call-interactively 'calc-map
))
795 :active
(>= (calc-stack-size) 1)
796 :help
"Apply a function to each element"])
797 (list "Vectors As Sets"
798 ["Remove duplicates from (1:)"
801 (call-interactively 'calc-remove-duplicates
))
803 :active
(>= (calc-stack-size) 1)]
807 (call-interactively 'calc-set-union
))
809 :active
(>= (calc-stack-size) 2)]
810 ["(2:) intersect (1:)"
813 (call-interactively 'calc-set-intersect
))
815 :active
(>= (calc-stack-size) 2)]
819 (call-interactively 'calc-set-difference
))
821 :help
"Set difference"
822 :active
(>= (calc-stack-size) 2)])
823 (list "Statistics On Vectors"
827 (call-interactively 'calc-vector-count
))
829 :active
(>= (calc-stack-size) 1)
830 :help
"The number of data values"]
834 (call-interactively 'calc-vector-sum
))
836 :active
(>= (calc-stack-size) 1)
837 :help
"The sum of the data values"]
841 (call-interactively 'calc-vector-max
))
843 :active
(>= (calc-stack-size) 1)
844 :help
"The maximum of the data values"]
848 (call-interactively 'calc-vector-min
))
850 :active
(>= (calc-stack-size) 1)
851 :help
"The minimum of the data values"]
855 (call-interactively 'calc-vector-mean
))
857 :active
(>= (calc-stack-size) 1)
858 :help
"The average (arithmetic mean) of the data values"]
859 ["mean(1:) with error"
862 (call-interactively 'calc-vector-mean-error
))
864 :active
(>= (calc-stack-size) 1)
865 :help
"The average (arithmetic mean) of the data values as an error form"]
869 (call-interactively 'calc-vector-sdev
))
871 :active
(>= (calc-stack-size) 1)
872 :help
"The sample sdev, sqrt[sum((values - mean)^2)/(N-1)]"]
876 (call-interactively 'calc-vector-variance
))
878 :active
(>= (calc-stack-size) 1)
879 :help
"The sample variance, sum((values - mean)^2)/(N-1)"]
880 ["population sdev(1:)"
883 (call-interactively 'calc-vector-pop-sdev
))
885 :active
(>= (calc-stack-size) 1)
886 :help
"The population sdev, sqrt[sum((values - mean)^2)/N]"]
887 ["population variance(1:)"
890 (call-interactively 'calc-vector-pop-variance
))
892 :active
(>= (calc-stack-size) 1)
893 :help
"The population variance, sum((values - mean)^2)/N"]
897 (call-interactively 'calc-vector-median
))
899 :active
(>= (calc-stack-size) 1)
900 :help
"The median of the data values"]
904 (call-interactively 'calc-vector-harmonic-mean
))
906 :active
(>= (calc-stack-size) 1)]
907 ["geometric mean(1:)"
910 (call-interactively 'calc-vector-geometric-mean
))
912 :active
(>= (calc-stack-size) 1)]
913 ["arithmetic-geometric mean(1:)"
916 (let ((calc-hyperbolic-flag t
))
917 (call-interactively 'calc-vector-geometric-mean
)))
919 :active
(>= (calc-stack-size) 1)]
921 (progn (require 'calc-arith
)
922 (call-interactively 'calc-abs
))
924 :active
(>= (calc-stack-size) 1)
925 :help
"The root-mean-square, or quadratic mean"])
926 ["Abbreviate long vectors"
929 (call-interactively 'calc-full-vectors
))
932 :selected
(not calc-full-vectors
)]
934 ["Help on Matrices/Vectors"
935 (calc-info-goto-node "Matrix Functions")])
936 "Menu for Calc's vector and matrix functions.")
938 (defvar calc-units-menu
940 ["Convert units in (1:)"
942 (require 'calc-units
)
943 (call-interactively 'calc-convert-units
))
945 :active
(>= (calc-stack-size) 1)]
946 ["Convert temperature in (1:)"
948 (require 'calc-units
)
949 (call-interactively 'calc-convert-temperature
))
951 :active
(>= (calc-stack-size) 1)]
952 ["Simplify units in (1:)"
954 (require 'calc-units
)
955 (call-interactively 'calc-simplify-units
))
957 :active
(>= (calc-stack-size) 1)]
960 (require 'calc-units
)
961 (call-interactively 'calc-view-units-table
))
963 (list "Logarithmic Units"
964 ["Convert (1:) to dB (power)"
966 (require 'calc-units
)
967 (call-interactively 'calc-db
))
969 :active
(>= (calc-stack-size) 1)]
970 ["Convert (2:) to dB (power) with reference level (1:)"
972 (require 'calc-units
)
973 (let ((calc-option-flag t
))
974 (call-interactively 'calc-db
)))
976 :active
(>= (calc-stack-size) 2)]
977 ["Convert (1:) to Np (power)"
979 (require 'calc-units
)
980 (call-interactively 'calc-np
))
982 :active
(>= (calc-stack-size) 1)]
983 ["Convert (2:) to Np (power) with reference level (1:)"
985 (require 'calc-units
)
986 (let ((calc-option-flag t
))
987 (call-interactively 'calc-np
)))
989 :active
(>= (calc-stack-size) 2)]
990 ["Convert (1:) to power quantity"
992 (require 'calc-units
)
993 (call-interactively 'calc-lu-quant
))
995 :active
(>= (calc-stack-size) 1)]
996 ["Convert (2:) to power quantity with reference level (1:)"
998 (require 'calc-units
)
999 (let ((calc-option-flag t
))
1000 (call-interactively 'calc-lu-quant
)))
1002 :active
(>= (calc-stack-size) 2)]
1004 ["Convert (1:) to dB (field)"
1006 (require 'calc-units
)
1007 (let ((calc-hyperbolic-flag t
))
1008 (call-interactively 'calc-db
)))
1010 :active
(>= (calc-stack-size) 1)]
1011 ["Convert (2:) to dB (field) with reference level (1:)"
1013 (require 'calc-units
)
1014 (let ((calc-option-flag t
)
1015 (calc-hyperbolic-flag t
))
1016 (call-interactively 'calc-db
)))
1018 :active
(>= (calc-stack-size) 2)]
1019 ["Convert (1:) to Np (field)"
1021 (require 'calc-units
)
1022 (let ((calc-hyperbolic-flag t
))
1023 (call-interactively 'calc-np
)))
1025 :active
(>= (calc-stack-size) 1)]
1026 ["Convert (2:) to Np (field) with reference level (1:)"
1028 (require 'calc-units
)
1029 (let ((calc-option-flag t
)
1030 (calc-hyperbolic-flag t
))
1031 (call-interactively 'calc-np
)))
1033 :active
(>= (calc-stack-size) 2)]
1034 ["Convert (1:) to field quantity"
1036 (require 'calc-units
)
1037 (let ((calc-hyperbolic-flag t
))
1038 (call-interactively 'calc-lu-quant
)))
1040 :active
(>= (calc-stack-size) 1)]
1041 ["Convert (2:) to field quantity with reference level (1:)"
1043 (require 'calc-units
)
1044 (let ((calc-option-flag t
)
1045 (calc-hyperbolic-flag))
1046 (call-interactively 'calc-lu-quant
)))
1048 :active
(>= (calc-stack-size) 2)])
1049 (list "Musical Notes"
1050 ["Convert (1:) to scientific pitch notation"
1052 (require 'calc-units
)
1053 (call-interactively 'calc-spn
))
1055 :active
(>= (calc-stack-size) 1)]
1056 ["Convert (1:) to midi number"
1058 (require 'calc-units
)
1059 (call-interactively 'calc-midi
))
1061 :active
(>= (calc-stack-size) 1)]
1062 ["Convert (1:) to frequency"
1064 (require 'calc-units
)
1065 (call-interactively 'calc-freq
))
1067 :active
(>= (calc-stack-size) 1)])
1070 (calc-info-goto-node "Units")])
1071 "Menu for Calc's units functions.")
1073 (defvar calc-variables-menu
1075 ["Store (1:) into a variable"
1077 (require 'calc-store
)
1078 (call-interactively 'calc-store
))
1080 :active
(>= (calc-stack-size) 1)]
1081 ["Recall a variable value"
1083 (require 'calc-store
)
1084 (call-interactively 'calc-recall
))
1086 ["Edit the value of a variable"
1088 (require 'calc-store
)
1089 (call-interactively 'calc-edit-variable
))
1091 ["Exchange (1:) with a variable value"
1093 (require 'calc-store
)
1094 (call-interactively 'calc-store-exchange
))
1096 :active
(>= (calc-stack-size) 1)]
1097 ["Clear variable value"
1099 (require 'calc-store
)
1100 (call-interactively 'calc-unstore
))
1102 ["Evaluate variables in (1:)"
1105 (call-interactively 'calc-evaluate
))
1107 :active
(>= (calc-stack-size) 1)]
1108 ["Evaluate (1:), assigning a value to a variable"
1110 (require 'calc-store
)
1111 (call-interactively 'calc-let
))
1113 :active
(>= (calc-stack-size) 1)
1114 :help
"Evaluate (1:) under a temporary assignment of a variable"]
1116 ["Help on Variables"
1117 (calc-info-goto-node "Store and Recall")])
1118 "Menu for Calc's variables.")
1120 (defvar calc-stack-menu
1125 :active
(>= (calc-stack-size) 1)]
1126 ["Switch (1:) and (2:)"
1129 :active
(>= (calc-stack-size) 2)]
1133 :active
(>= (calc-stack-size) 1)]
1136 (require 'calc-yank
)
1137 (call-interactively calc-edit
))
1139 :active
(>= (calc-stack-size) 1)]
1142 (calc-info-goto-node "Stack and Trail")])
1143 "Menu for Calc's stack functions.")
1145 (defvar calc-errors-menu
1149 (require 'calc-undo
)
1150 (call-interactively 'calc-undo
))
1154 (require 'calc-undo
)
1155 (call-interactively 'calc-redo
))
1160 (calc-info-goto-node "Introduction")
1161 (Info-goto-node "Undo"))]))
1163 (defvar calc-modes-menu
1168 (call-interactively 'calc-precision
))
1170 :help
"Set the precision for floating point calculations"]
1173 (require 'calc-frac
)
1174 (call-interactively 'calc-frac-mode
))
1177 :selected calc-prefer-frac
1178 :help
"Leave integer quotients as fractions"]
1182 (require 'calc-mode
)
1183 (calc-symbolic-mode nil
))
1186 :selected calc-symbolic-mode
1187 :help
"Leave functions producing inexact answers in symbolic form"]
1191 (require 'calc-mode
)
1192 (calc-infinite-mode nil
))
1195 :selected calc-infinite-mode
1196 :help
"Let expressions like 1/0 produce infinite results"]
1197 ["Abbreviate long vectors"
1199 (require 'calc-mode
)
1200 (call-interactively 'calc-full-vectors
))
1203 :selected
(not calc-full-vectors
)]
1204 (list "Angle Measure"
1207 (require 'calc-math
)
1208 (call-interactively 'calc-radians-mode
))
1211 :selected
(eq calc-angle-mode
'rad
)]
1214 (require 'calc-math
)
1215 (call-interactively 'calc-degrees-mode
))
1218 :selected
(eq calc-angle-mode
'deg
)]
1221 (require 'calc-math
)
1222 (call-interactively 'calc-hms-mode
))
1225 :selected
(eq calc-angle-mode
'hms
)])
1230 (call-interactively 'calc-decimal-radix
))
1233 :selected
(and (= calc-number-radix
10)
1234 (not calc-twos-complement-mode
))]
1238 (call-interactively 'calc-binary-radix
))
1241 :selected
(and (= calc-number-radix
2)
1242 (not calc-twos-complement-mode
))]
1246 (call-interactively 'calc-octal-radix
))
1249 :selected
(and (= calc-number-radix
8)
1250 (not calc-twos-complement-mode
))]
1254 (call-interactively 'calc-hex-radix
))
1257 :selected
(and (= calc-number-radix
16)
1258 (not calc-twos-complement-mode
))]
1262 (call-interactively 'calc-radix
))
1266 (not calc-twos-complement-mode
)
1269 (= calc-number-radix
10)
1270 (= calc-number-radix
2)
1271 (= calc-number-radix
8)
1272 (= calc-number-radix
16))))]
1273 ["--Two's Complement--"
1281 (lambda () (interactive) (calc-binary-radix t
))))
1284 :selected
(and (= calc-number-radix
2)
1285 calc-twos-complement-mode
)]
1290 (lambda () (interactive) (calc-octal-radix t
))))
1293 :selected
(and (= calc-number-radix
8)
1294 calc-twos-complement-mode
)]
1299 (lambda () (interactive) (calc-hex-radix t
))))
1302 :selected
(and (= calc-number-radix
16)
1303 calc-twos-complement-mode
)])
1304 (list "Float Format"
1307 (require 'calc-mode
)
1308 (call-interactively 'calc-normal-notation
))
1311 :selected
(eq (car-safe calc-float-format
) 'float
)]
1314 (require 'calc-mode
)
1315 (call-interactively 'calc-fix-notation
))
1318 :selected
(eq (car-safe calc-float-format
) 'fix
)]
1319 ["Scientific notation"
1321 (require 'calc-mode
)
1322 (call-interactively 'calc-sci-notation
))
1325 :selected
(eq (car-safe calc-float-format
) 'sci
)]
1326 ["Engineering notation"
1328 (require 'calc-mode
)
1329 (call-interactively 'calc-eng-notation
))
1332 :selected
(eq (car-safe calc-float-format
) 'eng
)])
1333 (list "Complex Format"
1336 (require 'calc-cplx
)
1337 (calc-complex-notation))
1339 :selected
(not calc-complex-format
)
1341 :help
"Display complex numbers as ordered pairs."]
1344 (require 'calc-cplx
)
1347 :selected
(eq calc-complex-format
'i
)
1349 :help
"Display complex numbers as a+bi."]
1352 (require 'calc-cplx
)
1355 :selected
(eq calc-complex-format
'j
)
1357 :help
"Display complex numbers as a+bj."]
1359 (calc-complex-notation)
1361 :selected
(and calc-complex-format
1362 (not (eq calc-complex-format
'i
))
1363 (not (eq calc-complex-format
'j
)))
1368 (require 'calc-cplx
)
1369 (calc-polar-mode nil
))
1371 :selected
(eq calc-complex-mode
'polar
)
1373 :help
"Prefer polar form for complex numbers."])
1377 (require 'calc-mode
)
1379 (calc-incomplete-algebraic-mode
1380 (calc-algebraic-mode t
))
1381 (calc-algebraic-mode
1382 (calc-algebraic-mode nil
))))
1384 :selected
(not calc-algebraic-mode
)]
1387 (require 'calc-mode
)
1389 calc-incomplete-algebraic-mode
1390 (not calc-algebraic-mode
))
1391 (calc-algebraic-mode nil
)))
1394 :selected
(and calc-algebraic-mode
1395 (not calc-incomplete-algebraic-mode
))
1396 :help
"Keys which start numeric entry also start algebraic entry"]
1397 ["Incomplete algebraic mode"
1399 (require 'calc-mode
)
1400 (unless calc-incomplete-algebraic-mode
1401 (calc-algebraic-mode t
)))
1404 :selected calc-incomplete-algebraic-mode
1405 :help
"Only ( and [ begin algebraic entry"]
1406 ["Total algebraic mode"
1408 (require 'calc-mode
)
1409 (unless (eq calc-algebraic-mode
'total
)
1410 (calc-total-algebraic-mode nil
)))
1413 :selected
(eq calc-algebraic-mode
'total
)
1414 :help
"All regular letters and punctuation begin algebraic entry"])
1418 (require 'calc-lang
)
1419 (call-interactively 'calc-normal-language
))
1422 :selected
(eq calc-language nil
)]
1425 (require 'calc-lang
)
1426 (call-interactively 'calc-big-language
))
1429 :selected
(eq calc-language
'big
)
1430 :help
"Use textual approximations to various mathematical notations"]
1433 (require 'calc-lang
)
1434 (call-interactively 'calc-flat-language
))
1437 :selected
(eq calc-language
'flat
)
1438 :help
"Write matrices on a single line"]
1441 (require 'calc-lang
)
1442 (call-interactively 'calc-c-language
))
1445 :selected
(eq calc-language
'c
)]
1448 (require 'calc-lang
)
1449 (call-interactively 'calc-pascal-language
))
1452 :selected
(eq calc-language
'pascal
)]
1455 (require 'calc-lang
)
1456 (call-interactively 'calc-fortran-language
))
1459 :selected
(eq calc-language
'fortran
)]
1462 (require 'calc-lang
)
1463 (call-interactively 'calc-tex-language
))
1466 :selected
(eq calc-language
'tex
)]
1469 (require 'calc-lang
)
1470 (call-interactively 'calc-latex-language
))
1473 :selected
(eq calc-language
'latex
)]
1476 (require 'calc-lang
)
1477 (call-interactively 'calc-eqn-language
))
1480 :selected
(eq calc-language
'eqn
)]
1483 (require 'calc-lang
)
1484 (call-interactively 'calc-yacas-language
))
1487 :selected
(eq calc-language
'yacas
)]
1490 (require 'calc-lang
)
1491 (call-interactively 'calc-maxima-language
))
1494 :selected
(eq calc-language
'maxima
)]
1497 (require 'calc-lang
)
1498 (call-interactively 'calc-giac-language
))
1501 :selected
(eq calc-language
'giac
)]
1504 (require 'calc-lang
)
1505 (call-interactively 'calc-mathematica-language
))
1508 :selected
(eq calc-language
'math
)]
1511 (require 'calc-lang
)
1512 (call-interactively 'calc-maple-language
))
1515 :selected
(eq calc-language
'maple
)])
1517 ["Save mode settings" calc-save-modes
:keys
"m m"]
1520 (calc-info-goto-node "Mode settings")])
1521 "Menu for Calc's mode settings.")
1523 (defvar calc-help-menu
1537 (calc-info-goto-node "Introduction")
1538 (Info-goto-node "Help Commands"))])
1539 "Menu for Calc's help functions.")
1541 (defvar calc-mode-map
)
1548 :visible
'(eq major-mode
'calc-mode
)
1549 calc-arithmetic-menu
1550 calc-scientific-function-menu
1563 (call-interactively 'calc-reset
))
1564 :help
"Reset Calc to its initial state"]
1565 ["Quit" calc-quit
]))
1567 (provide 'calc-menu
)