annotate lisp/calc/calc-lang.el @ 87518:78fc69cc7bef

* vc-svn.el (vc-svn-modify-change comment): New function.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Wed, 02 Jan 2008 00:42:37 +0000
parents 949048bec87d
children 107ccd98fa12 c938ab6810a4
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
64325
1db49616ce05 Update copyright information.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
75346
7a3f13e2dd57 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 73057
diff changeset
4 ;; 2005, 2006, 2007 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
76595
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
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
78215
095d08e7d6bb Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 77465
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
76595
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
14 ;; 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
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
24 ;; Boston, MA 02110-1301, USA.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
26 ;;; Commentary:
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
27
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
28 ;;; Code:
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
30 ;; This file is autoloaded from calc-ext.el.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31
58661
10224395a3c2 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58571
diff changeset
32 (require 'calc-ext)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
33 (require 'calc-macs)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
34
86475
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
35
d76be4a4a0a5 (math-read-factor, math-read-expr-level): Declare as functions.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86135
diff changeset
36 ;; 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
37 (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
38 (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
39 (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
40 (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
41 (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
42
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
43 ;; 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
44 (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
45 (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
46 (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
47 (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
48 (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
49 (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
50 (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
51
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 ;;; Alternate entry/display languages.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
53
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 (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
55 (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
56 math-expr-function-mapping (get lang 'math-function-table)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 math-expr-variable-mapping (get lang 'math-variable-table)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 calc-language-input-filter (get lang 'math-input-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 calc-language-output-filter (get lang 'math-output-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 calc-vector-brackets (or (get lang 'math-vector-brackets) "[]")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
61 calc-complex-format (get lang 'math-complex-format)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62 calc-radix-formatter (get lang 'math-radix-formatter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 calc-function-open (or (get lang 'math-function-open) "(")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 calc-function-close (or (get lang 'math-function-close) ")"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65 (if no-refresh
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 (setq calc-language lang
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
67 calc-language-option option)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68 (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
69 (list lang option) t)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
70
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
71 (defun calc-normal-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
72 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
73 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74 (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
75 (message "Normal language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
77 (defun calc-flat-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
79 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80 (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
81 (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
82
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
83 (defun calc-big-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
85 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86 (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
87 (message "\"Big\" language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 (defun calc-unformatted-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
90 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
91 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
92 (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
93 (message "Unformatted language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
94
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96 (defun calc-c-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 (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
100 (message "`C' language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
101
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102 (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
103 '( ( "u!" calcFunc-lnot -1 1000 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 ( "~" 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
105 ( "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
106 ( "u-" neg -1 197 )
40785
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 ( "/" / 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
109 ( "%" % 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 ( "<<" calcFunc-lsh 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
113 ( ">>" calcFunc-rsh 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
116 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
117 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
118 ( "==" calcFunc-eq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
119 ( "!=" calcFunc-neq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
120 ( "&" calcFunc-and 140 141 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
121 ( "^" calcFunc-xor 131 130 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
122 ( "|" calcFunc-or 120 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
123 ( "&&" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
124 ( "||" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
125 ( "?" (math-read-if) 91 90 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
126 ( "!!!" calcFunc-pnot -1 88 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
127 ( "&&&" calcFunc-pand 85 86 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
128 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
129 ( "=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
130 ( ":=" calcFunc-assign 51 50 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
131 ( "::" calcFunc-condition 45 46 ))) ; should support full assignments
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
132
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
133 (put 'c 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
134 '( ( acos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
135 ( acosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
136 ( asin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
137 ( asinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
138 ( atan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
139 ( atan2 . calcFunc-arctan2 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
140 ( atanh . calcFunc-arctanh )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
141
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
142 (put 'c 'math-variable-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
143 '( ( M_PI . var-pi )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
144 ( M_E . var-e )))
40785
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-vector-brackets "{}")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
147
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
148 (put 'c 'math-radix-formatter
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
149 (function (lambda (r s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
150 (if (= r 16) (format "0x%s" s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
151 (if (= r 8) (format "0%s" s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
152 (format "%d#%s" r s))))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
153
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
154 (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
155 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
156 (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
157 (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
158 (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
159 (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
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 (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
162 "]")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
163
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-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
165 (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
166 (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
167 (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
168
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
169 (defun calc-pascal-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
170 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
171 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
172 (and n (setq n (prefix-numeric-value n)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
173 (calc-set-language 'pascal n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
174 (message (if (and n (/= n 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
175 (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
176 "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
177 "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
178 "Pascal language mode"))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
179
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
180 (put 'pascal 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
181 '( ( "not" calcFunc-lnot -1 1000 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
182 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
183 ( "/" / 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
184 ( "and" calcFunc-and 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
185 ( "div" calcFunc-idiv 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
186 ( "mod" % 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
187 ( "u+" ident -1 185 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
188 ( "u-" neg -1 185 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
189 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
190 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
191 ( "or" calcFunc-or 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
192 ( "xor" calcFunc-xor 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
193 ( "shl" calcFunc-lsh 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
194 ( "shr" calcFunc-rsh 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
195 ( "in" calcFunc-in 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
196 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
197 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
198 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
199 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
200 ( "=" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
201 ( "<>" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
202 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
203 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
204 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
205 ( ":=" calcFunc-assign 51 50 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
206 ( "::" calcFunc-condition 45 46 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
207
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
208 (put 'pascal 'math-input-filter 'calc-input-case-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
209 (put 'pascal 'math-output-filter 'calc-output-case-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
210
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
211 (put 'pascal 'math-radix-formatter
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
212 (function (lambda (r s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
213 (if (= r 16) (format "$%s" s)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
214 (format "%d#%s" r s)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
215
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
216 (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
217 '((?\$
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
218 (eq (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
219 "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Z]\\)"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
220 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
221 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
222 (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
223 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
224 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
225
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
226 (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
227 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
228 (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
229 (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
230 (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
231 (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
232 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
233 (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
234 (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
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 (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
237 "]")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
238
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
239 (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
240 (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
241
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
242 (defun calc-input-case-filter (str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
243 (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
244 str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
245 (t
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
246 (downcase str))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
247
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
248 (defun calc-output-case-filter (str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
249 (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
250 str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
251 ((> calc-language-option 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
252 (upcase str))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
253 (t
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
254 (downcase str))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
255
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
256
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
257 (defun calc-fortran-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
258 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
259 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
260 (and n (setq n (prefix-numeric-value n)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
261 (calc-set-language 'fortran n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
262 (message (if (and n (/= n 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
263 (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
264 "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
265 "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
266 "FORTRAN language mode"))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
267
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
268 (put 'fortran 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
269 '( ( "u/" (math-parse-fortran-vector) -1 1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
270 ( "/" (math-parse-fortran-vector-end) 1 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
271 ( "**" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
272 ( "u+" ident -1 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
273 ( "u-" neg -1 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
274 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
275 ( "/" / 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
276 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
277 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
278 ( ".LT." calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
279 ( ".GT." calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
280 ( ".LE." calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
281 ( ".GE." calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
282 ( ".EQ." calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
283 ( ".NE." calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
284 ( ".NOT." calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
285 ( ".AND." calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
286 ( ".OR." calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
287 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
288 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
289 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
290 ( "=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
291 ( ":=" calcFunc-assign 51 50 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
292 ( "::" calcFunc-condition 45 46 )))
40785
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-vector-brackets "//")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
295
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
296 (put 'fortran 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
297 '( ( acos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
298 ( acosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
299 ( aimag . calcFunc-im )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
300 ( aint . calcFunc-ftrunc )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
301 ( asin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
302 ( asinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
303 ( atan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
304 ( atan2 . calcFunc-arctan2 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
305 ( atanh . calcFunc-arctanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
306 ( conjg . calcFunc-conj )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
307 ( log . calcFunc-ln )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
308 ( nint . calcFunc-round )
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49263
diff changeset
309 ( real . calcFunc-re )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
310
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
311 (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
312
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
313 (put 'fortran 'math-output-filter 'calc-output-case-filter)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
314
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
315 (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
316 '((?\.
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
317 (eq (string-match "\\.[a-zA-Z][a-zA-Z][a-zA-Z]?\\."
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-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
319 (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
320 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
321 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
322
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
323 (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
324 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
325 (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
326 (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
327 (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
328 (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
329 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
330 (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
331 (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
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 (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
334 ")")))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
335
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-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
337 (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
338 (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
339
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
340 ;; The next few variables are local to math-read-exprs in calc-aent.el
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 ;; 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
342
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-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
344 (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
345 (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
346
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
347 (defvar math-parsing-fortran-vector nil)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
348 (defun math-parse-fortran-vector (op)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
349 (let ((math-parsing-fortran-vector '(end . "\000")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
350 (prog1
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
351 (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
352 (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
353 math-expr-data (cdr math-parsing-fortran-vector)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
354
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
355 (defun math-parse-fortran-vector-end (x op)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
356 (if math-parsing-fortran-vector
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
357 (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
358 (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
359 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
360 math-expr-data "\000")
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
361 x)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
362 (throw 'syntax "Unmatched closing `/'")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
363
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
364 (defun math-parse-fortran-subscr (sym args)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
365 (setq sym (math-build-var-name sym))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
366 (while args
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
367 (setq sym (list 'calcFunc-subscr sym (car args))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
368 args (cdr args)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
369 sym)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
370
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
371
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
372 (defun calc-tex-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
373 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
374 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
375 (and n (setq n (prefix-numeric-value n)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
376 (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
377 (cond ((not n)
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"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
379 ((= n 0)
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 multiline matrices"))
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
381 ((= n 1)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
382 (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
383 ((> n 1)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
384 (message
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
385 "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
386 ((= n -1)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
387 (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
388 ((< n -1)
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
389 (message
9eb004b49fc9 (calc-tex-language): Display more information in messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59915
diff changeset
390 "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
391
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
392 (defun calc-latex-language (n)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
393 (interactive "P")
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
394 (calc-wrapper
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
395 (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
396 (calc-set-language 'latex n)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
397 (cond ((not n)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
398 (message "LaTeX language mode"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
399 ((= n 0)
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 multiline matrices"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
401 ((= n 1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
402 (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
403 ((> n 1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
404 (message
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
405 "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
406 ((= n -1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
407 (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
408 ((< n -1)
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
409 (message
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
410 "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
411
87223
e9cba8ba37e1 (calc-lang-name): New property name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86969
diff changeset
412 (put 'tex 'math-lang-name "TeX")
e9cba8ba37e1 (calc-lang-name): New property name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86969
diff changeset
413 (put 'latex 'math-lang-name "LaTeX")
e9cba8ba37e1 (calc-lang-name): New property name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86969
diff changeset
414
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
415 (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
416 '( ( "\\hat" calcFunc-hat -1 950 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
417 ( "\\check" calcFunc-check -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
418 ( "\\tilde" calcFunc-tilde -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
419 ( "\\acute" calcFunc-acute -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
420 ( "\\grave" calcFunc-grave -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
421 ( "\\dot" calcFunc-dot -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
422 ( "\\ddot" calcFunc-dotdot -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
423 ( "\\breve" calcFunc-breve -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
424 ( "\\bar" calcFunc-bar -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
425 ( "\\vec" calcFunc-Vec -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
426 ( "\\underline" calcFunc-under -1 950 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
427 ( "u|" calcFunc-abs -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
428 ( "|" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
429 ( "\\lfloor" calcFunc-floor -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
430 ( "\\rfloor" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
431 ( "\\lceil" calcFunc-ceil -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
432 ( "\\rceil" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
433 ( "\\pm" sdev 300 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
434 ( "!" calcFunc-fact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
435 ( "^" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
436 ( "_" 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
437 ( "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
438 ( "u-" neg -1 197 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
439 ( "\\times" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
440 ( "*" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
441 ( "2x" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
442 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
443 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
444 ( "\\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
445 ( "/" / 170 171 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
446 ( "\\choose" calcFunc-choose 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
447 ( "\\mod" % 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
448 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
449 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
450 ( "\\leq" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
451 ( "\\geq" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
452 ( "=" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
453 ( "\\neq" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
454 ( "\\ne" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
455 ( "\\lnot" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
456 ( "\\land" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
457 ( "\\lor" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
458 ( "?" (math-read-if) 91 90 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
459 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
460 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
461 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
462 ( "\\gets" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
463 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
464 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
465 ( "\\to" calcFunc-evalto 40 41 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
466 ( "\\to" calcFunc-evalto 40 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
467 ( "=>" calcFunc-evalto 40 41 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
468 ( "=>" calcFunc-evalto 40 -1 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
469
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
470 (put 'tex 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
471 '( ( \\arccos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
472 ( \\arcsin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
473 ( \\arctan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
474 ( \\arg . calcFunc-arg )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
475 ( \\cos . calcFunc-cos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
476 ( \\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
477 ( \\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
478 ( \\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
479 ( \\csc . calcFunc-csc )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
480 ( \\det . calcFunc-det )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
481 ( \\exp . calcFunc-exp )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
482 ( \\gcd . calcFunc-gcd )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
483 ( \\ln . calcFunc-ln )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
484 ( \\log . calcFunc-log10 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
485 ( \\max . calcFunc-max )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
486 ( \\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
487 ( \\sec . calcFunc-sec )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
488 ( \\sin . calcFunc-sin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
489 ( \\sinh . calcFunc-sinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
490 ( \\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
491 ( \\tan . calcFunc-tan )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
492 ( \\tanh . calcFunc-tanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
493 ( \\phi . calcFunc-totient )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
494 ( \\mu . calcFunc-moebius )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
495
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
496 (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
497 '((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
498 (calcFunc-prod . (math-compose-tex-sum "\\prod"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
499 (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
500
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
501 (put 'tex 'math-variable-table
73057
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
502 '(
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
503 ;; 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
504 ( \\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
505 ( \\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
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 ( \\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
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 ( \\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
510 ( \\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
511 ( \\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
512 ( \\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
513 ( \\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
514 ( \\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
515 ( \\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
516 ( \\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
517 ( \\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
518 ( \\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
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 ( \\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
521 ( \\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
522 ( \\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
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 ( \\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
525 ( \\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
526 ( \\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
527 ( \\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
528 ( \\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
529 ( \\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
530 ( \\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
531 ( \\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
532 ( \\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
533 ( \\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
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 ( \\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
536 ( \\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
537 ( \\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
538 ( \\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
539 ( \\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
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 ( \\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
542 ( \\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
543 ( \\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
544 ;; Others
76991373b070 Add Greek letters to math-variable-table properties of tex.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 68636
diff changeset
545 ( \\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
546 ( \\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
547 ( \\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
548 ( \\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
549 ( \\prod . (math-parse-tex-sum calcFunc-prod) )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
550
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
551 (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
552 '((?\{ . ?\()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
553 (?\} . ?\))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
554 (?\& . ?\,)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
555
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
556 (put 'tex 'math-complex-format 'i)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
557
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
558 (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
559
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-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
561 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
562 (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
563 (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
564 (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
565 (> 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
566 (< 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
567 (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
568 (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
569 '("}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
570 (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
571 (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
572 '(" }"))))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
573
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
574 (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
575
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
576 (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
577
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
578 (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
579
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
580 (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
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 (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
583
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
584 (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
585 '( ("\\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
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 ("\\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
588 ("\\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
589 ("\\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
590 ("\\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
591 ("\\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
592 ("\\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
593 ("\\evalto")
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
594 ("\\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
595 ("\\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
596 ("\\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
597 ("\\{" 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
598
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
599 (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
600 (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
601 '(("\\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
602
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
603 (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
604 '((?\\
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
605 (< 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
606 (progn
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
607 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
608 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
609 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
610 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
611 (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
612 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
613 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
614 (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
615 (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
616 (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
617 ((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
618 (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
619 ((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
620 (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
621 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
622 ((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
623 (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
624 (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
625 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
626 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
627 (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
628 (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
629 (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
630 (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
631
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
632 (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
633 (if (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
634 (cons (append (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
635 (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
636 (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
637 (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
638
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
639 (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
640 (cond
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
641 ((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
642 (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
643 "_{" (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
644 "=" (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
645 "}^{" (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
646 "}{" (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
647 ((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
648 (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
649 "_{" (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
650 "=" (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
651 "}{" (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
652 (t
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
653 (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
654 "_{" (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
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
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
657 (defun math-parse-tex-sum (f val)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
658 (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
659 (or (equal math-expr-data "_") (throw 'syntax "Expected `_'"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
660 (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
661 (setq save math-exp-old-pos)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
662 (setq low (math-read-factor))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
663 (or (eq (car-safe low) 'calcFunc-eq)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
664 (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
665 (setq math-exp-old-pos (1+ save))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
666 (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
667 (or (equal math-expr-data "^") (throw 'syntax "Expected `^'"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
668 (math-read-token)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
669 (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
670 (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
671
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
672 (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
673 (while (string-match "[0-9]\\\\,[0-9]" str)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
674 (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
675 (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
676 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
677
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
678 ;(defun math-tex-print-sqrt (a)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
679 ; (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
680 ; "\\sqrt{"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
681 ; (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
682 ; "}"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
683
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
684 (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
685 (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
686 (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
687 (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
688 " \\ldots "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
689 (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
690 (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
691
86969
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
692 (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
693 (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
694 (not (= 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
695 (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
696 (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
697 (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
698 (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
699 (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
700 (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
701
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
702 (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
703 (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
704 (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
705 (not (= 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
706 (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
707 (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
708 (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
709 (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
710 (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
711 (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
712 (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
713 (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
714 (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
715 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
716 ((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
717 (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
718 (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
719 (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
720 (= (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
721 (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
722 (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
723 (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
724 (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
725 right calc-function-close)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
726 (list 'horiz func
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
727 left
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
728 (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
729 right)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
730
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
731 (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
732 (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
733 '(( "\\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
734 ( "\\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
735 ( "\\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
736 ( "\\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
737 ( "\\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
738 ( "\\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
739 ( "\\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
740 ( "\\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
741 ( "\\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
742 ( "\\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
743 ( "\\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
744 ( "\\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
745 ( "\\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
746 ( "\\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
747 ( "\\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
748 ( "\\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
749 ( "\\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
750 ( "\\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
751 ( "\\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
752 ( "=" 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
753 ( "\\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
754 ( "\\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
755 ( "\\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
756 ( "\\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
757 ( "\\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
758 ( "?" (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
759 ( "!!!" 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
760 ( "&&&" 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
761 ( "|||" 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
762 ( "\\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
763 ( ":=" 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
764 ( "::" 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
765 ( "\\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
766 ( "\\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
767 ( "=>" 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
768 ( "=>" calcFunc-evalto 40 -1 ))))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
769
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
770 (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
771 (append
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
772 (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
773 '(( \\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
774 ( \\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
775 ( \\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
776 ( \\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
777 ( \\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
778 ( \\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
779 ( \\phi . calcFunc-totient )
502b609847e8 (math-function-table, math-oper-table, math-variable-table):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59819
diff changeset
780 ( \\mu . calcFunc-moebius ))))
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
781
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
782 (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
783 '((/ . (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
784 (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
785 (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
786 (calcFunc-prod . (math-compose-tex-sum "\\prod"))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
787 (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
788
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
789 (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
790 (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
791
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 (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
793 '((?\{ . ?\()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
794 (?\} . ?\))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
795 (?\& . ?\,)))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
796
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
797 (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
798
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
799 (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
800 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
801 (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
802 (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
803 (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
804 (> 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
805 (< 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
806 (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
807 (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
808 '("\\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
809 (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
810 (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
811 '(" \\end{pmatrix}"))))))
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
812
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
813 (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
814
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
815 (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
816
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
817 (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
818
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
819 (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
820
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
821 (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
822
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-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
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 (< 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
826 (progn
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
827 (or (string-match "\\\\hbox *{\\([a-zA-Z0-9]+\\)}"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
828 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
829 (string-match "\\\\text *{\\([a-zA-Z0-9]+\\)}"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
830 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
831 (string-match "\\(\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\)"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
832 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
833 (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
834 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
835 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
836 (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
837 (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
838 envname)
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
839 (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
840 ((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
841 (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
842 ((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
843 (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
844 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
845 ((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
846 (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
847 (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
848 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
849 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
850 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
851 (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
852 (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
853 (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
854 (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
855 (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
856 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-str
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
858 (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
859 (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
860 ((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
861 (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
862 (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
863 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
864 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
865 (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
866 (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
867 (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
868 (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
869
59811
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
870 (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
871 (let (numer denom)
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
872 (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
873 (math-read-token)
59915
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
874 (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
875 (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
876 (Math-num-integerp denom))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
877 (list 'frac numer denom)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
878 (list '/ numer denom))))
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
879
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
880 (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
881 (let (first second)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
882 (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
883 (math-read-token)
937e422a1694 (math-latex-parse-frac): Don't use arguments.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59829
diff changeset
884 (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
885 (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
886
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
887 (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
888 (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
889 "}{"
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
890 (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
891 "}"))
9e28f5bc25bb (calc-latex-language, math-latex-parse-frac)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58661
diff changeset
892
59819
dea78c6f5e48 (math-latex-input-filter): Remove function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59811
diff changeset
893 (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
894
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
895 (defun calc-eqn-language (n)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
896 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
897 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
898 (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
899 (message "Eqn language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
900
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
901 (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
902 '( ( "prime" (math-parse-eqn-prime) 950 -1 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
903 ( "prime" calcFunc-Prime 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
904 ( "dot" calcFunc-dot 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
905 ( "dotdot" calcFunc-dotdot 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
906 ( "hat" calcFunc-hat 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
907 ( "tilde" calcFunc-tilde 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
908 ( "vec" calcFunc-Vec 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
909 ( "dyad" calcFunc-dyad 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
910 ( "bar" calcFunc-bar 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
911 ( "under" calcFunc-under 950 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
912 ( "sub" calcFunc-subscr 931 930 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
913 ( "sup" ^ 921 920 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
914 ( "sqrt" calcFunc-sqrt -1 910 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
915 ( "over" / 900 901 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
916 ( "u|" calcFunc-abs -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
917 ( "|" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
918 ( "left floor" calcFunc-floor -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
919 ( "right floor" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
920 ( "left ceil" calcFunc-ceil -1 0 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
921 ( "right ceil" closing 0 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
922 ( "+-" sdev 300 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
923 ( "!" 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
924 ( "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
925 ( "u-" neg -1 197 )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
926 ( "times" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
927 ( "*" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
928 ( "2x" * 191 190 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
929 ( "/" / 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
930 ( "%" % 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
931 ( "+" + 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
932 ( "-" - 170 171 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
933 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
934 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
935 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
936 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
937 ( "=" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
938 ( "==" calcFunc-eq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
939 ( "!=" calcFunc-neq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
940 ( "u!" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
941 ( "&&" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
942 ( "||" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
943 ( "?" (math-read-if) 91 90 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
944 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
945 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
946 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
947 ( "<-" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
948 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
949 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
950 ( "->" calcFunc-evalto 40 41 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
951 ( "->" calcFunc-evalto 40 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
952 ( "=>" calcFunc-evalto 40 41 )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
953 ( "=>" calcFunc-evalto 40 -1 )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
954
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
955 (put 'eqn 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
956 '( ( arc\ cos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
957 ( arc\ cosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
958 ( arc\ sin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
959 ( arc\ sinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
960 ( arc\ tan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
961 ( arc\ tanh . calcFunc-arctanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
962 ( GAMMA . calcFunc-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
963 ( phi . calcFunc-totient )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
964 ( mu . calcFunc-moebius )
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
965 ( matrix . (math-parse-eqn-matrix) )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
966
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
967 (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
968 '((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
969
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
970 (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
971 '((?\{ . ?\()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
972 (?\} . ?\))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
973
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
974 (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
975 '( ( inf . var-uinf )))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
976
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
977 (put 'eqn 'math-complex-format 'i)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
978
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
979 (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
980
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
981 (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
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 (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
984 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
985 (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
986 (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
987 (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
988 (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
989 '("}")))))
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-var-formatter
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
992 (function
86969
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
993 (lambda (a prec)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
994 (let (v)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
995 (if (and math-compose-hash-args
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
996 (let ((p calc-arg-values))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
997 (setq v 1)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
998 (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
999 (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
1000 v (1+ v)))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1001 p))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1002 (if (eq math-compose-hash-args 1)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1003 "#"
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1004 (format "#%d" v))
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1005 (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
1006 (math-compose-expr
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1007 (list 'calcFunc-Prime
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1008 (list
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1009 'var
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1010 (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
1011 (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
1012 prec)
369fadbe988d (math-compose-var): Adjust declaration.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86933
diff changeset
1013 (symbol-name (nth 1 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
1014
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1015 (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
1016 '( 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
1017 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
1018 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
1019 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
1020 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
1021 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
1022 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
1023 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
1024
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1025 (put 'eqn 'math-func-formatter
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1026 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1027 (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
1028 (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
1029 (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
1030 (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
1031 (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
1032 (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
1033 (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
1034 (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
1035 (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
1036 (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
1037 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
1038
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1039 ((and
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1040 (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
1041 (= (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
1042 (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
1043 (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
1044 (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
1045 (t
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 " ( "
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 " )")))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1048 (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
1049 (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
1050 right)))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1051
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1052 (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
1053 '((?\"
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1054 (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
1055 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
1056 (progn
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1057 (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
1058 (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
1059 (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
1060 (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
1061 (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
1062
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1063 (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
1064 '( ("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
1065 ("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
1066 ("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
1067 ("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
1068 ("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
1069 ("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
1070
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1071 (put 'eqn 'math-lang-adjust-words
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1072 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1073 (lambda ()
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1074 (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
1075 (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
1076 ((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
1077 (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
1078 ((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
1079 (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
1080 (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
1081 (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
1082 (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
1083 ((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
1084 (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
1085 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
1086 (t
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 (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
1089
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1090 (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
1091 '((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
1092 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
1093 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
1094 (progn
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1095 (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
1096 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
1097 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
1098 (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
1099 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
1100 (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
1101 (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
1102 (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
1103
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1104
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1105 (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
1106 (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
1107 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1108 (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
1109 ((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
1110 (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
1111 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1112 (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
1113 (cons
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 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1116 (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
1117 (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
1118 (cons
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1119 " } "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1120 (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
1121 nil))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1122
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1123 (defun math-parse-eqn-matrix (f sym)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1124 (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
1125 (while (assoc math-expr-data '(("ccol") ("lcol") ("rcol")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1126 (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
1127 (or (equal math-expr-data calc-function-open)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1128 (throw 'syntax "Expected `{'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1129 (math-read-token)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1130 (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
1131 (or (equal math-expr-data calc-function-close)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1132 (throw 'syntax "Expected `}'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1133 (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
1134 (or (equal math-expr-data calc-function-close)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1135 (throw 'syntax "Expected `}'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1136 (math-read-token)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
1137 (math-transpose (cons 'vec (nreverse vec)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1138
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1139 (defun math-parse-eqn-prime (x sym)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1140 (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
1141 (if (equal math-expr-data calc-function-open)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1142 (progn
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 (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
1145 (eq math-exp-token 'end))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1146 nil
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1147 (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
1148 (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
1149 (eq math-exp-token 'end)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1150 (throw 'syntax "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1151 (math-read-token)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1152 (cons (intern (format "calcFunc-%s'" (nth 1 x))) args)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1153 (list 'var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1154 (intern (concat (symbol-name (nth 1 x)) "'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1155 (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
1156 (list 'calcFunc-Prime x)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1157
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1158 (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
1159 (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
1160 (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
1161 (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
1162 " ... "
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1163 (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
1164 (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
1165
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1166
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1167 ;;; Yacas
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1168
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1169 (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
1170 "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
1171 (interactive)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1172 (calc-wrapper
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1173 (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
1174 (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
1175
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1176 (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
1177
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1178 (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
1179
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1180 (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
1181
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1182 (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
1183 '(( Infinity . var-inf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1184 ( Infinity . var-uinf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1185 ( Undefined . var-nan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1186 ( Pi . var-pi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1187 ( 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
1188 ( GoldenRatio . var-phi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1189 ( Gamma . var-gamma)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1190
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1191 (put 'yacas 'math-parse-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1192 '((("Deriv(" 0 ")" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1193 calcFunc-deriv (var ArgB var-ArgB) (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
1194 (("D(" 0 ")" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1195 calcFunc-deriv (var ArgB var-ArgB) (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
1196 (("Integrate(" 0 ")" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1197 calcFunc-integ (var ArgB var-ArgB)(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
1198 (("Integrate(" 0 "," 0 "," 0 ")" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1199 calcFunc-integ (var ArgD var-ArgD) (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
1200 (var ArgB var-ArgB) (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
1201 (("Subst(" 0 "," 0 ")" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1202 calcFunc-subst (var ArgC var-ArgC) (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
1203 (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
1204 (("Taylor(" 0 "," 0 "," 0 ")" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1205 calcFunc-taylor (var ArgD var-ArgD)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1206 (calcFunc-eq (var ArgA var-ArgA) (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
1207 (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
1208
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1209 (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
1210 '(("+" + 30 30)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1211 ("-" - 30 60)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1212 ("*" * 60 60)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1213 ("/" / 70 70)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1214 ("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
1215 ("^" ^ 80 80)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1216 ("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
1217 ("<<" 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
1218 (">>" 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
1219 ("!" 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
1220 ("!!" 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
1221 ("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
1222 ("=" 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
1223 ("!=" 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
1224 ("<" 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
1225 (">" 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
1226 ("<=" 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
1227 (">=" 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
1228 ("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
1229 ("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
1230 ("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
1231 (":=" 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
1232
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1233 (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
1234 '(( Div . calcFunc-idiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1235 ( Mod . calcFunc-mod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1236 ( Abs . calcFunc-abs)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1237 ( Sign . calcFunc-sign)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1238 ( Sqrt . calcFunc-sqrt)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1239 ( Max . calcFunc-max)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1240 ( Min . calcFunc-min)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1241 ( Floor . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1242 ( Ceil . calcFunc-ceil)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1243 ( Round . calcFunc-round)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1244 ( Conjugate . calcFunc-conj)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1245 ( Arg . calcFunc-arg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1246 ( Re . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1247 ( Im . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1248 ( Rationalize . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1249 ( Sin . calcFunc-sin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1250 ( Cos . calcFunc-cos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1251 ( Tan . calcFunc-tan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1252 ( Sec . calcFunc-sec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1253 ( Csc . calcFunc-csc)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1254 ( Cot . calcFunc-cot)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1255 ( ArcSin . calcFunc-arcsin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1256 ( ArcCos . calcFunc-arccos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1257 ( ArcTan . calcFunc-arctan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1258 ( Sinh . calcFunc-sinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1259 ( Cosh . calcFunc-cosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1260 ( Tanh . calcFunc-tanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1261 ( Sech . calcFunc-sech)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1262 ( Csch . calcFunc-csch)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1263 ( Coth . calcFunc-coth)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1264 ( ArcSinh . calcFunc-arcsinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1265 ( ArcCosh . calcFunc-arccosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1266 ( ArcTanh . calcFunc-arctanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1267 ( Ln . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1268 ( Exp . calcFunc-exp)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1269 ( Gamma . calcFunc-gamma)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1270 ( Gcd . calcFunc-gcd)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1271 ( Lcm . calcFunc-lcm)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1272 ( Bin . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1273 ( Bernoulli . calcFunc-bern)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1274 ( Euler . calcFunc-euler)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1275 ( StirlingNumber1 . calcFunc-stir1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1276 ( StirlingNumber2 . calcFunc-stir2)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1277 ( IsPrime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1278 ( Factors . calcFunc-prfac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1279 ( NextPrime . calcFunc-nextprime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1280 ( Moebius . calcFunc-moebius)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1281 ( Random . calcFunc-random)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1282 ( Concat . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1283 ( Head . calcFunc-head)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1284 ( Tail . calcFunc-tail)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1285 ( Length . calcFunc-vlen)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1286 ( Reverse . calcFunc-rev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1287 ( CrossProduct . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1288 ( Dot . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1289 ( DiagonalMatrix . calcFunc-diag)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1290 ( Transpose . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1291 ( Inverse . calcFunc-inv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1292 ( Determinant . calcFunc-det)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1293 ( Trace . calcFunc-tr)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1294 ( RemoveDuplicates . calcFunc-rdup)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1295 ( Union . calcFunc-vunion)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1296 ( Intersection . calcFunc-vint)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1297 ( Difference . calcFunc-vdiff)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1298 ( Apply . calcFunc-apply)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1299 ( Map . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1300 ( Simplify . calcFunc-simplify)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1301 ( ExpandBrackets . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1302 ( Solve . calcFunc-solve)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1303 ( Degree . calcFunc-pdeg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1304 ( If . calcFunc-if)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1305 ( 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
1306 ( 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
1307 ( 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
1308
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1309 (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
1310 '(( 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
1311 ( 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
1312 ( 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
1313 ( 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
1314 ( 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
1315 ( 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
1316
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1317 (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
1318 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1319 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1320 (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
1321 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1322 (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
1323 "["
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1324 (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
1325 "]")))))
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 (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
1328 "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
1329 (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
1330 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1331 (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
1332 (nth 3 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1333 (nth 0 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1334 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1335 (nth 2 args))))
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-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
1338 "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
1339 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1340 (nth 1 fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1341 "("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1342 (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
1343 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1344 (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
1345 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1346 (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
1347 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1348 (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
1349 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1350
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1351 (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
1352 "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
1353 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1354 (nth 1 fn)
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 2 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1357 (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
1358 ")"
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1359 (concat
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 (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
1362 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1363 (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
1364 ")"))
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 1 a) -1)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1367
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1368 (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
1369 "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
1370 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1371 "Taylor("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1372 (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
1373 (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
1374 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1375 (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
1376 (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
1377 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1378 (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
1379 ") "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1380 (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
1381
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1382
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1383 ;;; Maxima
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 (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
1386 "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
1387 (interactive)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1388 (calc-wrapper
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1389 (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
1390 (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
1391
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1392 (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
1393 '(("+" + 100 100)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1394 ("-" - 100 134)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1395 ("*" * 120 120)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1396 ("." * 130 129)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1397 ("/" / 120 120)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1398 ("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
1399 ("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
1400 ("^" ^ 140 139)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1401 ("**" ^ 140 139)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1402 ("!" 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
1403 ("!!" 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
1404 ("=" 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
1405 ("#" 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
1406 ("<" 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
1407 (">" 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
1408 ("<=" 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
1409 (">=" 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
1410 ("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
1411 ("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
1412 ("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
1413 (":" 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
1414
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1415
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1416 (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
1417 '(( matrix . vec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1418 ( abs . calcFunc-abs)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1419 ( cabs . calcFunc-abs)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1420 ( signum . calcFunc-sign)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1421 ( floor . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1422 ( entier . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1423 ( fix . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1424 ( conjugate . calcFunc-conj )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1425 ( carg . calcFunc-arg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1426 ( realpart . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1427 ( imagpart . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1428 ( rationalize . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1429 ( asin . calcFunc-arcsin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1430 ( acos . calcFunc-arccos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1431 ( atan . calcFunc-arctan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1432 ( atan2 . calcFunc-arctan2)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1433 ( asinh . calcFunc-arcsinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1434 ( acosh . calcFunc-arccosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1435 ( atanh . calcFunc-arctanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1436 ( log . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1437 ( plog . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1438 ( 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
1439 ( 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
1440 ( factorial . calcFunc-fact)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1441 ( binomial . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1442 ( primep . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1443 ( 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
1444 ( 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
1445 ( append . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1446 ( rest . calcFunc-tail)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1447 ( reverse . calcFunc-rev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1448 ( innerproduct . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1449 ( inprod . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1450 ( row . calcFunc-mrow)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1451 ( columnvector . calcFunc-mcol)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1452 ( covect . calcFunc-mcol)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1453 ( transpose . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1454 ( invert . calcFunc-inv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1455 ( determinant . calcFunc-det)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1456 ( mattrace . calcFunc-tr)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1457 ( member . calcFunc-in)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1458 ( lmax . calcFunc-vmax)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1459 ( lmin . calcFunc-vmin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1460 ( distrib . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1461 ( partfrac . calcFunc-apart)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1462 ( rat . calcFunc-nrat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1463 ( product . calcFunc-prod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1464 ( diff . calcFunc-deriv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1465 ( integrate . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1466 ( quotient . calcFunc-pdiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1467 ( remainder . calcFunc-prem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1468 ( divide . calcFunc-pdivrem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1469 ( equal . calcFunc-eq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1470 ( notequal . calcFunc-neq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1471 ( rhs . calcFunc-rmeq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1472 ( 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
1473 ( 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
1474 ( 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
1475
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1476 (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
1477 "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
1478 (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
1479 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1480 (list 'calcFunc-subst
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1481 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1482 (nth 2 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1483 (nth 0 args))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1484
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1485 (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
1486 "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
1487 (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
1488 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1489 (list 'calcFunc-taylor
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1490 (nth 0 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1491 (list 'calcFunc-eq
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1492 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1493 (nth 2 args))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1494 (nth 3 args))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1495
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1496 (put 'maxima 'math-parse-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1497 '((("if" 0 "then" 0 "else" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1498 calcFunc-if
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1499 (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
1500 (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
1501 (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
1502
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1503 (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
1504 '(( 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
1505 ( 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
1506 ( 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
1507
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1508 (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
1509 "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
1510 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1511 "taylor("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1512 (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
1513 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1514 (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
1515 (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
1516 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1517 (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
1518 (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
1519 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1520 (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
1521 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1522
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1523 (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
1524 "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
1525 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1526 "substitute("
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 a) -1)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1528 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1529 (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
1530 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1531 (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
1532 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1533
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1534 (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
1535 "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
1536 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1537 "if "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1538 (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
1539 " then "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1540 (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
1541 " else "
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1542 (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
1543
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1544 (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
1545 '(( infinity . var-uinf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1546 ( %pi . var-pi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1547 ( %e . var-e)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1548 ( %i . var-i)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1549 ( %phi . var-phi)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1550 ( %gamma . var-gamma)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1551
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1552 (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
1553
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1554 (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
1555
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1556 (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
1557
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1558 (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
1559
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1560 (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
1561 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1562 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1563 (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
1564 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1565 (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
1566 "["
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1567 (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
1568 "]")))))
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-matrix-formatter
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 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1574 "matrix("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1575 (math-compose-vector (cdr a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1576 (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
1577 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
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
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1581 ;;; Giac
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1582
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1583 (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
1584 "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
1585 (interactive)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1586 (calc-wrapper
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1587 (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
1588 (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
1589
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1590 (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
1591 '( ( "[" (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
1592 ( "+" + 180 181 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1593 ( "-" - 180 181 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1594 ( "/" / 191 192 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1595 ( "*" * 191 192 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1596 ( "^" ^ 201 200 )
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1597 ( "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
1598 ( "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
1599 ( "!" 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
1600 ( ".." (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
1601 ( "\\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
1602 ( "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
1603 ( "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
1604 ( "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
1605 ( "<" 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
1606 ( ">" 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
1607 ( "<=" 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
1608 ( ">=" 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
1609 ( "=" 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
1610 ( "==" 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
1611 ( "!=" 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
1612 ( "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
1613 ( "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
1614 ( "&&" 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
1615 ( "||" 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
1616 ( "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
1617 ( ":=" 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
1618
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1619
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1620 (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
1621 '(( rdiv . calcFunc-div)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1622 ( iquo . calcFunc-idiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1623 ( irem . calcFunc-mod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1624 ( remain . calcFunc-mod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1625 ( floor . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1626 ( iPart . calcFunc-floor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1627 ( ceil . calcFunc-ceil)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1628 ( ceiling . calcFunc-ceil)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1629 ( re . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1630 ( real . calcFunc-re)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1631 ( im . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1632 ( imag . calcFunc-im)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1633 ( float2rational . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1634 ( exact . calcFunc-pfrac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1635 ( evalf . calcFunc-pfloat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1636 ( bitand . calcFunc-and)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1637 ( bitor . calcFunc-or)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1638 ( bitxor . calcFunc-xor)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1639 ( asin . calcFunc-arcsin)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1640 ( acos . calcFunc-arccos)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1641 ( atan . calcFunc-arctan)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1642 ( asinh . calcFunc-arcsinh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1643 ( acosh . calcFunc-arccosh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1644 ( atanh . calcFunc-arctanh)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1645 ( log . calcFunc-ln)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1646 ( logb . calcFunc-log)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1647 ( factorial . calcFunc-fact)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1648 ( comb . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1649 ( binomial . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1650 ( nCr . calcFunc-choose)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1651 ( perm . calcFunc-perm)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1652 ( nPr . calcFunc-perm)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1653 ( bernoulli . calcFunc-bern)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1654 ( 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
1655 ( isprime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1656 ( isPrime . calcFunc-prime)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1657 ( ifactors . calcFunc-prfac)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1658 ( euler . calcFunc-totient)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1659 ( phi . calcFunc-totient)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1660 ( rand . calcFunc-random)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1661 ( concat . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1662 ( augment . calcFunc-vconcat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1663 ( mid . calcFunc-subvec)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1664 ( length . calcFunc-length)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1665 ( size . calcFunc-length)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1666 ( nops . calcFunc-length)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1667 ( SortA . calcFunc-sort)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1668 ( SortB . calcFunc-rsort)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1669 ( revlist . calcFunc-rev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1670 ( cross . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1671 ( crossP . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1672 ( crossproduct . calcFunc-cross)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1673 ( mul . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1674 ( dot . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1675 ( dotprod . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1676 ( dotP . calcFunc-mul)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1677 ( 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
1678 ( 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
1679 ( row . calcFunc-mrow)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1680 ( col . calcFunc-mcol)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1681 ( dim . calcFunc-mdims)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1682 ( tran . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1683 ( transpose . calcFunc-trn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1684 ( lu . calcFunc-lud)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1685 ( trace . calcFunc-tr)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1686 ( member . calcFunc-in)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1687 ( sum . calcFunc-vsum)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1688 ( add . calcFunc-vsum)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1689 ( product . calcFunc-vprod)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1690 ( mean . calcFunc-vmean)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1691 ( median . calcFunc-vmedian)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1692 ( stddev . calcFunc-vsdev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1693 ( stddevp . calcFunc-vpsdev)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1694 ( variance . calcFunc-vpvar)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1695 ( map . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1696 ( apply . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1697 ( of . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1698 ( zip . calcFunc-map)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1699 ( expand . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1700 ( fdistrib . calcFunc-expand)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1701 ( partfrac . calcFunc-apart)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1702 ( ratnormal . calcFunc-nrat)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1703 ( diff . calcFunc-deriv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1704 ( derive . calcFunc-deriv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1705 ( integrate . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1706 ( int . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1707 ( Int . calcFunc-integ)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1708 ( romberg . calcFunc-ninteg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1709 ( nInt . calcFunc-ninteg)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1710 ( lcoeff . calcFunc-plead)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1711 ( content . calcFunc-pcont)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1712 ( primpart . calcFunc-pprim)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1713 ( quo . calcFunc-pdiv)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1714 ( rem . calcFunc-prem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1715 ( quorem . calcFunc-pdivrem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1716 ( divide . calcFunc-pdivrem)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1717 ( equal . calcFunc-eq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1718 ( ifte . calcFunc-if)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1719 ( not . calcFunc-lnot)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1720 ( rhs . calcFunc-rmeq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1721 ( right . calcFunc-rmeq)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1722 ( 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
1723 ( 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
1724 ( 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
1725
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1726 (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
1727 "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
1728 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
1729 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
1730 (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
1731 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1732 (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
1733 (nth 1 args)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1734 (nth 0 args))))
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 (put 'giac 'math-parse-table
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1737 '((("set" 0)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1738 calcFunc-rdup
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1739 (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
1740
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1741 (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
1742 '((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
1743 (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
1744 (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
1745 (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
1746
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1747 (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
1748 "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
1749 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
1750 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
1751 (list 'horiz (nth 1 fn)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1752 "("
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1753 (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
1754 ","
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1755 (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
1756 ")"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1757
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1758 (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
1759 '(( infinity . var-inf)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1760 ( infinity . var-uinf)))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1761
87471
949048bec87d (math-complex-format): Add giac.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87463
diff changeset
1762 (put 'giac 'math-complex-format 'i)
949048bec87d (math-complex-format): Add giac.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87463
diff changeset
1763
87463
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1764 (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
1765
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1766 (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
1767 (function
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1768 (lambda (a)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1769 (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
1770 (list 'horiz
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1771 (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
1772 "["
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1773 (math-compose-expr
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1774 (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
1775 "]")))))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1776
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1777 (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
1778 (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
1779 (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
1780 (throw 'syntax "Expected ']'"))
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1781 (math-read-token)
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1782 (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
1783
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1784 (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
1785
e2eb28358122 (calc-yacas-language, calc-maxima-language, calc-giac-language)
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87414
diff changeset
1786
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1787 (defun calc-mathematica-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1788 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1789 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1790 (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
1791 (message "Mathematica language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1792
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1793 (put 'math 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1794 '( ( "[[" (math-read-math-subscr) 250 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1795 ( "!" calcFunc-fact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1796 ( "!!" calcFunc-dfact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1797 ( "^" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1798 ( "u+" ident -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1799 ( "u-" neg -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1800 ( "/" / 195 196 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1801 ( "*" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1802 ( "2x" * 190 191 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1803 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1804 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1805 ( "<" calcFunc-lt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1806 ( ">" calcFunc-gt 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1807 ( "<=" calcFunc-leq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1808 ( ">=" calcFunc-geq 160 161 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1809 ( "==" calcFunc-eq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1810 ( "!=" calcFunc-neq 150 151 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1811 ( "u!" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1812 ( "&&" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1813 ( "||" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1814 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1815 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1816 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1817 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1818 ( "=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1819 ( "->" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1820 ( ":>" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1821 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1822 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1823
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1824 (put 'math 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1825 '( ( Abs . calcFunc-abs )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1826 ( ArcCos . calcFunc-arccos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1827 ( ArcCosh . calcFunc-arccosh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1828 ( ArcSin . calcFunc-arcsin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1829 ( ArcSinh . calcFunc-arcsinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1830 ( ArcTan . calcFunc-arctan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1831 ( ArcTanh . calcFunc-arctanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1832 ( Arg . calcFunc-arg )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1833 ( Binomial . calcFunc-choose )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1834 ( Ceiling . calcFunc-ceil )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1835 ( Conjugate . calcFunc-conj )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1836 ( Cos . calcFunc-cos )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1837 ( 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
1838 ( 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
1839 ( 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
1840 ( 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
1841 ( Csch . calcFunc-csch )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1842 ( D . calcFunc-deriv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1843 ( Dt . calcFunc-tderiv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1844 ( Det . calcFunc-det )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1845 ( Exp . calcFunc-exp )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1846 ( EulerPhi . calcFunc-totient )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1847 ( Floor . calcFunc-floor )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1848 ( Gamma . calcFunc-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1849 ( GCD . calcFunc-gcd )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1850 ( If . calcFunc-if )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1851 ( Im . calcFunc-im )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1852 ( Inverse . calcFunc-inv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1853 ( Integrate . calcFunc-integ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1854 ( Join . calcFunc-vconcat )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1855 ( LCM . calcFunc-lcm )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1856 ( Log . calcFunc-ln )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1857 ( Max . calcFunc-max )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1858 ( Min . calcFunc-min )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1859 ( Mod . calcFunc-mod )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1860 ( MoebiusMu . calcFunc-moebius )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1861 ( Random . calcFunc-random )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1862 ( Round . calcFunc-round )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1863 ( 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
1864 ( 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
1865 ( Sech . calcFunc-sech )
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1866 ( Sign . calcFunc-sign )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1867 ( Sin . calcFunc-sin )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1868 ( Sinh . calcFunc-sinh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1869 ( Sqrt . calcFunc-sqrt )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1870 ( Tan . calcFunc-tan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1871 ( Tanh . calcFunc-tanh )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1872 ( Transpose . calcFunc-trn )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1873 ( Length . calcFunc-vlen )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1874 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1875
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1876 (put 'math 'math-variable-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1877 '( ( I . var-i )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1878 ( Pi . var-pi )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1879 ( E . var-e )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1880 ( GoldenRatio . var-phi )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1881 ( EulerGamma . var-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1882 ( Infinity . var-inf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1883 ( ComplexInfinity . var-uinf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1884 ( Indeterminate . var-nan )
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
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1887 (put 'math 'math-vector-brackets "{}")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1888 (put 'math 'math-complex-format 'I)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1889 (put 'math 'math-function-open "[")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1890 (put 'math 'math-function-close "]")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1891
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1892 (put 'math 'math-radix-formatter
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1893 (function (lambda (r s) (format "%d^^%s" r s))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1894
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1895 (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
1896 '((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
1897 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
1898 (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
1899 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
1900 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
1901
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1902 (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
1903 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1904 (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
1905 (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
1906 (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
1907 "[["
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1908 (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
1909 "]]"))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1910
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1911 (defun math-read-math-subscr (x op)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1912 (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
1913 (or (and (equal math-expr-data "]")
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1914 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1915 (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
1916 (equal math-expr-data "]")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1917 (throw 'syntax "Expected ']]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1918 (math-read-token)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
1919 (list 'calcFunc-subscr x idx)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1920
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1921
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1922 (defun calc-maple-language ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1923 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1924 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1925 (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
1926 (message "Maple language mode")))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1927
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1928 (put 'maple 'math-oper-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1929 '( ( "matrix" ident -1 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1930 ( "MATRIX" ident -1 300 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1931 ( "!" calcFunc-fact 210 -1 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1932 ( "^" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1933 ( "**" ^ 201 200 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1934 ( "u+" ident -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1935 ( "u-" neg -1 197 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1936 ( "/" / 191 192 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1937 ( "*" * 191 192 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1938 ( "intersect" calcFunc-vint 191 192 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1939 ( "+" + 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1940 ( "-" - 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1941 ( "union" calcFunc-vunion 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1942 ( "minus" calcFunc-vdiff 180 181 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1943 ( "mod" % 170 170 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1944 ( ".." (math-read-maple-dots) 165 165 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1945 ( "\\dots" (math-read-maple-dots) 165 165 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1946 ( "<" calcFunc-lt 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1947 ( ">" calcFunc-gt 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1948 ( "<=" calcFunc-leq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1949 ( ">=" calcFunc-geq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1950 ( "=" calcFunc-eq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1951 ( "<>" calcFunc-neq 160 160 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1952 ( "not" calcFunc-lnot -1 121 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1953 ( "and" calcFunc-land 110 111 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1954 ( "or" calcFunc-lor 100 101 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1955 ( "!!!" calcFunc-pnot -1 85 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1956 ( "&&&" calcFunc-pand 80 81 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1957 ( "|||" calcFunc-por 75 76 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1958 ( ":=" calcFunc-assign 51 50 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1959 ( "::" calcFunc-condition 45 46 )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1960 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1961
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1962 (put 'maple 'math-function-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1963 '( ( bernoulli . calcFunc-bern )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1964 ( binomial . calcFunc-choose )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1965 ( diff . calcFunc-deriv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1966 ( GAMMA . calcFunc-gamma )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1967 ( ifactor . calcFunc-prfac )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1968 ( igcd . calcFunc-gcd )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1969 ( ilcm . calcFunc-lcm )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1970 ( int . calcFunc-integ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1971 ( modp . % )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1972 ( irem . % )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1973 ( iquo . calcFunc-idiv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1974 ( isprime . calcFunc-prime )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1975 ( length . calcFunc-vlen )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1976 ( member . calcFunc-in )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1977 ( crossprod . calcFunc-cross )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1978 ( inverse . calcFunc-inv )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1979 ( trace . calcFunc-tr )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1980 ( transpose . calcFunc-trn )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1981 ( vectdim . calcFunc-vlen )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1982 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1983
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1984 (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
1985 '((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
1986
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1987 (put 'maple 'math-variable-table
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1988 '( ( I . var-i )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1989 ( Pi . var-pi )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1990 ( E . var-e )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1991 ( infinity . var-inf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1992 ( infinity . var-uinf )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1993 ( infinity . var-nan )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1994 ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1995
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1996 (put 'maple 'math-complex-format 'I)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1997
86932
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
1998 (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
1999 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2000 (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
2001 (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
2002 "matrix("
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2003 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
2004 (math-compose-vector (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
2005 (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
2006 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
2007 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
2008 ")"))))
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2009
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2010 (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
2011 (function
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2012 (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
2013 (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
2014 (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
2015 (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
2016 "["
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-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
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 (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
2021 (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
2022
15347a4d3180 (math-compose-vector, math-compose-var, math-tex-expr-is-flat):
Jay Belanger <jay.p.belanger@gmail.com>
parents: 86475
diff changeset
2023 (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
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 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
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-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
2028
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2029 (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
2030 (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
2031
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2032
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2033 ;; 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
2034 ;; 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
2035 ;; 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
2036 ;; 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
2037 ;; 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
2038 ;; math-read-big-balance.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2039 (defvar math-read-big-lines)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2040
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2041 ;; 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
2042 ;; 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
2043 ;; math-read-big-rec.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2044 (defvar math-read-big-baseline)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2045 (defvar math-read-big-h2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2046
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2047 ;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2048 ;; are local to math-read-big-rec, but are used by math-read-big-char,
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2049 ;; math-read-big-emptyp and math-read-big-balance which are called by
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2050 ;; math-read-big-rec.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2051 ;; 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
2052 ;; which calls math-read-big-balance.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2053 (defvar math-rb-h1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2054 (defvar math-rb-h2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2055 (defvar math-rb-v1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2056 (defvar math-rb-v2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2057
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2058 (defun math-read-big-rec (math-rb-h1 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
2059 &optional baseline prec short)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2060 (or prec (setq prec 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2061
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2062 ;; Clip whitespace above or below.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2063 (while (and (< math-rb-v1 math-rb-v2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2064 (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
2065 (setq math-rb-v1 (1+ math-rb-v1)))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2066 (while (and (< math-rb-v1 math-rb-v2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2067 (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
2068 (setq math-rb-v2 (1- math-rb-v2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2069
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2070 ;; 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
2071 (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
2072 (if (or (<= math-rb-v2 math-rb-v1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2073 (> math-rb-h1 (length (setq math-rb-v2
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2074 (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
2075 (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
2076 (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
2077 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
2078 math-rb-v2 (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
2079 math-rb-h2 (math-read-expr
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2080 (substring math-rb-v2 math-rb-h1
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2081 (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
2082 (if (eq (car-safe math-rb-h2) 'error)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2083 (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2084 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
2085 math-rb-h2))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2086
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2087 ;; Clip whitespace at left or right.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2088 (while (and (< math-rb-h1 math-rb-h2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2089 (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
2090 (setq math-rb-h1 (1+ math-rb-h1)))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2091 (while (and (< math-rb-h1 math-rb-h2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2092 (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
2093 (setq math-rb-h2 (1- math-rb-h2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2094
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2095 ;; Scan to find widest left-justified "----" in the region.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2096 (let* ((widest nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2097 (widest-h2 0)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2098 (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
2099 (p lines-v1)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2100 (v math-rb-v1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2101 (other-v nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2102 other-char line len h)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2103 (while (< v math-rb-v2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2104 (setq line (car p)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2105 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
2106 (and (< math-rb-h1 len)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2107 (/= (aref line math-rb-h1) ?\ )
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2108 (if (and (= (aref line math-rb-h1) ?\-)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2109 ;; Make sure it's not a minus sign.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2110 (or (and (< (1+ math-rb-h1) len)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2111 (= (aref line (1+ math-rb-h1)) ?\-))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2112 (/= (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
2113 (/= (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
2114 (progn
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2115 (setq h math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2116 (while (and (< (setq h (1+ h)) len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2117 (= (aref line h) ?\-)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2118 (if (> h widest-h2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2119 (setq widest v
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2120 widest-h2 h)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2121 (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
2122 (setq v (1+ v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2123 p (cdr p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2124
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2125 (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
2126 (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
2127
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2128 ;; Quotient.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2129 (widest
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2130 (setq h widest-h2
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2131 v widest)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2132 (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
2133 (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
2134 (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
2135 (math-make-frac num den)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2136 (list '/ num den)))))
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 ;; Big radical sign.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2139 ((= other-char ?\\)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2140 (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
2141 (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
2142 (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
2143 (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
2144 (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
2145 (math-read-big-error h v "Malformed root sign"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2146 (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
2147 (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
2148 (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
2149 (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
2150 (+ math-rb-h1 2) (1+ v)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2151 h (1+ other-v) baseline))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2152 v math-read-big-baseline))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2153
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2154 ;; Small radical sign.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2155 ((and (= other-char ?V)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2156 (= (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
2157 (setq h (1+ math-rb-h1))
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 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
2159 (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
2160 (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
2161 (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
2162 (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
2163 (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
2164 v math-read-big-baseline))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2165
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2166 ;; Binomial coefficient.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2167 ((and (= other-char ?\()
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2168 (= (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
2169 (= (string-match "( *)" (nth v math-read-big-lines)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2170 math-rb-h1) math-rb-h1))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2171 (setq h (match-end 0))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2172 (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
2173 (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
2174 (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
2175 (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
2176 (setq p (list 'calcFunc-choose
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2177 (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
2178 (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
2179 (1- h) math-rb-v2))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2180
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2181 ;; Minus sign.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2182 ((= other-char ?\-)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2183 (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2184 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
2185 v math-read-big-baseline
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2186 h math-read-big-h2))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2187
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2188 ;; Parentheses.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2189 ((= other-char ?\()
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2190 (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
2191 (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
2192 (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
2193 (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
2194 (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
2195 (let ((sep (math-read-big-char (1- h) v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2196 hmid)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2197 (if (= sep ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2198 (setq h (1+ h)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2199 (if (= sep ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2200 (math-read-big-error (1- h) v "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2201 (if (= sep ?\))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2202 (setq p (math-read-big-rec
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2203 (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
2204 (setq hmid (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
2205 p (list p
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2206 (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
2207 h hmid)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2208 (cond ((= sep ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2209 (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
2210 (1- h) v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2211 ?\))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2212 0 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2213 p))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2214 ((= (math-read-big-char (1- h) v) ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2215 (math-read-big-error (1- h) v "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2216 ((= sep ?\,)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2217 (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
2218 (math-read-big-error
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2219 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
2220 (setq p (cons 'cplx p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2221 ((= sep ?\;)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2222 (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
2223 (math-read-big-error
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2224 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
2225 (setq p (cons 'polar p)))))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2226
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2227 ;; Matrix.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2228 ((and (= other-char ?\[)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2229 (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
2230 (= (math-read-big-char (setq h (1+ h)) v) ?\[)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2231 (and (= (math-read-big-char h v) ?\ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2232 (= (math-read-big-char (setq h (1+ h)) v) ?\[)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2233 (= (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
2234 (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
2235 (let ((vtop v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2236 (hleft h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2237 (hright nil))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2238 (setq p nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2239 (while (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2240 (setq h (math-read-big-balance (1+ hleft) v "["))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2241 (if hright
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2242 (or (= h hright)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2243 (math-read-big-error hright v "Expected `]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2244 (setq hright h))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2245 (setq p (cons (math-read-big-rec
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2246 hleft v h (1+ v)) p))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2247 (and (memq (math-read-big-char h v) '(?\ ?\,))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2248 (= (math-read-big-char hleft (1+ v)) ?\[)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2249 (setq v (1+ v)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2250 (or (= hleft math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2251 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2252 (if (= (math-read-big-char h v) ?\ )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2253 (setq h (1+ h)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2254 (and (= (math-read-big-char h v) ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2255 (setq h (1+ h))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2256 (math-read-big-error (1- h) v "Expected `]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2257 (if (= (math-read-big-char h vtop) ?\,)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2258 (setq h (1+ h)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2259 (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
2260 (setq v (+ vtop (/ (- v vtop) 2))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2261 p (cons 'vec (nreverse p)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2262
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2263 ;; Square brackets.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2264 ((= other-char ?\[)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2265 (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
2266 (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
2267 (setq p nil
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2268 h (1+ math-rb-h1))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2269 (while (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2270 (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
2271 (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
2272 (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
2273 (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
2274 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
2275 h widest)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2276 (= (math-read-big-char (1- h) v) ?\,)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2277 (setq widest (math-read-big-char (1- h) v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2278 (if (or (memq widest '(?\; ?\)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2279 (and (eq widest ?\.) (cdr p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2280 (math-read-big-error (1- h) v "Expected `]'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2281 (if (= widest ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2282 (setq h (1+ h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2283 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
2284 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
2285 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
2286 h widest
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2287 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
2288 ?\])
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2289 3 2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2290 p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2291 (setq p (cons 'vec (nreverse p)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2292
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2293 ;; Date form.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2294 ((= other-char ?\<)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2295 (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
2296 (string-match ">" line math-rb-h1)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2297 (setq h (match-end 0))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2298 (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
2299 (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
2300 (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
2301
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2302 ;; Variable name or function call.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2303 ((or (and (>= other-char ?a) (<= other-char ?z))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2304 (and (>= other-char ?A) (<= other-char ?Z)))
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 "\\([a-zA-Z'_]+\\) *" 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 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2308 widest (match-end 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2309 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
2310 (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
2311 (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
2312 (if (= (math-read-big-char widest v) ?\()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2313 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2314 (setq line (if (string-match "-" p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2315 (intern p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2316 (intern (concat "calcFunc-" p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2317 h (1+ widest)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2318 p nil)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2319 (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
2320 (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
2321 (while (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2322 (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
2323 (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
2324 (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
2325 (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
2326 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
2327 h widest)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2328 (= (math-read-big-char (1- h) v) ?\,)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2329 (or (= (math-read-big-char (1- h) v) ?\))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2330 (math-read-big-error (1- h) v "Expected `)'"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2331 (setq p (cons line (nreverse p))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2332 (setq p (list 'var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2333 (intern (math-remove-dashes p))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2334 (if (string-match "-" p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2335 (intern p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2336 (intern (concat "var-" p)))))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2337
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2338 ;; Number.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2339 (t
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2340 (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
2341 (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
2342 (math-read-big-error h v "Expected a number"))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2343 (setq h (match-end 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2344 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
2345 (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
2346 (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
2347
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2348 ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2;
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2349 ;; baseline = v.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2350 (if baseline
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2351 (or (= v baseline)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2352 (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
2353 (setq baseline v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2354
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2355 ;; Look for superscripts or subscripts.
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2356 (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
2357 len (min math-rb-h2 (length line))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2358 widest h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2359 (while (and (< widest len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2360 (= (aref line widest) ?\ ))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2361 (setq widest (1+ widest)))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2362 (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
2363 (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
2364 (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
2365 (setq h widest)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2366 (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
2367 h widest))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2368 (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
2369 (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
2370 (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
2371 h widest)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2372
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2373 ;; Look for an operator name and grab additional terms.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2374 (while (and (< h len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2375 (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
2376 h math-rb-v1 (1+ h) v)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2377 (math-read-big-emptyp
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2378 h (1+ v) (1+ h) math-rb-v2)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2379 (string-match "<=\\|>=\\|\\+/-\\|!=\\|&&\\|||\\|:=\\|=>\\|." line h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2380 (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
2381 (math-standard-ops))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2382 (and (>= (nth 2 widest) prec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2383 (setq h (match-end 0)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2384 (and (not (eq (string-match ",\\|;\\|\\.\\.\\|)\\|\\]\\|:" line h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2385 h))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2386 (setq widest '("2x" * 196 195)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2387 (cond ((eq (nth 3 widest) -1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2388 (setq p (list (nth 1 widest) p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2389 ((equal (car widest) "?")
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2390 (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2391 math-rb-v2 baseline nil t)))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2392 (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
2393 (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
2394 (setq p (list (nth 1 widest) p y
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2395 (math-read-big-rec
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2396 (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
2397 baseline (nth 3 widest) t))
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2398 h math-read-big-h2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2399 (t
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2400 (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
2401 (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
2402 baseline (nth 3 widest) t))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2403 h math-read-big-h2))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2404
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2405 ;; 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
2406 (setq math-read-big-baseline baseline
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2407 math-read-big-h2 h)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2408 (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
2409 (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
2410 p)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2411
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2412 (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
2413 (or (and (>= h math-rb-h1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2414 (< h math-rb-h2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2415 (>= v math-rb-v1)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2416 (< v math-rb-v2)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2417 (let ((line (nth v math-read-big-lines)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2418 (and line
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2419 (< h (length line))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2420 (aref line h))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2421 ?\ ))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2422
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2423 (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
2424 (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
2425 (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
2426 (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
2427 (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
2428 (or what (setq what ?\ ))
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2429 (let ((p (nthcdr ev1 math-read-big-lines))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2430 h)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2431 (while (and (< ev1 ev2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2432 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2433 (setq h (min eh2 (length (car p))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2434 (while (and (>= (setq h (1- h)) eh1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2435 (= (aref (car p) h) what)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2436 (and error (>= h eh1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2437 (math-read-big-error h ev1 (if (stringp error)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2438 error
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2439 "Whitespace expected")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2440 (< h eh1)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2441 (setq ev1 (1+ ev1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2442 p (cdr p)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2443 (>= ev1 ev2)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2444
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2445 ;; 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
2446 ;; 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
2447 ;; math-read-big-expr.
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2448 (defvar math-read-big-err-msg)
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2449
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2450 (defun math-read-big-error (h v &optional msg)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2451 (let ((pos 0)
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2452 (p math-read-big-lines))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2453 (while (> v 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2454 (setq pos (+ pos 1 (length (car p)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2455 p (cdr p)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2456 v (1- v)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2457 (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
2458 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
2459 (throw 'syntax nil)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2460
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2461 (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
2462 (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
2463 (len (min math-rb-h2 (length line)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2464 (count 1))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2465 (while (> count 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2466 (if (>= h len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2467 (if what
58411
9ceda393e263 (math-read-big-lines): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58134
diff changeset
2468 (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
2469 (setq count 0))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2470 (if (memq (aref line h) '(?\( ?\[))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2471 (setq count (1+ count))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2472 (if (if (and commas (= count 1))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2473 (or (memq (aref line h) '(?\) ?\] ?\, ?\;))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2474 (and (eq (aref line h) ?\.)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2475 (< (1+ h) len)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2476 (eq (aref line (1+ h)) ?\.)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2477 (memq (aref line h) '(?\) ?\])))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2478 (setq count (1- count))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2479 (setq h (1+ h))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
2480 h))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2481
58661
10224395a3c2 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58571
diff changeset
2482 (provide 'calc-lang)
10224395a3c2 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58571
diff changeset
2483
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
2484 ;;; 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
2485 ;;; calc-lang.el ends here