annotate lisp/calc/calc-lang.el @ 111709:4483c6423ad1

shr-color.el (shr-color-visible): Don't bug out if the colour names don't exist.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 25 Nov 2010 07:46:51 +0000
parents 4e76c4e4f20f
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
1 ;;; calc-lang.el --- calc language functions
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
2
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, 2005,
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
4 ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
5
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
6 ;; Author: David Gillespie <daveg@synaptics.com>
77465
1154f082efd9 Update maintainer's address.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 76595
diff changeset
7 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
8
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
10
94654
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
76595
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94654
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
15
76595
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
19 ;; GNU General Public License for more details.
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
20
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94654
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
24 ;;; Commentary:
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
25
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
26 ;;; Code:
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
28 ;; This file is autoloaded from calc-ext.el.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29
58661
10224395a3c2 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58571
diff changeset
30 (require 'calc-ext)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 (require 'calc-macs)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
32
86475
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
33
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
34 ;; Declare functions which are defined elsewhere.
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
35 (declare-function math-compose-vector "calccomp" (a sep prec))
86969
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
36 (declare-function math-compose-var "calccomp" (a))
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
37 (declare-function math-tex-expr-is-flat "calccomp" (a))
86475
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
38 (declare-function math-read-factor "calc-aent" ())
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
39 (declare-function math-read-expr-level "calc-aent" (exp-prec &optional exp-term))
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
40
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
41 ;; Declare variables which are defined elsewhere.
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
42 (defvar calc-lang-slash-idiv)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
43 (defvar calc-lang-allow-underscores)
87414
c35602a6afac (calc-lang-allow-percentsigns): Declare as a variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87223
diff changeset
44 (defvar calc-lang-allow-percentsigns)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
45 (defvar math-comp-left-bracket)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
46 (defvar math-comp-right-bracket)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
47 (defvar math-comp-comma)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
48 (defvar math-comp-vector-prec)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
49
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50 ;;; Alternate entry/display languages.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 (defun calc-set-language (lang &optional option no-refresh)
81470
3e0c2ded3e4a (calc-set-language,math-read-big-rec): Let math-expr-opers equal the
Jay Belanger <jay.p.belanger@gmail.com>
parents: 77465
diff changeset
53 (setq math-expr-opers (or (get lang 'math-oper-table) (math-standard-ops))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 math-expr-function-mapping (get lang 'math-function-table)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55 math-expr-variable-mapping (get lang 'math-variable-table)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 calc-language-input-filter (get lang 'math-input-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 calc-language-output-filter (get lang 'math-output-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 calc-vector-brackets (or (get lang 'math-vector-brackets) "[]")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 calc-complex-format (get lang 'math-complex-format)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 calc-radix-formatter (get lang 'math-radix-formatter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
61 calc-function-open (or (get lang 'math-function-open) "(")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62 calc-function-close (or (get lang 'math-function-close) ")"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 (if no-refresh
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 (setq calc-language lang
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65 calc-language-option option)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 (calc-change-mode '(calc-language calc-language-option)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
67 (list lang option) t)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
69 (defun calc-normal-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
70 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
71 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
72 (calc-set-language nil)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
73 (message "Normal language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 (defun calc-flat-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
77 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78 (calc-set-language 'flat)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
79 (message "Flat language mode (all stack entries shown on one line)")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
81 (defun calc-big-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
82 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
83 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84 (calc-set-language 'big)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
85 (message "\"Big\" language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
87 (defun calc-unformatted-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
90 (calc-set-language 'unform)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
91 (message "Unformatted language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
92
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
93
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
94 (defun calc-c-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 (calc-set-language 'c)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
98 (message "`C' language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 (put 'c 'math-oper-table
85702
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
101 '( ( "u!" calcFunc-lnot -1 1000 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102 ( "~" calcFunc-not -1 1000 )
85702
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
103 ( "u+" ident -1 197 )
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
104 ( "u-" neg -1 197 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106 ( "/" / 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 ( "%" % 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
109 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110 ( "<<" calcFunc-lsh 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 ( ">>" calcFunc-rsh 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
113 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
116 ( "==" calcFunc-eq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
117 ( "!=" calcFunc-neq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
118 ( "&" calcFunc-and 140 141 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
119 ( "^" calcFunc-xor 131 130 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
120 ( "|" calcFunc-or 120 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
121 ( "&&" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
122 ( "||" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
123 ( "?" (math-read-if) 91 90 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
124 ( "!!!" calcFunc-pnot -1 88 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
125 ( "&&&" calcFunc-pand 85 86 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
126 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
127 ( "=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
128 ( ":=" calcFunc-assign 51 50 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
129 ( "::" calcFunc-condition 45 46 ))) ; should support full assignments
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
130
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
131 (put 'c 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
132 '( ( acos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
133 ( acosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
134 ( asin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
135 ( asinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
136 ( atan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
137 ( atan2 . calcFunc-arctan2 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
138 ( atanh . calcFunc-arctanh )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
139
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
140 (put 'c 'math-variable-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
141 '( ( M_PI . var-pi )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
142 ( M_E . var-e )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
143
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
144 (put 'c 'math-vector-brackets "{}")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
145
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
146 (put 'c 'math-radix-formatter
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
147 (function (lambda (r s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
148 (if (= r 16) (format "0x%s" s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
149 (if (= r 8) (format "0%s" s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
150 (format "%d#%s" r s))))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
151
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
152 (put 'c 'math-compose-subscr
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
153 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
154 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
155 (let ((args (cdr (cdr a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
156 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
157 (math-compose-expr (nth 1 a) 1000)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
158 "["
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
159 (math-compose-vector args ", " 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
160 "]")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
161
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
162 (add-to-list 'calc-lang-slash-idiv 'c)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
163 (add-to-list 'calc-lang-allow-underscores 'c)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
164 (add-to-list 'calc-lang-c-type-hex 'c)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
165 (add-to-list 'calc-lang-brackets-are-subscripts 'c)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
166
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
167 (defun calc-pascal-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
168 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
169 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
170 (and n (setq n (prefix-numeric-value n)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
171 (calc-set-language 'pascal n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
172 (message (if (and n (/= n 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
173 (if (> n 0)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
174 "Pascal language mode (all uppercase)"
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
175 "Pascal language mode (all lowercase)")
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
176 "Pascal language mode"))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
177
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
178 (put 'pascal 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
179 '( ( "not" calcFunc-lnot -1 1000 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
180 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
181 ( "/" / 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
182 ( "and" calcFunc-and 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
183 ( "div" calcFunc-idiv 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
184 ( "mod" % 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
185 ( "u+" ident -1 185 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
186 ( "u-" neg -1 185 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
187 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
188 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
189 ( "or" calcFunc-or 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
190 ( "xor" calcFunc-xor 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
191 ( "shl" calcFunc-lsh 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
192 ( "shr" calcFunc-rsh 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
193 ( "in" calcFunc-in 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
194 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
195 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
196 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
197 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
198 ( "=" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
199 ( "<>" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
200 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
201 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
202 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
203 ( ":=" calcFunc-assign 51 50 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
204 ( "::" calcFunc-condition 45 46 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
205
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
206 (put 'pascal 'math-input-filter 'calc-input-case-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
207 (put 'pascal 'math-output-filter 'calc-output-case-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
208
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
209 (put 'pascal 'math-radix-formatter
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
210 (function (lambda (r s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
211 (if (= r 16) (format "$%s" s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
212 (format "%d#%s" r s)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
213
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
214 (put 'pascal 'math-lang-read-symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
215 '((?\$
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
216 (eq (string-match
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
217 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Zα-ωΑ-Ω]\\)"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
218 math-exp-str math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
219 math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
220 (setq math-exp-token 'number
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
221 math-expr-data (math-match-substring math-exp-str 1)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
222 math-exp-pos (match-end 1)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
223
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
224 (put 'pascal 'math-compose-subscr
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
225 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
226 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
227 (let ((args (cdr (cdr a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
228 (while (eq (car-safe (nth 1 a)) 'calcFunc-subscr)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
229 (setq args (append (cdr (cdr (nth 1 a))) args)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
230 a (nth 1 a)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
231 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
232 (math-compose-expr (nth 1 a) 1000)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
233 "["
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
234 (math-compose-vector args ", " 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
235 "]")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
236
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
237 (add-to-list 'calc-lang-allow-underscores 'pascal)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
238 (add-to-list 'calc-lang-brackets-are-subscripts 'pascal)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
239
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
240 (defun calc-input-case-filter (str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
241 (cond ((or (null calc-language-option) (= calc-language-option 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
242 str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
243 (t
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
244 (downcase str))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
245
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
246 (defun calc-output-case-filter (str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
247 (cond ((or (null calc-language-option) (= calc-language-option 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
248 str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
249 ((> calc-language-option 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
250 (upcase str))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
251 (t
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
252 (downcase str))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
253
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
254
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
255 (defun calc-fortran-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
256 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
257 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
258 (and n (setq n (prefix-numeric-value n)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
259 (calc-set-language 'fortran n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
260 (message (if (and n (/= n 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
261 (if (> n 0)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
262 "FORTRAN language mode (all uppercase)"
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
263 "FORTRAN language mode (all lowercase)")
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
264 "FORTRAN language mode"))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
265
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
266 (put 'fortran 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
267 '( ( "u/" (math-parse-fortran-vector) -1 1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
268 ( "/" (math-parse-fortran-vector-end) 1 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
269 ( "**" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
270 ( "u+" ident -1 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
271 ( "u-" neg -1 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
272 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
273 ( "/" / 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
274 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
275 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
276 ( ".LT." calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
277 ( ".GT." calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
278 ( ".LE." calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
279 ( ".GE." calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
280 ( ".EQ." calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
281 ( ".NE." calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
282 ( ".NOT." calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
283 ( ".AND." calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
284 ( ".OR." calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
285 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
286 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
287 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
288 ( "=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
289 ( ":=" calcFunc-assign 51 50 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
290 ( "::" calcFunc-condition 45 46 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
291
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
292 (put 'fortran 'math-vector-brackets "//")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
293
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
294 (put 'fortran 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
295 '( ( acos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
296 ( acosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
297 ( aimag . calcFunc-im )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
298 ( aint . calcFunc-ftrunc )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
299 ( asin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
300 ( asinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
301 ( atan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
302 ( atan2 . calcFunc-arctan2 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
303 ( atanh . calcFunc-arctanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
304 ( conjg . calcFunc-conj )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
305 ( log . calcFunc-ln )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
306 ( nint . calcFunc-round )
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49263
diff changeset
307 ( real . calcFunc-re )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
308
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
309 (put 'fortran 'math-input-filter 'calc-input-case-filter)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
310
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
311 (put 'fortran 'math-output-filter 'calc-output-case-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
312
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
313 (put 'fortran 'math-lang-read-symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
314 '((?\.
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
315 (eq (string-match "\\.[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω]?\\."
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
316 math-exp-str math-exp-pos) math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
317 (setq math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
318 math-expr-data (upcase (math-match-substring math-exp-str 0))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
319 math-exp-pos (match-end 0)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
320
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
321 (put 'fortran 'math-compose-subscr
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
322 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
323 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
324 (let ((args (cdr (cdr a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
325 (while (eq (car-safe (nth 1 a)) 'calcFunc-subscr)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
326 (setq args (append (cdr (cdr (nth 1 a))) args)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
327 a (nth 1 a)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
328 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
329 (math-compose-expr (nth 1 a) 1000)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
330 "("
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
331 (math-compose-vector args ", " 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
332 ")")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
333
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
334 (add-to-list 'calc-lang-slash-idiv 'fortran)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
335 (add-to-list 'calc-lang-allow-underscores 'fortran)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
336 (add-to-list 'calc-lang-parens-are-subscripts 'fortran)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
337
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
338 ;; The next few variables are local to math-read-exprs in calc-aent.el
58571
4ca47d70b075 (math-expr-data, math-expr-token, math-exp-old-pos): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58411
diff changeset
339 ;; and math-read-expr in calc-ext.el, but are set in functions they call.
4ca47d70b075 (math-expr-data, math-expr-token, math-exp-old-pos): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58411
diff changeset
340
4ca47d70b075 (math-expr-data, math-expr-token, math-exp-old-pos): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58411
diff changeset
341 (defvar math-exp-token)
4ca47d70b075 (math-expr-data, math-expr-token, math-exp-old-pos): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58411
diff changeset
342 (defvar math-expr-data)
4ca47d70b075 (math-expr-data, math-expr-token, math-exp-old-pos): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58411
diff changeset
343 (defvar math-exp-old-pos)
4ca47d70b075 (math-expr-data, math-expr-token, math-exp-old-pos): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58411
diff changeset
344
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
345 (defvar math-parsing-fortran-vector nil)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
346 (defun math-parse-fortran-vector (op)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
347 (let ((math-parsing-fortran-vector '(end . "\000")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
348 (prog1
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
349 (math-read-brackets t "]")
58134
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
350 (setq math-exp-token (car math-parsing-fortran-vector)
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
351 math-expr-data (cdr math-parsing-fortran-vector)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
352
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
353 (defun math-parse-fortran-vector-end (x op)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
354 (if math-parsing-fortran-vector
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
355 (progn
58134
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
356 (setq math-parsing-fortran-vector (cons math-exp-token math-expr-data)
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
357 math-exp-token 'end
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
358 math-expr-data "\000")
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
359 x)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
360 (throw 'syntax "Unmatched closing `/'")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
361
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
362 (defun math-parse-fortran-subscr (sym args)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
363 (setq sym (math-build-var-name sym))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
364 (while args
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
365 (setq sym (list 'calcFunc-subscr sym (car args))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
366 args (cdr args)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
367 sym)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
368
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
369
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
370 (defun calc-tex-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
371 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
372 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
373 (and n (setq n (prefix-numeric-value n)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
374 (calc-set-language 'tex n)
59966
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
375 (cond ((not n)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
376 (message "TeX language mode"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
377 ((= n 0)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
378 (message "TeX language mode with multiline matrices"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
379 ((= n 1)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
380 (message "TeX language mode with \\hbox{func}(\\hbox{var})"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
381 ((> n 1)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
382 (message
59966
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
383 "TeX language mode with \\hbox{func}(\\hbox{var}) and multiline matrices"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
384 ((= n -1)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
385 (message "TeX language mode with \\func(\\hbox{var})"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
386 ((< n -1)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
387 (message
59966
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
388 "TeX language mode with \\func(\\hbox{var}) and multiline matrices")))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
389
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
390 (defun calc-latex-language (n)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
391 (interactive "P")
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
392 (calc-wrapper
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
393 (and n (setq n (prefix-numeric-value n)))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
394 (calc-set-language 'latex n)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
395 (cond ((not n)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
396 (message "LaTeX language mode"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
397 ((= n 0)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
398 (message "LaTeX language mode with multiline matrices"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
399 ((= n 1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
400 (message "LaTeX language mode with \\text{func}(\\text{var})"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
401 ((> n 1)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
402 (message
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
403 "LaTeX language mode with \\text{func}(\\text{var}) and multiline matrices"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
404 ((= n -1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
405 (message "LaTeX language mode with \\func(\\text{var})"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
406 ((< n -1)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
407 (message
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
408 "LaTeX language mode with \\func(\\text{var}) and multiline matrices")))))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
409
87223
e9cba8ba37e1 (calc-lang-name): New property name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86969
diff changeset
410 (put 'tex 'math-lang-name "TeX")
e9cba8ba37e1 (calc-lang-name): New property name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86969
diff changeset
411 (put 'latex 'math-lang-name "LaTeX")
e9cba8ba37e1 (calc-lang-name): New property name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86969
diff changeset
412
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
413 (put 'tex 'math-oper-table
85702
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
414 '( ( "\\hat" calcFunc-hat -1 950 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
415 ( "\\check" calcFunc-check -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
416 ( "\\tilde" calcFunc-tilde -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
417 ( "\\acute" calcFunc-acute -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
418 ( "\\grave" calcFunc-grave -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
419 ( "\\dot" calcFunc-dot -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
420 ( "\\ddot" calcFunc-dotdot -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
421 ( "\\breve" calcFunc-breve -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
422 ( "\\bar" calcFunc-bar -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
423 ( "\\vec" calcFunc-Vec -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
424 ( "\\underline" calcFunc-under -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
425 ( "u|" calcFunc-abs -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
426 ( "|" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
427 ( "\\lfloor" calcFunc-floor -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
428 ( "\\rfloor" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
429 ( "\\lceil" calcFunc-ceil -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
430 ( "\\rceil" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
431 ( "\\pm" sdev 300 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
432 ( "!" calcFunc-fact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
433 ( "^" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
434 ( "_" calcFunc-subscr 201 200 )
85702
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
435 ( "u+" ident -1 197 )
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
436 ( "u-" neg -1 197 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
437 ( "\\times" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
438 ( "*" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
439 ( "2x" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
440 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
441 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
442 ( "\\over" / 170 171 )
86135
524fd9b36076 (math-oper-table): Fix typo. Reduce precedence of "/" for TeX.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 85702
diff changeset
443 ( "/" / 170 171 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
444 ( "\\choose" calcFunc-choose 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
445 ( "\\mod" % 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
446 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
447 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
448 ( "\\leq" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
449 ( "\\geq" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
450 ( "=" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
451 ( "\\neq" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
452 ( "\\ne" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
453 ( "\\lnot" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
454 ( "\\land" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
455 ( "\\lor" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
456 ( "?" (math-read-if) 91 90 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
457 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
458 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
459 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
460 ( "\\gets" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
461 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
462 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
463 ( "\\to" calcFunc-evalto 40 41 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
464 ( "\\to" calcFunc-evalto 40 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
465 ( "=>" calcFunc-evalto 40 41 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
466 ( "=>" calcFunc-evalto 40 -1 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
467
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
468 (put 'tex 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
469 '( ( \\arccos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
470 ( \\arcsin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
471 ( \\arctan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
472 ( \\arg . calcFunc-arg )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
473 ( \\cos . calcFunc-cos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
474 ( \\cosh . calcFunc-cosh )
61069
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
475 ( \\cot . calcFunc-cot )
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
476 ( \\coth . calcFunc-coth )
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
477 ( \\csc . calcFunc-csc )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
478 ( \\det . calcFunc-det )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
479 ( \\exp . calcFunc-exp )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
480 ( \\gcd . calcFunc-gcd )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
481 ( \\ln . calcFunc-ln )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
482 ( \\log . calcFunc-log10 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
483 ( \\max . calcFunc-max )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
484 ( \\min . calcFunc-min )
61069
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
485 ( \\sec . calcFunc-sec )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
486 ( \\sin . calcFunc-sin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
487 ( \\sinh . calcFunc-sinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
488 ( \\sqrt . calcFunc-sqrt )
61069
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
489 ( \\tan . calcFunc-tan )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
490 ( \\tanh . calcFunc-tanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
491 ( \\phi . calcFunc-totient )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
492 ( \\mu . calcFunc-moebius )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
493
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
494 (put 'tex 'math-special-function-table
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
495 '((calcFunc-sum . (math-compose-tex-sum "\\sum"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
496 (calcFunc-prod . (math-compose-tex-sum "\\prod"))
101129
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
497 (calcFunc-sqrt . math-compose-tex-sqrt)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
498 (intv . math-compose-tex-intv)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
499
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
500 (put 'tex 'math-variable-table
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
501 '(
73057
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
502 ;; The Greek letters
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
503 ( \\alpha . var-alpha )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
504 ( \\beta . var-beta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
505 ( \\gamma . var-gamma )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
506 ( \\Gamma . var-Gamma )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
507 ( \\delta . var-delta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
508 ( \\Delta . var-Delta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
509 ( \\epsilon . var-epsilon )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
510 ( \\varepsilon . var-varepsilon)
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
511 ( \\zeta . var-zeta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
512 ( \\eta . var-eta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
513 ( \\theta . var-theta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
514 ( \\vartheta . var-vartheta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
515 ( \\Theta . var-Theta )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
516 ( \\iota . var-iota )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
517 ( \\kappa . var-kappa )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
518 ( \\lambda . var-lambda )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
519 ( \\Lambda . var-Lambda )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
520 ( \\mu . var-mu )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
521 ( \\nu . var-nu )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
522 ( \\xi . var-xi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
523 ( \\Xi . var-Xi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
524 ( \\pi . var-pi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
525 ( \\varpi . var-varpi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
526 ( \\Pi . var-Pi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
527 ( \\rho . var-rho )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
528 ( \\varrho . var-varrho )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
529 ( \\sigma . var-sigma )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
530 ( \\sigma . var-varsigma )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
531 ( \\Sigma . var-Sigma )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
532 ( \\tau . var-tau )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
533 ( \\upsilon . var-upsilon )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
534 ( \\Upsilon . var-Upsilon )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
535 ( \\phi . var-phi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
536 ( \\varphi . var-varphi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
537 ( \\Phi . var-Phi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
538 ( \\chi . var-chi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
539 ( \\psi . var-psi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
540 ( \\Psi . var-Psi )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
541 ( \\omega . var-omega )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
542 ( \\Omega . var-Omega )
111633
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
543 ;; Units
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
544 ( pt . var-texpt )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
545 ( pc . var-texpc )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
546 ( bp . var-texbp )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
547 ( dd . var-texdd )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
548 ( cc . var-texcc )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
549 ( sp . var-texsp )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
550 ( pint . var-pt )
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
551 ( parsec . var-pc)
4e76c4e4f20f calc.texi (TeX and LaTeX Language Modes, Predefined Units):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 109033
diff changeset
552
73057
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
553 ;; Others
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
554 ( \\ell . var-ell )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
555 ( \\infty . var-inf )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
556 ( \\infty . var-uinf )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
557 ( \\sum . (math-parse-tex-sum calcFunc-sum) )
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
558 ( \\prod . (math-parse-tex-sum calcFunc-prod) )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
559
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
560 (put 'tex 'math-punc-table
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
561 '((?\{ . ?\()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
562 (?\} . ?\))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
563 (?\& . ?\,)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
564
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
565 (put 'tex 'math-complex-format 'i)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
566
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
567 (put 'tex 'math-input-filter 'math-tex-input-filter)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
568
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
569 (put 'tex 'math-matrix-formatter
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
570 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
571 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
572 (if (and (integerp calc-language-option)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
573 (or (= calc-language-option 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
574 (> calc-language-option 1)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
575 (< calc-language-option -1)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
576 (append '(vleft 0 "\\matrix{")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
577 (math-compose-tex-matrix (cdr a))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
578 '("}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
579 (append '(horiz "\\matrix{ ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
580 (math-compose-tex-matrix (cdr a))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
581 '(" }"))))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
582
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
583 (put 'tex 'math-var-formatter 'math-compose-tex-var)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
584
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
585 (put 'tex 'math-func-formatter 'math-compose-tex-func)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
586
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
587 (put 'tex 'math-dots "\\ldots")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
588
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
589 (put 'tex 'math-big-parens '("\\left( " . " \\right)"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
590
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
591 (put 'tex 'math-evalto '("\\evalto " . " \\to "))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
592
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
593 (defconst math-tex-ignore-words
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
594 '( ("\\hbox") ("\\mbox") ("\\text") ("\\left") ("\\right")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
595 ("\\,") ("\\>") ("\\:") ("\\;") ("\\!") ("\\ ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
596 ("\\quad") ("\\qquad") ("\\hfil") ("\\hfill")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
597 ("\\displaystyle") ("\\textstyle") ("\\dsize") ("\\tsize")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
598 ("\\scriptstyle") ("\\scriptscriptstyle") ("\\ssize") ("\\sssize")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
599 ("\\rm") ("\\bf") ("\\it") ("\\sl")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
600 ("\\roman") ("\\bold") ("\\italic") ("\\slanted")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
601 ("\\cal") ("\\mit") ("\\Cal") ("\\Bbb") ("\\frak") ("\\goth")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
602 ("\\evalto")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
603 ("\\matrix" mat) ("\\bmatrix" mat) ("\\pmatrix" mat)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
604 ("\\begin" begenv)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
605 ("\\cr" punc ";") ("\\\\" punc ";") ("\\*" punc "*")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
606 ("\\{" punc "[") ("\\}" punc "]")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
607
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
608 (defconst math-latex-ignore-words
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
609 (append math-tex-ignore-words
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
610 '(("\\begin" begenv))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
611
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
612 (put 'tex 'math-lang-read-symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
613 '((?\\
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
614 (< math-exp-pos (1- (length math-exp-str)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
615 (progn
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
616 (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
617 math-exp-str math-exp-pos)
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
618 (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
619 math-exp-str math-exp-pos))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
620 (setq math-exp-token 'symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
621 math-exp-pos (match-end 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
622 math-expr-data (math-restore-dashes
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
623 (math-match-substring math-exp-str 1)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
624 (let ((code (assoc math-expr-data math-latex-ignore-words)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
625 (cond ((null code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
626 ((null (cdr code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
627 (math-read-token))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
628 ((eq (nth 1 code) 'punc)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
629 (setq math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
630 math-expr-data (nth 2 code)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
631 ((and (eq (nth 1 code) 'mat)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
632 (string-match " *{" math-exp-str math-exp-pos))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
633 (setq math-exp-pos (match-end 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
634 math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
635 math-expr-data "[")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
636 (let ((right (string-match "}" math-exp-str math-exp-pos)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
637 (and right
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
638 (setq math-exp-str (copy-sequence math-exp-str))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
639 (aset math-exp-str right ?\]))))))))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
640
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
641 (defun math-compose-tex-matrix (a &optional ltx)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
642 (if (cdr a)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
643 (cons (append (math-compose-vector (cdr (car a)) " & " 0)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
644 (if ltx '(" \\\\ ") '(" \\cr ")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
645 (math-compose-tex-matrix (cdr a) ltx))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
646 (list (math-compose-vector (cdr (car a)) " & " 0))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
647
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
648 (defun math-compose-tex-sum (a fn)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
649 (cond
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
650 ((nth 4 a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
651 (list 'horiz (nth 1 fn)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
652 "_{" (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
653 "=" (math-compose-expr (nth 3 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
654 "}^{" (math-compose-expr (nth 4 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
655 "}{" (math-compose-expr (nth 1 a) 0) "}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
656 ((nth 3 a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
657 (list 'horiz (nth 1 fn)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
658 "_{" (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
659 "=" (math-compose-expr (nth 3 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
660 "}{" (math-compose-expr (nth 1 a) 0) "}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
661 (t
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
662 (list 'horiz (nth 1 fn)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
663 "_{" (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
664 "}{" (math-compose-expr (nth 1 a) 0) "}"))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
665
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
666 (defun math-parse-tex-sum (f val)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
667 (let (low high save)
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
668 (or (equal math-expr-data "_") (throw 'syntax "Expected `_'"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
669 (math-read-token)
58134
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
670 (setq save math-exp-old-pos)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
671 (setq low (math-read-factor))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
672 (or (eq (car-safe low) 'calcFunc-eq)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
673 (progn
58134
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
674 (setq math-exp-old-pos (1+ save))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
675 (throw 'syntax "Expected equation")))
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
676 (or (equal math-expr-data "^") (throw 'syntax "Expected `^'"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
677 (math-read-token)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
678 (setq high (math-read-factor))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
679 (list (nth 2 f) (math-read-factor) (nth 1 low) (nth 2 low) high)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
680
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
681 (defun math-tex-input-filter (str) ; allow parsing of 123\,456\,789.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
682 (while (string-match "[0-9]\\\\,[0-9]" str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
683 (setq str (concat (substring str 0 (1+ (match-beginning 0)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
684 (substring str (1- (match-end 0))))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
685 str)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
686
101129
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
687 (defun math-compose-tex-sqrt (a)
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
688 (list 'horiz
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
689 "\\sqrt{"
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
690 (math-compose-expr (nth 1 a) 0)
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
691 "}"))
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
692
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
693 (defun math-compose-tex-intv (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
694 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
695 (if (memq (nth 1 a) '(0 1)) "(" "[")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
696 (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
697 " \\ldots "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
698 (math-compose-expr (nth 3 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
699 (if (memq (nth 1 a) '(0 2)) ")" "]")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
700
86969
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
701 (defun math-compose-tex-var (a prec)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
702 (if (and calc-language-option
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
703 (not (= calc-language-option 0))
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
704 (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
705 (symbol-name (nth 1 a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
706 (if (eq calc-language 'latex)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
707 (format "\\text{%s}" (symbol-name (nth 1 a)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
708 (format "\\hbox{%s}" (symbol-name (nth 1 a))))
86969
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
709 (math-compose-var a)))
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
710
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
711 (defun math-compose-tex-func (func a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
712 (let (left right)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
713 (if (and calc-language-option
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
714 (not (= calc-language-option 0))
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
715 (string-match "\\`[a-zA-Zα-ωΑ-Ω][a-zA-Zα-ωΑ-Ω0-9]+\\'" func))
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
716 (if (< (prefix-numeric-value calc-language-option) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
717 (setq func (format "\\%s" func))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
718 (setq func (if (eq calc-language 'latex)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
719 (format "\\text{%s}" func)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
720 (format "\\hbox{%s}" func)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
721 (cond ((or (> (length a) 2)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
722 (not (math-tex-expr-is-flat (nth 1 a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
723 (setq left "\\left( "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
724 right " \\right)"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
725 ((and (eq (aref func 0) ?\\)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
726 (not (or
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
727 (string-match "\\hbox{" func)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
728 (string-match "\\text{" func)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
729 (= (length a) 2)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
730 (or (Math-realp (nth 1 a))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
731 (memq (car (nth 1 a)) '(var *))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
732 (setq left "{" right "}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
733 (t (setq left calc-function-open
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
734 right calc-function-close)))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
735 (list 'horiz func
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
736 left
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
737 (math-compose-vector (cdr a) ", " 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
738 right)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
739
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
740 (put 'latex 'math-oper-table
59829
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
741 (append (get 'tex 'math-oper-table)
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
742 '(( "\\Hat" calcFunc-Hat -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
743 ( "\\Check" calcFunc-Check -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
744 ( "\\Tilde" calcFunc-Tilde -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
745 ( "\\Acute" calcFunc-Acute -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
746 ( "\\Grave" calcFunc-Grave -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
747 ( "\\Dot" calcFunc-Dot -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
748 ( "\\Ddot" calcFunc-Dotdot -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
749 ( "\\Breve" calcFunc-Breve -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
750 ( "\\Bar" calcFunc-Bar -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
751 ( "\\Vec" calcFunc-VEC -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
752 ( "\\dddot" calcFunc-dddot -1 950 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
753 ( "\\ddddot" calcFunc-ddddot -1 950 )
86135
524fd9b36076 (math-oper-table): Fix typo. Reduce precedence of "/" for TeX.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 85702
diff changeset
754 ( "\\div" / 170 171 )
59829
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
755 ( "\\le" calcFunc-leq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
756 ( "\\leqq" calcFunc-leq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
757 ( "\\leqsland" calcFunc-leq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
758 ( "\\ge" calcFunc-geq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
759 ( "\\geqq" calcFunc-geq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
760 ( "\\geqslant" calcFunc-geq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
761 ( "=" calcFunc-eq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
762 ( "\\neq" calcFunc-neq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
763 ( "\\ne" calcFunc-neq 160 161 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
764 ( "\\lnot" calcFunc-lnot -1 121 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
765 ( "\\land" calcFunc-land 110 111 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
766 ( "\\lor" calcFunc-lor 100 101 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
767 ( "?" (math-read-if) 91 90 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
768 ( "!!!" calcFunc-pnot -1 85 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
769 ( "&&&" calcFunc-pand 80 81 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
770 ( "|||" calcFunc-por 75 76 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
771 ( "\\gets" calcFunc-assign 51 50 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
772 ( ":=" calcFunc-assign 51 50 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
773 ( "::" calcFunc-condition 45 46 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
774 ( "\\to" calcFunc-evalto 40 41 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
775 ( "\\to" calcFunc-evalto 40 -1 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
776 ( "=>" calcFunc-evalto 40 41 )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
777 ( "=>" calcFunc-evalto 40 -1 ))))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
778
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
779 (put 'latex 'math-function-table
59829
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
780 (append
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
781 (get 'tex 'math-function-table)
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
782 '(( \\frac . (math-latex-parse-frac))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
783 ( \\tfrac . (math-latex-parse-frac))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
784 ( \\dfrac . (math-latex-parse-frac))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
785 ( \\binom . (math-latex-parse-two-args calcFunc-choose))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
786 ( \\tbinom . (math-latex-parse-two-args calcFunc-choose))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
787 ( \\dbinom . (math-latex-parse-two-args calcFunc-choose))
59829
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
788 ( \\phi . calcFunc-totient )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
789 ( \\mu . calcFunc-moebius ))))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
790
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
791 (put 'latex 'math-special-function-table
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
792 '((/ . (math-compose-latex-frac "\\frac"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
793 (calcFunc-choose . (math-compose-latex-frac "\\binom"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
794 (calcFunc-sum . (math-compose-tex-sum "\\sum"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
795 (calcFunc-prod . (math-compose-tex-sum "\\prod"))
101129
25d50d869d34 (math-compose-tex-sqrt): New function (previously commented out).
Jay Belanger <jay.p.belanger@gmail.com>
parents: 100908
diff changeset
796 (calcFunc-sqrt . math-compose-tex-sqrt)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
797 (intv . math-compose-tex-intv)))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
798
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
799 (put 'latex 'math-variable-table
59829
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
800 (get 'tex 'math-variable-table))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
801
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
802 (put 'latex 'math-punc-table
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
803 '((?\{ . ?\()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
804 (?\} . ?\))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
805 (?\& . ?\,)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
806
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
807 (put 'latex 'math-complex-format 'i)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
808
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
809 (put 'latex 'math-matrix-formatter
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
810 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
811 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
812 (if (and (integerp calc-language-option)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
813 (or (= calc-language-option 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
814 (> calc-language-option 1)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
815 (< calc-language-option -1)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
816 (append '(vleft 0 "\\begin{pmatrix}")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
817 (math-compose-tex-matrix (cdr a) t)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
818 '("\\end{pmatrix}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
819 (append '(horiz "\\begin{pmatrix} ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
820 (math-compose-tex-matrix (cdr a) t)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
821 '(" \\end{pmatrix}"))))))
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
822
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
823 (put 'latex 'math-var-formatter 'math-compose-tex-var)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
824
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
825 (put 'latex 'math-func-formatter 'math-compose-tex-func)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
826
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
827 (put 'latex 'math-dots "\\ldots")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
828
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
829 (put 'latex 'math-big-parens '("\\left( " . " \\right)"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
830
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
831 (put 'latex 'math-evalto '("\\evalto " . " \\to "))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
832
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
833 (put 'latex 'math-lang-read-symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
834 '((?\\
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
835 (< math-exp-pos (1- (length math-exp-str)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
836 (progn
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
837 (or (string-match "\\\\hbox *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
838 math-exp-str math-exp-pos)
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
839 (string-match "\\\\text *{\\([a-zA-Zα-ωΑ-Ω0-9]+\\)}"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
840 math-exp-str math-exp-pos)
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
841 (string-match "\\(\\\\\\([a-zA-Zα-ωΑ-Ω]+\\|[^a-zA-Zα-ωΑ-Ω]\\)\\)"
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
842 math-exp-str math-exp-pos))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
843 (setq math-exp-token 'symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
844 math-exp-pos (match-end 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
845 math-expr-data (math-restore-dashes
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
846 (math-match-substring math-exp-str 1)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
847 (let ((code (assoc math-expr-data math-tex-ignore-words))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
848 envname)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
849 (cond ((null code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
850 ((null (cdr code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
851 (math-read-token))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
852 ((eq (nth 1 code) 'punc)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
853 (setq math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
854 math-expr-data (nth 2 code)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
855 ((and (eq (nth 1 code) 'begenv)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
856 (string-match " *{\\([^}]*\\)}" math-exp-str math-exp-pos))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
857 (setq math-exp-pos (match-end 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
858 envname (match-string 1 math-exp-str)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
859 math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
860 math-expr-data "[")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
861 (cond ((or (string= envname "matrix")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
862 (string= envname "bmatrix")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
863 (string= envname "smallmatrix")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
864 (string= envname "pmatrix"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
865 (if (string-match (concat "\\\\end{" envname "}")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
866 math-exp-str math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
867 (setq math-exp-str
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
868 (replace-match "]" t t math-exp-str))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
869 (error "%s" (concat "No closing \\end{" envname "}"))))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
870 ((and (eq (nth 1 code) 'mat)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
871 (string-match " *{" math-exp-str math-exp-pos))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
872 (setq math-exp-pos (match-end 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
873 math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
874 math-expr-data "[")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
875 (let ((right (string-match "}" math-exp-str math-exp-pos)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
876 (and right
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
877 (setq math-exp-str (copy-sequence math-exp-str))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
878 (aset math-exp-str right ?\]))))))))))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
879
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
880 (defun math-latex-parse-frac (f val)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
881 (let (numer denom)
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
882 (setq numer (car (math-read-expr-list)))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
883 (math-read-token)
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
884 (setq denom (math-read-factor))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
885 (if (and (Math-num-integerp numer)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
886 (Math-num-integerp denom))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
887 (list 'frac numer denom)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
888 (list '/ numer denom))))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
889
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
890 (defun math-latex-parse-two-args (f val)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
891 (let (first second)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
892 (setq first (car (math-read-expr-list)))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
893 (math-read-token)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
894 (setq second (math-read-factor))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
895 (list (nth 2 f) first second)))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
896
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
897 (defun math-compose-latex-frac (a fn)
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
898 (list 'horiz (nth 1 fn) "{" (math-compose-expr (nth 1 a) -1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
899 "}{"
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
900 (math-compose-expr (nth 2 a) -1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
901 "}"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
902
59819
dea78c6f5e48 (math-latex-input-filter): Remove function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59811
diff changeset
903 (put 'latex 'math-input-filter 'math-tex-input-filter)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
904
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
905 (defun calc-eqn-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
906 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
907 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
908 (calc-set-language 'eqn)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
909 (message "Eqn language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
910
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
911 (put 'eqn 'math-oper-table
85702
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
912 '( ( "prime" (math-parse-eqn-prime) 950 -1 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
913 ( "prime" calcFunc-Prime 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
914 ( "dot" calcFunc-dot 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
915 ( "dotdot" calcFunc-dotdot 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
916 ( "hat" calcFunc-hat 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
917 ( "tilde" calcFunc-tilde 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
918 ( "vec" calcFunc-Vec 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
919 ( "dyad" calcFunc-dyad 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
920 ( "bar" calcFunc-bar 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
921 ( "under" calcFunc-under 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
922 ( "sub" calcFunc-subscr 931 930 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
923 ( "sup" ^ 921 920 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
924 ( "sqrt" calcFunc-sqrt -1 910 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
925 ( "over" / 900 901 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
926 ( "u|" calcFunc-abs -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
927 ( "|" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
928 ( "left floor" calcFunc-floor -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
929 ( "right floor" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
930 ( "left ceil" calcFunc-ceil -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
931 ( "right ceil" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
932 ( "+-" sdev 300 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
933 ( "!" calcFunc-fact 210 -1 )
85702
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
934 ( "u+" ident -1 197 )
8d96a389d68d (math-oper-table): Lower precedence of negation for C, TeX, and eqn.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 82140
diff changeset
935 ( "u-" neg -1 197 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
936 ( "times" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
937 ( "*" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
938 ( "2x" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
939 ( "/" / 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
940 ( "%" % 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
941 ( "+" + 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
942 ( "-" - 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
943 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
944 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
945 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
946 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
947 ( "=" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
948 ( "==" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
949 ( "!=" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
950 ( "u!" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
951 ( "&&" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
952 ( "||" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
953 ( "?" (math-read-if) 91 90 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
954 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
955 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
956 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
957 ( "<-" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
958 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
959 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
960 ( "->" calcFunc-evalto 40 41 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
961 ( "->" calcFunc-evalto 40 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
962 ( "=>" calcFunc-evalto 40 41 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
963 ( "=>" calcFunc-evalto 40 -1 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
964
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
965 (put 'eqn 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
966 '( ( arc\ cos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
967 ( arc\ cosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
968 ( arc\ sin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
969 ( arc\ sinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
970 ( arc\ tan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
971 ( arc\ tanh . calcFunc-arctanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
972 ( GAMMA . calcFunc-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
973 ( phi . calcFunc-totient )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
974 ( mu . calcFunc-moebius )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
975 ( matrix . (math-parse-eqn-matrix) )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
976
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
977 (put 'eqn 'math-special-function-table
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
978 '((intv . math-compose-eqn-intv)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
979
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
980 (put 'eqn 'math-punc-table
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
981 '((?\{ . ?\()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
982 (?\} . ?\))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
983
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
984 (put 'eqn 'math-variable-table
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
985 '( ( inf . var-uinf )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
986
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
987 (put 'eqn 'math-complex-format 'i)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
988
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
989 (put 'eqn 'math-big-parens '("{left ( " . " right )}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
990
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
991 (put 'eqn 'math-evalto '("evalto " . " -> "))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
992
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
993 (put 'eqn 'math-matrix-formatter
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
994 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
995 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
996 (append '(horiz "matrix { ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
997 (math-compose-eqn-matrix
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
998 (cdr (math-transpose a)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
999 '("}")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1000
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1001 (put 'eqn 'math-var-formatter
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1002 (function
86969
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1003 (lambda (a prec)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1004 (let (v)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1005 (if (and math-compose-hash-args
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1006 (let ((p calc-arg-values))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1007 (setq v 1)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1008 (while (and p (not (equal (car p) a)))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1009 (setq p (and (eq math-compose-hash-args t) (cdr p))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1010 v (1+ v)))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1011 p))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1012 (if (eq math-compose-hash-args 1)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1013 "#"
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1014 (format "#%d" v))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1015 (if (string-match ".'\\'" (symbol-name (nth 2 a)))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1016 (math-compose-expr
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1017 (list 'calcFunc-Prime
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1018 (list
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1019 'var
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1020 (intern (substring (symbol-name (nth 1 a)) 0 -1))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1021 (intern (substring (symbol-name (nth 2 a)) 0 -1))))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1022 prec)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1023 (symbol-name (nth 1 a))))))))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1024
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1025 (defconst math-eqn-special-funcs
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1026 '( calcFunc-log
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1027 calcFunc-ln calcFunc-exp
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1028 calcFunc-sin calcFunc-cos calcFunc-tan
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1029 calcFunc-sec calcFunc-csc calcFunc-cot
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1030 calcFunc-sinh calcFunc-cosh calcFunc-tanh
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1031 calcFunc-sech calcFunc-csch calcFunc-coth
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1032 calcFunc-arcsin calcFunc-arccos calcFunc-arctan
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1033 calcFunc-arcsinh calcFunc-arccosh calcFunc-arctanh))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1034
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1035 (put 'eqn 'math-func-formatter
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1036 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1037 (lambda (func a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1038 (let (left right)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1039 (if (string-match "[^']'+\\'" func)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1040 (let ((n (- (length func) (match-beginning 0) 1)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1041 (setq func (substring func 0 (- n)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1042 (while (>= (setq n (1- n)) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1043 (setq func (concat func " prime")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1044 (cond ((or (> (length a) 2)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1045 (not (math-tex-expr-is-flat (nth 1 a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1046 (setq left "{left ( "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1047 right " right )}"))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1048
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1049 ((and
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1050 (memq (car a) math-eqn-special-funcs)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1051 (= (length a) 2)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1052 (or (Math-realp (nth 1 a))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1053 (memq (car (nth 1 a)) '(var *))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1054 (setq left "~{" right "}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1055 (t
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1056 (setq left " ( "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1057 right " )")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1058 (list 'horiz func left
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1059 (math-compose-vector (cdr a) " , " 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1060 right)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1061
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1062 (put 'eqn 'math-lang-read-symbol
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1063 '((?\"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1064 (string-match "\\(\"\\([^\"\\]\\|\\\\.\\)*\\)\\(\"\\|\\'\\)"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1065 math-exp-str math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1066 (progn
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1067 (setq math-exp-str (copy-sequence math-exp-str))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1068 (aset math-exp-str (match-beginning 1) ?\{)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1069 (if (< (match-end 1) (length math-exp-str))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1070 (aset math-exp-str (match-end 1) ?\}))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1071 (math-read-token)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1072
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1073 (defconst math-eqn-ignore-words
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1074 '( ("roman") ("bold") ("italic") ("mark") ("lineup") ("evalto")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1075 ("left" ("floor") ("ceil"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1076 ("right" ("floor") ("ceil"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1077 ("arc" ("sin") ("cos") ("tan") ("sinh") ("cosh") ("tanh"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1078 ("size" n) ("font" n) ("fwd" n) ("back" n) ("up" n) ("down" n)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1079 ("above" punc ",")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1080
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1081 (put 'eqn 'math-lang-adjust-words
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1082 (function
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1083 (lambda ()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1084 (let ((code (assoc math-expr-data math-eqn-ignore-words)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1085 (cond ((null code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1086 ((null (cdr code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1087 (math-read-token))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1088 ((consp (nth 1 code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1089 (math-read-token)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1090 (if (assoc math-expr-data (cdr code))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1091 (setq math-expr-data (format "%s %s"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1092 (car code) math-expr-data))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1093 ((eq (nth 1 code) 'punc)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1094 (setq math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1095 math-expr-data (nth 2 code)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1096 (t
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1097 (math-read-token)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1098 (math-read-token)))))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1099
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1100 (put 'eqn 'math-lang-read
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1101 '((eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1102 math-exp-str math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1103 math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1104 (progn
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1105 (setq math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1106 math-expr-data (math-match-substring math-exp-str 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1107 math-exp-pos (match-end 0))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1108 (and (eq (string-match "\\\\dots\\." math-exp-str math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1109 math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1110 (setq math-exp-pos (match-end 0)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1111 (if (memq (aref math-expr-data 0) '(?~ ?^))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1112 (math-read-token)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1113
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1114
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1115 (defun math-compose-eqn-matrix (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1116 (if a
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1117 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1118 (cond ((eq calc-matrix-just 'right) "rcol ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1119 ((eq calc-matrix-just 'center) "ccol ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1120 (t "lcol "))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1121 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1122 (list 'break math-compose-level)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1123 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1124 "{ "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1125 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1126 (let ((math-compose-level (1+ math-compose-level)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1127 (math-compose-vector (cdr (car a)) " above " 1000))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1128 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1129 " } "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1130 (math-compose-eqn-matrix (cdr a)))))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1131 nil))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1132
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1133 (defun math-parse-eqn-matrix (f sym)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1134 (let ((vec nil))
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1135 (while (assoc math-expr-data '(("ccol") ("lcol") ("rcol")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1136 (math-read-token)
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1137 (or (equal math-expr-data calc-function-open)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1138 (throw 'syntax "Expected `{'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1139 (math-read-token)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1140 (setq vec (cons (cons 'vec (math-read-expr-list)) vec))
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1141 (or (equal math-expr-data calc-function-close)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1142 (throw 'syntax "Expected `}'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1143 (math-read-token))
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1144 (or (equal math-expr-data calc-function-close)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1145 (throw 'syntax "Expected `}'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1146 (math-read-token)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
1147 (math-transpose (cons 'vec (nreverse vec)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1148
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1149 (defun math-parse-eqn-prime (x sym)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1150 (if (eq (car-safe x) 'var)
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1151 (if (equal math-expr-data calc-function-open)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1152 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1153 (math-read-token)
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1154 (let ((args (if (or (equal math-expr-data calc-function-close)
58134
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
1155 (eq math-exp-token 'end))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1156 nil
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1157 (math-read-expr-list))))
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1158 (if (not (or (equal math-expr-data calc-function-close)
58134
3089957051ea (math-parse-tex-sum): Use declared variable math-exp-old-pos.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58107
diff changeset
1159 (eq math-exp-token 'end)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1160 (throw 'syntax "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1161 (math-read-token)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1162 (cons (intern (format "calcFunc-%s'" (nth 1 x))) args)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1163 (list 'var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1164 (intern (concat (symbol-name (nth 1 x)) "'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1165 (intern (concat (symbol-name (nth 2 x)) "'"))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
1166 (list 'calcFunc-Prime x)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1167
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1168 (defun math-compose-eqn-intv (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1169 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1170 (if (memq (nth 1 a) '(0 1)) "(" "[")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1171 (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1172 " ... "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1173 (math-compose-expr (nth 3 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1174 (if (memq (nth 1 a) '(0 2)) ")" "]")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1175
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1176
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1177 ;;; Yacas
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1178
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1179 (defun calc-yacas-language ()
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1180 "Change the Calc language to be Yacas-like."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1181 (interactive)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1182 (calc-wrapper
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1183 (calc-set-language 'yacas)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1184 (message "`Yacas' language mode")))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1185
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1186 (put 'yacas 'math-vector-brackets "{}")
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1187
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1188 (put 'yacas 'math-complex-format 'I)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1189
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1190 (add-to-list 'calc-lang-brackets-are-subscripts 'yacas)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1191
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1192 (put 'yacas 'math-variable-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1193 '(( Infinity . var-inf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1194 ( Infinity . var-uinf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1195 ( Undefined . var-nan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1196 ( Pi . var-pi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1197 ( E . var-e) ;; Not really in Yacas
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1198 ( GoldenRatio . var-phi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1199 ( Gamma . var-gamma)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1200
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1201 (put 'yacas 'math-parse-table
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1202 '((("Deriv(" 0 ")" 0)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1203 calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1204 (("D(" 0 ")" 0)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1205 calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1206 (("Integrate(" 0 ")" 0)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1207 calcFunc-integ (var ArgB var-ArgB)(var ArgA var-ArgA))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1208 (("Integrate(" 0 "," 0 "," 0 ")" 0)
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1209 calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1210 (var ArgB var-ArgB) (var ArgC var-ArgC))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1211 (("Subst(" 0 "," 0 ")" 0)
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1212 calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1213 (var ArgB var-ArgB))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1214 (("Taylor(" 0 "," 0 "," 0 ")" 0)
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1215 calcFunc-taylor (var ArgD var-ArgD)
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1216 (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB))
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1217 (var ArgC var-ArgC))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1218
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1219 (put 'yacas 'math-oper-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1220 '(("+" + 30 30)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1221 ("-" - 30 60)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1222 ("*" * 60 60)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1223 ("/" / 70 70)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1224 ("u-" neg -1 60)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1225 ("^" ^ 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1226 ("u+" ident -1 30)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1227 ("<<" calcFunc-lsh 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1228 (">>" calcFunc-rsh 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1229 ("!" calcFunc-fact 80 -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1230 ("!!" calcFunc-dfact 80 -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1231 ("X" calcFunc-cross 70 70)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1232 ("=" calcFunc-eq 10 10)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1233 ("!=" calcFunc-neq 10 10)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1234 ("<" calcFunc-lt 10 10)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1235 (">" calcFunc-gt 10 10)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1236 ("<=" calcFunc-leq 10 10)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1237 (">=" calcFunc-geq 10 10)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1238 ("And" calcFunc-land 5 5)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1239 ("Or" calcFunc-or 4 4)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1240 ("Not" calcFunc-lnot -1 3)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1241 (":=" calcFunc-assign 1 1)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1242
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1243 (put 'yacas 'math-function-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1244 '(( Div . calcFunc-idiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1245 ( Mod . calcFunc-mod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1246 ( Abs . calcFunc-abs)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1247 ( Sign . calcFunc-sign)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1248 ( Sqrt . calcFunc-sqrt)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1249 ( Max . calcFunc-max)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1250 ( Min . calcFunc-min)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1251 ( Floor . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1252 ( Ceil . calcFunc-ceil)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1253 ( Round . calcFunc-round)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1254 ( Conjugate . calcFunc-conj)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1255 ( Arg . calcFunc-arg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1256 ( Re . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1257 ( Im . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1258 ( Rationalize . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1259 ( Sin . calcFunc-sin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1260 ( Cos . calcFunc-cos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1261 ( Tan . calcFunc-tan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1262 ( Sec . calcFunc-sec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1263 ( Csc . calcFunc-csc)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1264 ( Cot . calcFunc-cot)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1265 ( ArcSin . calcFunc-arcsin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1266 ( ArcCos . calcFunc-arccos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1267 ( ArcTan . calcFunc-arctan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1268 ( Sinh . calcFunc-sinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1269 ( Cosh . calcFunc-cosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1270 ( Tanh . calcFunc-tanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1271 ( Sech . calcFunc-sech)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1272 ( Csch . calcFunc-csch)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1273 ( Coth . calcFunc-coth)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1274 ( ArcSinh . calcFunc-arcsinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1275 ( ArcCosh . calcFunc-arccosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1276 ( ArcTanh . calcFunc-arctanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1277 ( Ln . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1278 ( Exp . calcFunc-exp)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1279 ( Gamma . calcFunc-gamma)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1280 ( Gcd . calcFunc-gcd)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1281 ( Lcm . calcFunc-lcm)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1282 ( Bin . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1283 ( Bernoulli . calcFunc-bern)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1284 ( Euler . calcFunc-euler)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1285 ( StirlingNumber1 . calcFunc-stir1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1286 ( StirlingNumber2 . calcFunc-stir2)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1287 ( IsPrime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1288 ( Factors . calcFunc-prfac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1289 ( NextPrime . calcFunc-nextprime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1290 ( Moebius . calcFunc-moebius)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1291 ( Random . calcFunc-random)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1292 ( Concat . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1293 ( Head . calcFunc-head)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1294 ( Tail . calcFunc-tail)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1295 ( Length . calcFunc-vlen)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1296 ( Reverse . calcFunc-rev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1297 ( CrossProduct . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1298 ( Dot . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1299 ( DiagonalMatrix . calcFunc-diag)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1300 ( Transpose . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1301 ( Inverse . calcFunc-inv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1302 ( Determinant . calcFunc-det)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1303 ( Trace . calcFunc-tr)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1304 ( RemoveDuplicates . calcFunc-rdup)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1305 ( Union . calcFunc-vunion)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1306 ( Intersection . calcFunc-vint)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1307 ( Difference . calcFunc-vdiff)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1308 ( Apply . calcFunc-apply)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1309 ( Map . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1310 ( Simplify . calcFunc-simplify)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1311 ( ExpandBrackets . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1312 ( Solve . calcFunc-solve)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1313 ( Degree . calcFunc-pdeg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1314 ( If . calcFunc-if)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1315 ( Contains . (math-lang-switch-args calcFunc-in))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1316 ( Sum . (math-yacas-parse-Sum calcFunc-sum))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1317 ( Factorize . (math-yacas-parse-Sum calcFunc-prod))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1318
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1319 (put 'yacas 'math-special-function-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1320 '(( calcFunc-sum . (math-yacas-compose-sum "Sum"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1321 ( calcFunc-prod . (math-yacas-compose-sum "Factorize"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1322 ( calcFunc-deriv . (math-yacas-compose-deriv "Deriv"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1323 ( calcFunc-integ . (math-yacas-compose-deriv "Integrate"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1324 ( calcFunc-taylor . math-yacas-compose-taylor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1325 ( calcFunc-in . (math-lang-compose-switch-args "Contains"))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1326
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1327 (put 'yacas 'math-compose-subscr
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1328 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1329 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1330 (let ((args (cdr (cdr a))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1331 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1332 (math-compose-expr (nth 1 a) 1000)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1333 "["
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1334 (math-compose-vector args ", " 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1335 "]")))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1336
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1337 (defun math-yacas-parse-Sum (f val)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1338 "Read in the arguments to \"Sum\" in Calc's Yacas mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1339 (let ((args (math-read-expr-list)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1340 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1341 (list (nth 2 f)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1342 (nth 3 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1343 (nth 0 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1344 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1345 (nth 2 args))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1346
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1347 (defun math-yacas-compose-sum (a fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1348 "Compose the \"Sum\" function in Calc's Yacas mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1349 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1350 (nth 1 fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1351 "("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1352 (math-compose-expr (nth 2 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1353 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1354 (math-compose-expr (nth 3 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1355 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1356 (math-compose-expr (nth 4 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1357 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1358 (math-compose-expr (nth 1 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1359 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1360
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1361 (defun math-yacas-compose-deriv (a fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1362 "Compose the \"Deriv\" function in Calc's Yacas mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1363 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1364 (nth 1 fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1365 "("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1366 (math-compose-expr (nth 2 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1367 (if (not (nth 3 a))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1368 ")"
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1369 (concat
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1370 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1371 (math-compose-expr (nth 3 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1372 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1373 (math-compose-expr (nth 4 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1374 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1375 " "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1376 (math-compose-expr (nth 1 a) -1)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1377
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1378 (defun math-yacas-compose-taylor (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1379 "Compose the \"Taylor\" function in Calc's Yacas mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1380 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1381 "Taylor("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1382 (if (eq (car-safe (nth 2 a)) 'calcFunc-eq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1383 (concat (math-compose-expr (nth 1 (nth 2 a)) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1384 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1385 (math-compose-expr (nth 2 (nth 2 a)) -1))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1386 (concat (math-compose-expr (nth 2 a) -1) ",0"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1387 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1388 (math-compose-expr (nth 3 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1389 ") "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1390 (math-compose-expr (nth 1 a) -1)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1391
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1392
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1393 ;;; Maxima
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1394
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1395 (defun calc-maxima-language ()
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1396 "Change the Calc language to be Maxima-like."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1397 (interactive)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1398 (calc-wrapper
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1399 (calc-set-language 'maxima)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1400 (message "`Maxima' language mode")))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1401
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1402 (put 'maxima 'math-oper-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1403 '(("+" + 100 100)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1404 ("-" - 100 134)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1405 ("*" * 120 120)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1406 ("." * 130 129)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1407 ("/" / 120 120)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1408 ("u-" neg -1 180)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1409 ("u+" ident -1 180)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1410 ("^" ^ 140 139)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1411 ("**" ^ 140 139)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1412 ("!" calcFunc-fact 160 -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1413 ("!!" calcFunc-dfact 160 -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1414 ("=" calcFunc-eq 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1415 ("#" calcFunc-neq 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1416 ("<" calcFunc-lt 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1417 (">" calcFunc-gt 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1418 ("<=" calcFunc-leq 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1419 (">=" calcFunc-geq 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1420 ("and" calcFunc-land 65 65)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1421 ("or" calcFunc-or 60 60)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1422 ("not" calcFunc-lnot -1 70)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1423 (":" calcFunc-assign 180 20)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1424
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1425
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1426 (put 'maxima 'math-function-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1427 '(( matrix . vec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1428 ( abs . calcFunc-abs)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1429 ( cabs . calcFunc-abs)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1430 ( signum . calcFunc-sign)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1431 ( floor . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1432 ( entier . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1433 ( fix . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1434 ( conjugate . calcFunc-conj )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1435 ( carg . calcFunc-arg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1436 ( realpart . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1437 ( imagpart . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1438 ( rationalize . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1439 ( asin . calcFunc-arcsin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1440 ( acos . calcFunc-arccos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1441 ( atan . calcFunc-arctan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1442 ( atan2 . calcFunc-arctan2)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1443 ( asinh . calcFunc-arcsinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1444 ( acosh . calcFunc-arccosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1445 ( atanh . calcFunc-arctanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1446 ( log . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1447 ( plog . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1448 ( bessel_j . calcFunc-besJ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1449 ( bessel_y . calcFunc-besY)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1450 ( factorial . calcFunc-fact)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1451 ( binomial . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1452 ( primep . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1453 ( next_prime . calcFunc-nextprime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1454 ( prev_prime . calcFunc-prevprime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1455 ( append . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1456 ( rest . calcFunc-tail)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1457 ( reverse . calcFunc-rev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1458 ( innerproduct . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1459 ( inprod . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1460 ( row . calcFunc-mrow)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1461 ( columnvector . calcFunc-mcol)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1462 ( covect . calcFunc-mcol)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1463 ( transpose . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1464 ( invert . calcFunc-inv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1465 ( determinant . calcFunc-det)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1466 ( mattrace . calcFunc-tr)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1467 ( member . calcFunc-in)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1468 ( lmax . calcFunc-vmax)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1469 ( lmin . calcFunc-vmin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1470 ( distrib . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1471 ( partfrac . calcFunc-apart)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1472 ( rat . calcFunc-nrat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1473 ( product . calcFunc-prod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1474 ( diff . calcFunc-deriv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1475 ( integrate . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1476 ( quotient . calcFunc-pdiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1477 ( remainder . calcFunc-prem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1478 ( divide . calcFunc-pdivrem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1479 ( equal . calcFunc-eq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1480 ( notequal . calcFunc-neq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1481 ( rhs . calcFunc-rmeq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1482 ( subst . (math-maxima-parse-subst))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1483 ( substitute . (math-maxima-parse-subst))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1484 ( taylor . (math-maxima-parse-taylor))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1485
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1486 (defun math-maxima-parse-subst (f val)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1487 "Read in the arguments to \"subst\" in Calc's Maxima mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1488 (let ((args (math-read-expr-list)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1489 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1490 (list 'calcFunc-subst
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1491 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1492 (nth 2 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1493 (nth 0 args))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1494
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1495 (defun math-maxima-parse-taylor (f val)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1496 "Read in the arguments to \"taylor\" in Calc's Maxima mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1497 (let ((args (math-read-expr-list)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1498 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1499 (list 'calcFunc-taylor
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1500 (nth 0 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1501 (list 'calcFunc-eq
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1502 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1503 (nth 2 args))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1504 (nth 3 args))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1505
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1506 (put 'maxima 'math-parse-table
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1507 '((("if" 0 "then" 0 "else" 0)
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1508 calcFunc-if
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1509 (var ArgA var-ArgA)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1510 (var ArgB var-ArgB)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1511 (var ArgC var-ArgC))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1512
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1513 (put 'maxima 'math-special-function-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1514 '(( calcFunc-taylor . math-maxima-compose-taylor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1515 ( calcFunc-subst . math-maxima-compose-subst)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1516 ( calcFunc-if . math-maxima-compose-if)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1517
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1518 (defun math-maxima-compose-taylor (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1519 "Compose the \"taylor\" function in Calc's Maxima mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1520 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1521 "taylor("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1522 (math-compose-expr (nth 1 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1523 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1524 (if (eq (car-safe (nth 2 a)) 'calcFunc-eq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1525 (concat (math-compose-expr (nth 1 (nth 2 a)) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1526 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1527 (math-compose-expr (nth 2 (nth 2 a)) -1))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1528 (concat (math-compose-expr (nth 2 a) -1) ",0"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1529 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1530 (math-compose-expr (nth 3 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1531 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1532
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1533 (defun math-maxima-compose-subst (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1534 "Compose the \"subst\" function in Calc's Maxima mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1535 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1536 "substitute("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1537 (math-compose-expr (nth 2 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1538 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1539 (math-compose-expr (nth 3 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1540 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1541 (math-compose-expr (nth 1 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1542 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1543
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1544 (defun math-maxima-compose-if (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1545 "Compose the \"if\" function in Calc's Maxima mode."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1546 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1547 "if "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1548 (math-compose-expr (nth 1 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1549 " then "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1550 (math-compose-expr (nth 2 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1551 " else "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1552 (math-compose-expr (nth 3 a) -1)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1553
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1554 (put 'maxima 'math-variable-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1555 '(( infinity . var-uinf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1556 ( %pi . var-pi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1557 ( %e . var-e)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1558 ( %i . var-i)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1559 ( %phi . var-phi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1560 ( %gamma . var-gamma)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1561
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1562 (put 'maxima 'math-complex-format '%i)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1563
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1564 (add-to-list 'calc-lang-allow-underscores 'maxima)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1565
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1566 (add-to-list 'calc-lang-allow-percentsigns 'maxima)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1567
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1568 (add-to-list 'calc-lang-brackets-are-subscripts 'maxima)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1569
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1570 (put 'maxima 'math-compose-subscr
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1571 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1572 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1573 (let ((args (cdr (cdr a))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1574 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1575 (math-compose-expr (nth 1 a) 1000)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1576 "["
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1577 (math-compose-vector args ", " 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1578 "]")))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1579
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1580 (put 'maxima 'math-matrix-formatter
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1581 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1582 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1583 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1584 "matrix("
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1585 (math-compose-vector (cdr a)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1586 (concat math-comp-comma " ")
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1587 math-comp-vector-prec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1588 ")"))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1589
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1590
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1591 ;;; Giac
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1592
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1593 (defun calc-giac-language ()
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1594 "Change the Calc language to be Giac-like."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1595 (interactive)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1596 (calc-wrapper
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1597 (calc-set-language 'giac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1598 (message "`Giac' language mode")))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1599
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1600 (put 'giac 'math-oper-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1601 '( ( "[" (math-read-giac-subscr) 250 -1 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1602 ( "+" + 180 181 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1603 ( "-" - 180 181 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1604 ( "/" / 191 192 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1605 ( "*" * 191 192 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1606 ( "^" ^ 201 200 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1607 ( "u+" ident -1 197 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1608 ( "u-" neg -1 197 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1609 ( "!" calcFunc-fact 210 -1 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1610 ( ".." (math-read-maple-dots) 165 165 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1611 ( "\\dots" (math-read-maple-dots) 165 165 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1612 ( "intersect" calcFunc-vint 191 192 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1613 ( "union" calcFunc-vunion 180 181 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1614 ( "minus" calcFunc-vdiff 180 181 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1615 ( "<" calcFunc-lt 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1616 ( ">" calcFunc-gt 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1617 ( "<=" calcFunc-leq 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1618 ( ">=" calcFunc-geq 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1619 ( "=" calcFunc-eq 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1620 ( "==" calcFunc-eq 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1621 ( "!=" calcFunc-neq 160 160 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1622 ( "and" calcFunc-land 110 111 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1623 ( "or" calcFunc-lor 100 101 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1624 ( "&&" calcFunc-land 110 111 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1625 ( "||" calcFunc-lor 100 101 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1626 ( "not" calcFunc-lnot -1 121 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1627 ( ":=" calcFunc-assign 51 50 )))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1628
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1629
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1630 (put 'giac 'math-function-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1631 '(( rdiv . calcFunc-div)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1632 ( iquo . calcFunc-idiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1633 ( irem . calcFunc-mod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1634 ( remain . calcFunc-mod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1635 ( floor . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1636 ( iPart . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1637 ( ceil . calcFunc-ceil)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1638 ( ceiling . calcFunc-ceil)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1639 ( re . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1640 ( real . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1641 ( im . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1642 ( imag . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1643 ( float2rational . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1644 ( exact . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1645 ( evalf . calcFunc-pfloat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1646 ( bitand . calcFunc-and)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1647 ( bitor . calcFunc-or)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1648 ( bitxor . calcFunc-xor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1649 ( asin . calcFunc-arcsin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1650 ( acos . calcFunc-arccos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1651 ( atan . calcFunc-arctan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1652 ( asinh . calcFunc-arcsinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1653 ( acosh . calcFunc-arccosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1654 ( atanh . calcFunc-arctanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1655 ( log . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1656 ( logb . calcFunc-log)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1657 ( factorial . calcFunc-fact)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1658 ( comb . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1659 ( binomial . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1660 ( nCr . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1661 ( perm . calcFunc-perm)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1662 ( nPr . calcFunc-perm)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1663 ( bernoulli . calcFunc-bern)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1664 ( is_prime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1665 ( isprime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1666 ( isPrime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1667 ( ifactors . calcFunc-prfac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1668 ( euler . calcFunc-totient)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1669 ( phi . calcFunc-totient)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1670 ( rand . calcFunc-random)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1671 ( concat . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1672 ( augment . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1673 ( mid . calcFunc-subvec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1674 ( length . calcFunc-length)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1675 ( size . calcFunc-length)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1676 ( nops . calcFunc-length)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1677 ( SortA . calcFunc-sort)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1678 ( SortB . calcFunc-rsort)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1679 ( revlist . calcFunc-rev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1680 ( cross . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1681 ( crossP . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1682 ( crossproduct . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1683 ( mul . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1684 ( dot . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1685 ( dotprod . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1686 ( dotP . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1687 ( scalar_product . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1688 ( scalar_Product . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1689 ( row . calcFunc-mrow)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1690 ( col . calcFunc-mcol)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1691 ( dim . calcFunc-mdims)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1692 ( tran . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1693 ( transpose . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1694 ( lu . calcFunc-lud)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1695 ( trace . calcFunc-tr)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1696 ( member . calcFunc-in)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1697 ( sum . calcFunc-vsum)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1698 ( add . calcFunc-vsum)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1699 ( product . calcFunc-vprod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1700 ( mean . calcFunc-vmean)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1701 ( median . calcFunc-vmedian)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1702 ( stddev . calcFunc-vsdev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1703 ( stddevp . calcFunc-vpsdev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1704 ( variance . calcFunc-vpvar)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1705 ( map . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1706 ( apply . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1707 ( of . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1708 ( zip . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1709 ( expand . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1710 ( fdistrib . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1711 ( partfrac . calcFunc-apart)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1712 ( ratnormal . calcFunc-nrat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1713 ( diff . calcFunc-deriv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1714 ( derive . calcFunc-deriv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1715 ( integrate . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1716 ( int . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1717 ( Int . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1718 ( romberg . calcFunc-ninteg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1719 ( nInt . calcFunc-ninteg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1720 ( lcoeff . calcFunc-plead)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1721 ( content . calcFunc-pcont)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1722 ( primpart . calcFunc-pprim)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1723 ( quo . calcFunc-pdiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1724 ( rem . calcFunc-prem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1725 ( quorem . calcFunc-pdivrem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1726 ( divide . calcFunc-pdivrem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1727 ( equal . calcFunc-eq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1728 ( ifte . calcFunc-if)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1729 ( not . calcFunc-lnot)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1730 ( rhs . calcFunc-rmeq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1731 ( right . calcFunc-rmeq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1732 ( prepend . (math-lang-switch-args calcFunc-cons))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1733 ( contains . (math-lang-switch-args calcFunc-in))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1734 ( has . (math-lang-switch-args calcFunc-refers))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1735
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1736 (defun math-lang-switch-args (f val)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1737 "Read the arguments to a Calc function in reverse order.
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1738 This is used for various language modes which have functions in reverse
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1739 order to Calc's."
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1740 (let ((args (math-read-expr-list)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1741 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1742 (list (nth 2 f)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1743 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1744 (nth 0 args))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1745
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1746 (put 'giac 'math-parse-table
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1747 '((("set" 0)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1748 calcFunc-rdup
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1749 (var ArgA var-ArgA))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1750
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1751 (put 'giac 'math-special-function-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1752 '((calcFunc-cons . (math-lang-compose-switch-args "prepend"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1753 (calcFunc-in . (math-lang-compose-switch-args "contains"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1754 (calcFunc-refers . (math-lang-compose-switch-args "has"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1755 (intv . math-compose-maple-intv)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1756
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1757 (defun math-lang-compose-switch-args (a fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1758 "Compose the arguments to a Calc function in reverse order.
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1759 This is used for various language modes which have functions in reverse
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1760 order to Calc's."
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1761 (list 'horiz (nth 1 fn)
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1762 "("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1763 (math-compose-expr (nth 2 a) 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1764 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1765 (math-compose-expr (nth 1 a) 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1766 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1767
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1768 (put 'giac 'math-variable-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1769 '(( infinity . var-inf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1770 ( infinity . var-uinf)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1771
87471
949048bec87d (math-complex-format): Add giac.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87463
diff changeset
1772 (put 'giac 'math-complex-format 'i)
949048bec87d (math-complex-format): Add giac.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87463
diff changeset
1773
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1774 (add-to-list 'calc-lang-allow-underscores 'giac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1775
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1776 (put 'giac 'math-compose-subscr
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1777 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1778 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1779 (let ((args (cdr (cdr a))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1780 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1781 (math-compose-expr (nth 1 a) 1000)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1782 "["
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
1783 (math-compose-expr
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1784 (calc-normalize (list '- (nth 2 a) 1)) 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1785 "]")))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1786
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1787 (defun math-read-giac-subscr (x op)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1788 (let ((idx (math-read-expr-level 0)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1789 (or (equal math-expr-data "]")
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1790 (throw 'syntax "Expected ']'"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1791 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1792 (list 'calcFunc-subscr x (calc-normalize (list '+ idx 1)))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1793
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1794 (add-to-list 'calc-lang-c-type-hex 'giac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1795
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1796
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1797 (defun calc-mathematica-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1798 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1799 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1800 (calc-set-language 'math)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
1801 (message "Mathematica language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1802
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1803 (put 'math 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1804 '( ( "[[" (math-read-math-subscr) 250 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1805 ( "!" calcFunc-fact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1806 ( "!!" calcFunc-dfact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1807 ( "^" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1808 ( "u+" ident -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1809 ( "u-" neg -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1810 ( "/" / 195 196 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1811 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1812 ( "2x" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1813 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1814 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1815 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1816 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1817 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1818 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1819 ( "==" calcFunc-eq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1820 ( "!=" calcFunc-neq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1821 ( "u!" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1822 ( "&&" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1823 ( "||" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1824 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1825 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1826 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1827 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1828 ( "=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1829 ( "->" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1830 ( ":>" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1831 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1832 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1833
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1834 (put 'math 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1835 '( ( Abs . calcFunc-abs )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1836 ( ArcCos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1837 ( ArcCosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1838 ( ArcSin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1839 ( ArcSinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1840 ( ArcTan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1841 ( ArcTanh . calcFunc-arctanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1842 ( Arg . calcFunc-arg )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1843 ( Binomial . calcFunc-choose )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1844 ( Ceiling . calcFunc-ceil )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1845 ( Conjugate . calcFunc-conj )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1846 ( Cos . calcFunc-cos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1847 ( Cosh . calcFunc-cosh )
61069
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
1848 ( Cot . calcFunc-cot )
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
1849 ( Coth . calcFunc-coth )
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
1850 ( Csc . calcFunc-csc )
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
1851 ( Csch . calcFunc-csch )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1852 ( D . calcFunc-deriv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1853 ( Dt . calcFunc-tderiv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1854 ( Det . calcFunc-det )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1855 ( Exp . calcFunc-exp )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1856 ( EulerPhi . calcFunc-totient )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1857 ( Floor . calcFunc-floor )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1858 ( Gamma . calcFunc-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1859 ( GCD . calcFunc-gcd )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1860 ( If . calcFunc-if )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1861 ( Im . calcFunc-im )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1862 ( Inverse . calcFunc-inv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1863 ( Integrate . calcFunc-integ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1864 ( Join . calcFunc-vconcat )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1865 ( LCM . calcFunc-lcm )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1866 ( Log . calcFunc-ln )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1867 ( Max . calcFunc-max )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1868 ( Min . calcFunc-min )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1869 ( Mod . calcFunc-mod )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1870 ( MoebiusMu . calcFunc-moebius )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1871 ( Random . calcFunc-random )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1872 ( Round . calcFunc-round )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1873 ( Re . calcFunc-re )
61069
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
1874 ( Sec . calcFunc-sec )
803f4b2d0113 Add functions to math-function-table properties of tex and math.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59966
diff changeset
1875 ( Sech . calcFunc-sech )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1876 ( Sign . calcFunc-sign )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1877 ( Sin . calcFunc-sin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1878 ( Sinh . calcFunc-sinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1879 ( Sqrt . calcFunc-sqrt )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1880 ( Tan . calcFunc-tan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1881 ( Tanh . calcFunc-tanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1882 ( Transpose . calcFunc-trn )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1883 ( Length . calcFunc-vlen )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1884 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1885
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1886 (put 'math 'math-variable-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1887 '( ( I . var-i )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1888 ( Pi . var-pi )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1889 ( E . var-e )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1890 ( GoldenRatio . var-phi )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1891 ( EulerGamma . var-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1892 ( Infinity . var-inf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1893 ( ComplexInfinity . var-uinf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1894 ( Indeterminate . var-nan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1895 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1896
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1897 (put 'math 'math-vector-brackets "{}")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1898 (put 'math 'math-complex-format 'I)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1899 (put 'math 'math-function-open "[")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1900 (put 'math 'math-function-close "]")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1901
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1902 (put 'math 'math-radix-formatter
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1903 (function (lambda (r s) (format "%d^^%s" r s))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1904
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1905 (put 'math 'math-lang-read
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1906 '((eq (string-match "\\[\\[\\|->\\|:>" math-exp-str math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1907 math-exp-pos)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1908 (setq math-exp-token 'punc
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1909 math-expr-data (math-match-substring math-exp-str 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1910 math-exp-pos (match-end 0))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1911
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1912 (put 'math 'math-compose-subscr
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1913 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1914 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1915 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1916 (math-compose-expr (nth 1 a) 1000)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1917 "[["
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1918 (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1919 "]]"))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1920
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1921 (defun math-read-math-subscr (x op)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1922 (let ((idx (math-read-expr-level 0)))
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1923 (or (and (equal math-expr-data "]")
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1924 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1925 (math-read-token)
58107
cfad3432f125 (math-parse-fortran-vector, math-parse-fortran-vector-end,
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
1926 (equal math-expr-data "]")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1927 (throw 'syntax "Expected ']]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1928 (math-read-token)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
1929 (list 'calcFunc-subscr x idx)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1930
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1931
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1932 (defun calc-maple-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1933 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1934 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1935 (calc-set-language 'maple)
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
1936 (message "Maple language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1937
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1938 (put 'maple 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1939 '( ( "matrix" ident -1 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1940 ( "MATRIX" ident -1 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1941 ( "!" calcFunc-fact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1942 ( "^" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1943 ( "**" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1944 ( "u+" ident -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1945 ( "u-" neg -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1946 ( "/" / 191 192 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1947 ( "*" * 191 192 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1948 ( "intersect" calcFunc-vint 191 192 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1949 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1950 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1951 ( "union" calcFunc-vunion 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1952 ( "minus" calcFunc-vdiff 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1953 ( "mod" % 170 170 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1954 ( ".." (math-read-maple-dots) 165 165 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1955 ( "\\dots" (math-read-maple-dots) 165 165 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1956 ( "<" calcFunc-lt 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1957 ( ">" calcFunc-gt 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1958 ( "<=" calcFunc-leq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1959 ( ">=" calcFunc-geq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1960 ( "=" calcFunc-eq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1961 ( "<>" calcFunc-neq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1962 ( "not" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1963 ( "and" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1964 ( "or" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1965 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1966 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1967 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1968 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1969 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1970 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1971
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1972 (put 'maple 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1973 '( ( bernoulli . calcFunc-bern )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1974 ( binomial . calcFunc-choose )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1975 ( diff . calcFunc-deriv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1976 ( GAMMA . calcFunc-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1977 ( ifactor . calcFunc-prfac )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1978 ( igcd . calcFunc-gcd )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1979 ( ilcm . calcFunc-lcm )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1980 ( int . calcFunc-integ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1981 ( modp . % )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1982 ( irem . % )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1983 ( iquo . calcFunc-idiv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1984 ( isprime . calcFunc-prime )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1985 ( length . calcFunc-vlen )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1986 ( member . calcFunc-in )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1987 ( crossprod . calcFunc-cross )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1988 ( inverse . calcFunc-inv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1989 ( trace . calcFunc-tr )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1990 ( transpose . calcFunc-trn )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1991 ( vectdim . calcFunc-vlen )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1992 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1993
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1994 (put 'maple 'math-special-function-table
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1995 '((intv . math-compose-maple-intv)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1996
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1997 (put 'maple 'math-variable-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1998 '( ( I . var-i )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1999 ( Pi . var-pi )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2000 ( E . var-e )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2001 ( infinity . var-inf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2002 ( infinity . var-uinf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2003 ( infinity . var-nan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2004 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2005
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2006 (put 'maple 'math-complex-format 'I)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2007
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2008 (put 'maple 'math-matrix-formatter
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2009 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2010 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2011 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2012 "matrix("
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2013 math-comp-left-bracket
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2014 (math-compose-vector (cdr a)
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2015 (concat math-comp-comma " ")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2016 math-comp-vector-prec)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2017 math-comp-right-bracket
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2018 ")"))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2019
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2020 (put 'maple 'math-compose-subscr
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2021 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2022 (lambda (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2023 (let ((args (cdr (cdr a))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2024 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2025 (math-compose-expr (nth 1 a) 1000)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2026 "["
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2027 (math-compose-vector args ", " 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2028 "]")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2029
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2030 (add-to-list 'calc-lang-allow-underscores 'maple)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2031 (add-to-list 'calc-lang-brackets-are-subscripts 'maple)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2032
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2033 (defun math-compose-maple-intv (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2034 (list 'horiz
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2035 (math-compose-expr (nth 2 a) 0)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2036 " .. "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2037 (math-compose-expr (nth 3 a) 0)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2038
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2039 (defun math-read-maple-dots (x op)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2040 (list 'intv 3 x (math-read-expr-level (nth 3 op))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2041
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2042
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2043 ;; The variable math-read-big-lines is local to math-read-big-expr in
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2044 ;; calc-ext.el, but is used by math-read-big-rec, math-read-big-char,
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2045 ;; math-read-big-emptyp, math-read-big-error and math-read-big-balance,
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2046 ;; which are called (directly and indirectly) by math-read-big-expr.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2047 ;; It is also local to math-read-big-bigp in calc-ext.el, which calls
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2048 ;; math-read-big-balance.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2049 (defvar math-read-big-lines)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2050
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2051 ;; The variables math-read-big-baseline and math-read-big-h2 are
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2052 ;; local to math-read-big-expr in calc-ext.el, but used by
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2053 ;; math-read-big-rec.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2054 (defvar math-read-big-baseline)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2055 (defvar math-read-big-h2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2056
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2057 ;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2058 ;; are local to math-read-big-rec, but are used by math-read-big-char,
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2059 ;; math-read-big-emptyp and math-read-big-balance which are called by
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2060 ;; math-read-big-rec.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2061 ;; math-rb-h2 is also local to math-read-big-bigp in calc-ext.el,
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2062 ;; which calls math-read-big-balance.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2063 (defvar math-rb-h1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2064 (defvar math-rb-h2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2065 (defvar math-rb-v1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2066 (defvar math-rb-v2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2067
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2068 (defun math-read-big-rec (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2069 &optional baseline prec short)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2070 (or prec (setq prec 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2071
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2072 ;; Clip whitespace above or below.
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2073 (while (and (< math-rb-v1 math-rb-v2)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2074 (math-read-big-emptyp math-rb-h1 math-rb-v1 math-rb-h2 (1+ math-rb-v1)))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2075 (setq math-rb-v1 (1+ math-rb-v1)))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2076 (while (and (< math-rb-v1 math-rb-v2)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2077 (math-read-big-emptyp math-rb-h1 (1- math-rb-v2) math-rb-h2 math-rb-v2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2078 (setq math-rb-v2 (1- math-rb-v2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2079
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2080 ;; If formula is a single line high, normal parser can handle it.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2081 (if (<= math-rb-v2 (1+ math-rb-v1))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2082 (if (or (<= math-rb-v2 math-rb-v1)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2083 (> math-rb-h1 (length (setq math-rb-v2
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2084 (nth math-rb-v1 math-read-big-lines)))))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2085 (math-read-big-error math-rb-h1 math-rb-v1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2086 (setq math-read-big-baseline math-rb-v1
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2087 math-read-big-h2 math-rb-h2
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2088 math-rb-v2 (nth math-rb-v1 math-read-big-lines)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2089 math-rb-h2 (math-read-expr
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2090 (substring math-rb-v2 math-rb-h1
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2091 (min math-rb-h2 (length math-rb-v2)))))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2092 (if (eq (car-safe math-rb-h2) 'error)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2093 (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2094 math-rb-v1 (nth 2 math-rb-h2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2095 math-rb-h2))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2096
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2097 ;; Clip whitespace at left or right.
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2098 (while (and (< math-rb-h1 math-rb-h2)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2099 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) math-rb-v2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2100 (setq math-rb-h1 (1+ math-rb-h1)))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2101 (while (and (< math-rb-h1 math-rb-h2)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2102 (math-read-big-emptyp (1- math-rb-h2) math-rb-v1 math-rb-h2 math-rb-v2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2103 (setq math-rb-h2 (1- math-rb-h2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2104
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2105 ;; Scan to find widest left-justified "----" in the region.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2106 (let* ((widest nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2107 (widest-h2 0)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2108 (lines-v1 (nthcdr math-rb-v1 math-read-big-lines))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2109 (p lines-v1)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2110 (v math-rb-v1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2111 (other-v nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2112 other-char line len h)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2113 (while (< v math-rb-v2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2114 (setq line (car p)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2115 len (min math-rb-h2 (length line)))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2116 (and (< math-rb-h1 len)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2117 (/= (aref line math-rb-h1) ?\ )
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2118 (if (and (= (aref line math-rb-h1) ?\-)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2119 ;; Make sure it's not a minus sign.
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2120 (or (and (< (1+ math-rb-h1) len)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2121 (= (aref line (1+ math-rb-h1)) ?\-))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2122 (/= (math-read-big-char math-rb-h1 (1- v)) ?\ )
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2123 (/= (math-read-big-char math-rb-h1 (1+ v)) ?\ )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2124 (progn
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2125 (setq h math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2126 (while (and (< (setq h (1+ h)) len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2127 (= (aref line h) ?\-)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2128 (if (> h widest-h2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2129 (setq widest v
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2130 widest-h2 h)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2131 (or other-v (setq other-v v other-char (aref line math-rb-h1)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2132 (setq v (1+ v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2133 p (cdr p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2134
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2135 (cond ((not (setq v other-v))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2136 (math-read-big-error math-rb-h1 math-rb-v1)) ; Should never happen!
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2137
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2138 ;; Quotient.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2139 (widest
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2140 (setq h widest-h2
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2141 v widest)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2142 (let ((num (math-read-big-rec math-rb-h1 math-rb-v1 h v))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2143 (den (math-read-big-rec math-rb-h1 (1+ v) h math-rb-v2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2144 (setq p (if (and (math-integerp num) (math-integerp den))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2145 (math-make-frac num den)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2146 (list '/ num den)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2147
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2148 ;; Big radical sign.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2149 ((= other-char ?\\)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2150 (or (= (math-read-big-char (1+ math-rb-h1) v) ?\|)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2151 (math-read-big-error (1+ math-rb-h1) v "Malformed root sign"))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2152 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2153 (while (= (math-read-big-char (1+ math-rb-h1) (setq v (1- v))) ?\|))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2154 (or (= (math-read-big-char (setq h (+ math-rb-h1 2)) v) ?\_)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2155 (math-read-big-error h v "Malformed root sign"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2156 (while (= (math-read-big-char (setq h (1+ h)) v) ?\_))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2157 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2158 (math-read-big-emptyp math-rb-h1 (1+ other-v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2159 (setq p (list 'calcFunc-sqrt (math-read-big-rec
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2160 (+ math-rb-h1 2) (1+ v)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2161 h (1+ other-v) baseline))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2162 v math-read-big-baseline))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2163
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2164 ;; Small radical sign.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2165 ((and (= other-char ?V)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2166 (= (math-read-big-char (1+ math-rb-h1) (1- v)) ?\_))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2167 (setq h (1+ math-rb-h1))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2168 (math-read-big-emptyp math-rb-h1 math-rb-v1 h (1- v) nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2169 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2170 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2171 (while (= (math-read-big-char (setq h (1+ h)) (1- v)) ?\_))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2172 (setq p (list 'calcFunc-sqrt (math-read-big-rec
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2173 (1+ math-rb-h1) v h (1+ v) t))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2174 v math-read-big-baseline))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2175
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2176 ;; Binomial coefficient.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2177 ((and (= other-char ?\()
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2178 (= (math-read-big-char (1+ math-rb-h1) v) ?\ )
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2179 (= (string-match "( *)" (nth v math-read-big-lines)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2180 math-rb-h1) math-rb-h1))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2181 (setq h (match-end 0))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2182 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2183 (math-read-big-emptyp math-rb-h1 (1+ v) (1+ math-rb-h1) math-rb-v2 nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2184 (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2185 (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2186 (setq p (list 'calcFunc-choose
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2187 (math-read-big-rec (1+ math-rb-h1) math-rb-v1 (1- h) v)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2188 (math-read-big-rec (1+ math-rb-h1) (1+ v)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2189 (1- h) math-rb-v2))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2190
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2191 ;; Minus sign.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2192 ((= other-char ?\-)
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2193 (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2194 math-rb-h2 math-rb-v2 v 250 t))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2195 v math-read-big-baseline
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2196 h math-read-big-h2))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2197
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2198 ;; Parentheses.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2199 ((= other-char ?\()
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2200 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2201 (math-read-big-emptyp math-rb-h1 (1+ v) (1+ math-rb-h1) math-rb-v2 nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2202 (setq h (math-read-big-balance (1+ math-rb-h1) v "(" t))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2203 (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2204 (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2205 (let ((sep (math-read-big-char (1- h) v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2206 hmid)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2207 (if (= sep ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2208 (setq h (1+ h)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2209 (if (= sep ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2210 (math-read-big-error (1- h) v "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2211 (if (= sep ?\))
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2212 (setq p (math-read-big-rec
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2213 (1+ math-rb-h1) math-rb-v1 (1- h) math-rb-v2 v))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2214 (setq hmid (math-read-big-balance h v "(")
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2215 p (list p
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2216 (math-read-big-rec h math-rb-v1 (1- hmid) math-rb-v2 v))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2217 h hmid)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2218 (cond ((= sep ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2219 (setq p (cons 'intv (cons (if (= (math-read-big-char
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2220 (1- h) v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2221 ?\))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2222 0 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2223 p))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2224 ((= (math-read-big-char (1- h) v) ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2225 (math-read-big-error (1- h) v "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2226 ((= sep ?\,)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2227 (or (and (math-realp (car p)) (math-realp (nth 1 p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2228 (math-read-big-error
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2229 math-rb-h1 v "Complex components must be real"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2230 (setq p (cons 'cplx p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2231 ((= sep ?\;)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2232 (or (and (math-realp (car p)) (math-anglep (nth 1 p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2233 (math-read-big-error
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2234 math-rb-h1 v "Complex components must be real"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2235 (setq p (cons 'polar p)))))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2236
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2237 ;; Matrix.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2238 ((and (= other-char ?\[)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2239 (or (= (math-read-big-char (setq h math-rb-h1) (1+ v)) ?\[)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2240 (= (math-read-big-char (setq h (1+ h)) v) ?\[)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2241 (and (= (math-read-big-char h v) ?\ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2242 (= (math-read-big-char (setq h (1+ h)) v) ?\[)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2243 (= (math-read-big-char h (1+ v)) ?\[))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2244 (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2245 (let ((vtop v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2246 (hleft h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2247 (hright nil))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2248 (setq p nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2249 (while (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2250 (setq h (math-read-big-balance (1+ hleft) v "["))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2251 (if hright
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2252 (or (= h hright)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2253 (math-read-big-error hright v "Expected `]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2254 (setq hright h))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2255 (setq p (cons (math-read-big-rec
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2256 hleft v h (1+ v)) p))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2257 (and (memq (math-read-big-char h v) '(?\ ?\,))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2258 (= (math-read-big-char hleft (1+ v)) ?\[)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2259 (setq v (1+ v)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2260 (or (= hleft math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2261 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2262 (if (= (math-read-big-char h v) ?\ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2263 (setq h (1+ h)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2264 (and (= (math-read-big-char h v) ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2265 (setq h (1+ h))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2266 (math-read-big-error (1- h) v "Expected `]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2267 (if (= (math-read-big-char h vtop) ?\,)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2268 (setq h (1+ h)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2269 (math-read-big-emptyp math-rb-h1 (1+ v) (1- h) math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2270 (setq v (+ vtop (/ (- v vtop) 2))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2271 p (cons 'vec (nreverse p)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2272
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2273 ;; Square brackets.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2274 ((= other-char ?\[)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2275 (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2276 (math-read-big-emptyp math-rb-h1 (1+ v) (1+ math-rb-h1) math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2277 (setq p nil
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2278 h (1+ math-rb-h1))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2279 (while (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2280 (setq widest (math-read-big-balance h v "[" t))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2281 (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2282 (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2283 (setq p (cons (math-read-big-rec
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2284 h math-rb-v1 (1- widest) math-rb-v2 v) p)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2285 h widest)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2286 (= (math-read-big-char (1- h) v) ?\,)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2287 (setq widest (math-read-big-char (1- h) v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2288 (if (or (memq widest '(?\; ?\)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2289 (and (eq widest ?\.) (cdr p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2290 (math-read-big-error (1- h) v "Expected `]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2291 (if (= widest ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2292 (setq h (1+ h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2293 widest (math-read-big-balance h v "[")
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2294 p (nconc p (list (math-read-big-rec
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2295 h math-rb-v1 (1- widest) math-rb-v2 v)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2296 h widest
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2297 p (cons 'intv (cons (if (= (math-read-big-char (1- h) v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2298 ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2299 3 2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2300 p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2301 (setq p (cons 'vec (nreverse p)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2302
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2303 ;; Date form.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2304 ((= other-char ?\<)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2305 (setq line (nth v math-read-big-lines))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2306 (string-match ">" line math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2307 (setq h (match-end 0))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2308 (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2309 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2310 (setq p (math-read-big-rec math-rb-h1 v h (1+ v) v)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2311
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2312 ;; Variable name or function call.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2313 ((or (and (>= other-char ?a) (<= other-char ?z))
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
2314 (and (>= other-char ?A) (<= other-char ?Z))
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
2315 (and (>= other-char ?α) (<= other-char ?ω))
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
2316 (and (>= other-char ?Α) (<= other-char ?Ω)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2317 (setq line (nth v math-read-big-lines))
108590
c84578d13e42 calc-aent.el (math-read-token, math-find-user-tokens):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 106815
diff changeset
2318 (string-match "\\([a-zA-Zα-ωΑ-Ω'_]+\\) *" line math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2319 (setq h (match-end 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2320 widest (match-end 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2321 p (math-match-substring line 1))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2322 (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2323 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2324 (if (= (math-read-big-char widest v) ?\()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2325 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2326 (setq line (if (string-match "-" p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2327 (intern p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2328 (intern (concat "calcFunc-" p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2329 h (1+ widest)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2330 p nil)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2331 (math-read-big-emptyp widest math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2332 (math-read-big-emptyp widest (1+ v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2333 (while (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2334 (setq widest (math-read-big-balance h v "(" t))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2335 (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2336 (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2337 (setq p (cons (math-read-big-rec
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2338 h math-rb-v1 (1- widest) math-rb-v2 v) p)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2339 h widest)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2340 (= (math-read-big-char (1- h) v) ?\,)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2341 (or (= (math-read-big-char (1- h) v) ?\))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2342 (math-read-big-error (1- h) v "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2343 (setq p (cons line (nreverse p))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2344 (setq p (list 'var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2345 (intern (math-remove-dashes p))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2346 (if (string-match "-" p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2347 (intern p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2348 (intern (concat "var-" p)))))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2349
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2350 ;; Number.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2351 (t
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2352 (setq line (nth v math-read-big-lines))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2353 (or (= (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\([0-9]+\\(#\\|\\^\\^\\)[0-9a-zA-Z:]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" line math-rb-h1) math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2354 (math-read-big-error h v "Expected a number"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2355 (setq h (match-end 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2356 p (math-read-number (math-match-substring line 0)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2357 (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2358 (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2359
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2360 ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2;
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2361 ;; baseline = v.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2362 (if baseline
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2363 (or (= v baseline)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2364 (math-read-big-error math-rb-h1 v "Inconsistent baseline in formula"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2365 (setq baseline v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2366
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2367 ;; Look for superscripts or subscripts.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2368 (setq line (nth baseline math-read-big-lines)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2369 len (min math-rb-h2 (length line))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2370 widest h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2371 (while (and (< widest len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2372 (= (aref line widest) ?\ ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2373 (setq widest (1+ widest)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2374 (and (>= widest len) (setq widest math-rb-h2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2375 (if (math-read-big-emptyp h v widest math-rb-v2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2376 (if (math-read-big-emptyp h math-rb-v1 widest v)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2377 (setq h widest)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2378 (setq p (list '^ p (math-read-big-rec h math-rb-v1 widest v))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2379 h widest))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2380 (if (math-read-big-emptyp h math-rb-v1 widest v)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2381 (setq p (list 'calcFunc-subscr p
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2382 (math-read-big-rec h v widest math-rb-v2))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2383 h widest)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2384
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2385 ;; Look for an operator name and grab additional terms.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2386 (while (and (< h len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2387 (if (setq widest (and (math-read-big-emptyp
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2388 h math-rb-v1 (1+ h) v)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2389 (math-read-big-emptyp
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2390 h (1+ v) (1+ h) math-rb-v2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2391 (string-match "<=\\|>=\\|\\+/-\\|!=\\|&&\\|||\\|:=\\|=>\\|." line h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2392 (assoc (math-match-substring line 0)
81470
3e0c2ded3e4a (calc-set-language,math-read-big-rec): Let math-expr-opers equal the
Jay Belanger <jay.p.belanger@gmail.com>
parents: 77465
diff changeset
2393 (math-standard-ops))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2394 (and (>= (nth 2 widest) prec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2395 (setq h (match-end 0)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2396 (and (not (eq (string-match ",\\|;\\|\\.\\.\\|)\\|\\]\\|:" line h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2397 h))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2398 (setq widest '("2x" * 196 195)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2399 (cond ((eq (nth 3 widest) -1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2400 (setq p (list (nth 1 widest) p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2401 ((equal (car widest) "?")
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2402 (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2403 math-rb-v2 baseline nil t)))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2404 (or (= (math-read-big-char math-read-big-h2 baseline) ?\:)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2405 (math-read-big-error math-read-big-h2 baseline "Expected `:'"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2406 (setq p (list (nth 1 widest) p y
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2407 (math-read-big-rec
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2408 (1+ math-read-big-h2) math-rb-v1 math-rb-h2 math-rb-v2
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2409 baseline (nth 3 widest) t))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2410 h math-read-big-h2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2411 (t
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2412 (setq p (list (nth 1 widest) p
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2413 (math-read-big-rec h math-rb-v1 math-rb-h2 math-rb-v2
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2414 baseline (nth 3 widest) t))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2415 h math-read-big-h2))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2416
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2417 ;; Return all relevant information to caller.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2418 (setq math-read-big-baseline baseline
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2419 math-read-big-h2 h)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2420 (or short (= math-read-big-h2 math-rb-h2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2421 (math-read-big-error h baseline))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2422 p)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2423
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2424 (defun math-read-big-char (h v)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2425 (or (and (>= h math-rb-h1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2426 (< h math-rb-h2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2427 (>= v math-rb-v1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2428 (< v math-rb-v2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2429 (let ((line (nth v math-read-big-lines)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2430 (and line
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2431 (< h (length line))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2432 (aref line h))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2433 ?\ ))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2434
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2435 (defun math-read-big-emptyp (eh1 ev1 eh2 ev2 &optional what error)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2436 (and (< ev1 math-rb-v1) (setq ev1 math-rb-v1))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2437 (and (< eh1 math-rb-h1) (setq eh1 math-rb-h1))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2438 (and (> ev2 math-rb-v2) (setq ev2 math-rb-v2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2439 (and (> eh2 math-rb-h2) (setq eh2 math-rb-h2))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2440 (or what (setq what ?\ ))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2441 (let ((p (nthcdr ev1 math-read-big-lines))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2442 h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2443 (while (and (< ev1 ev2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2444 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2445 (setq h (min eh2 (length (car p))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2446 (while (and (>= (setq h (1- h)) eh1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2447 (= (aref (car p) h) what)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2448 (and error (>= h eh1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2449 (math-read-big-error h ev1 (if (stringp error)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2450 error
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2451 "Whitespace expected")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2452 (< h eh1)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2453 (setq ev1 (1+ ev1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2454 p (cdr p)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2455 (>= ev1 ev2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2456
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2457 ;; math-read-big-err-msg is local to math-read-big-expr in calc-ext.el,
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2458 ;; but is used by math-read-big-error which is called (indirectly) by
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2459 ;; math-read-big-expr.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2460 (defvar math-read-big-err-msg)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2461
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2462 (defun math-read-big-error (h v &optional msg)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2463 (let ((pos 0)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2464 (p math-read-big-lines))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2465 (while (> v 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2466 (setq pos (+ pos 1 (length (car p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2467 p (cdr p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2468 v (1- v)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2469 (setq h (+ pos (min h (length (car p))))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2470 math-read-big-err-msg (list 'error h (or msg "Syntax error")))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2471 (throw 'syntax nil)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2472
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2473 (defun math-read-big-balance (h v what &optional commas)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2474 (let* ((line (nth v math-read-big-lines))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2475 (len (min math-rb-h2 (length line)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2476 (count 1))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2477 (while (> count 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2478 (if (>= h len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2479 (if what
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2480 (math-read-big-error nil v (format "Unmatched `%s'" what))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2481 (setq count 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2482 (if (memq (aref line h) '(?\( ?\[))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2483 (setq count (1+ count))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2484 (if (if (and commas (= count 1))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2485 (or (memq (aref line h) '(?\) ?\] ?\, ?\;))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2486 (and (eq (aref line h) ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2487 (< (1+ h) len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2488 (eq (aref line (1+ h)) ?\.)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2489 (memq (aref line h) '(?\) ?\])))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2490 (setq count (1- count))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2491 (setq h (1+ h))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2492 h))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2493
58661
10224395a3c2 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58571
diff changeset
2494 (provide 'calc-lang)
10224395a3c2 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58571
diff changeset
2495
109033
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2496 ;; Local variables:
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2497 ;; coding: utf-8
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2498 ;; End:
d150a25a0eb9 Add some utf-8 coding cookies.
Glenn Morris <rgm@gnu.org>
parents: 108590
diff changeset
2499
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
2500 ;; arch-tag: 483bfe15-f290-4fef-bb7d-ce65be687f2e
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2501 ;;; calc-lang.el ends here