calc-menu.el 57 KB

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