|
@@ -67,7 +67,7 @@ While the [[id:f3e3cdb9-a661-4598-8be1-e15f587f35bb][Introduction]] describes th
|
|
|
#+TOC: headlines 3
|
|
|
#+TOC: listings
|
|
|
|
|
|
-* WORKING Expression Types [1/4]
|
|
|
+* WORKING Expression Types [2/4]
|
|
|
:PROPERTIES:
|
|
|
:ID: fe611e8f-db42-4fe0-8e77-9cfb55d2227c
|
|
|
:END:
|
|
@@ -108,10 +108,7 @@ Note, by default, ~eqal~ will handle ~type-error~ by trying to switch the order
|
|
|
(defgeneric evaluate (expression &key substitutions-list resolve-constants-light-p resolve-constants-hard-p))
|
|
|
|
|
|
@export
|
|
|
- (defgeneric simplify (expression &key resolve-constants-light-p resolve-constants-hard-p))
|
|
|
-
|
|
|
- @export
|
|
|
- (defgeneric to-sexp (expression &optional resolve-constants-p))
|
|
|
+ (defgeneric simplify (expression &key resolve-constans-light-p resolve-constants-hard-p))
|
|
|
#+END_SRC
|
|
|
|
|
|
#+Caption: Types
|
|
@@ -186,7 +183,7 @@ Of the various types, there are three atomic types, ~<number>~, ~<variable>~ and
|
|
|
#+END_SRC
|
|
|
|
|
|
*** DONE Numbers
|
|
|
-CLOSED: [2019-01-16 Wed 16:01]
|
|
|
+CLOSED: [2019-01-05 Sat 09:56]
|
|
|
:PROPERTIES:
|
|
|
:ID: f0314608-46d9-4cc0-a3e1-897481827ddf
|
|
|
:END:
|
|
@@ -207,14 +204,10 @@ As an ~<atomic>~, ~<number>~ is rather simple, having only one slot, ~value~, re
|
|
|
|
|
|
(defmethod eqal ((expression-a <number>) (expression-b <number>))
|
|
|
(= (value expression-a) (value expression-b)))
|
|
|
-
|
|
|
- (defmethod to-sexp ((expression <number>) &optional resolve-constants-p)
|
|
|
- (declare (ignorable resolve-constants-p))
|
|
|
- (slot-value expression 'value))
|
|
|
#+END_SRC
|
|
|
|
|
|
*** DONE Variables
|
|
|
-CLOSED: [2019-01-16 Wed 16:13]
|
|
|
+CLOSED: [2019-01-05 Sat 09:56]
|
|
|
:PROPERTIES:
|
|
|
:ID: f5f656d0-6253-4c4c-8c50-6622d685eaa1
|
|
|
:END:
|
|
@@ -236,14 +229,10 @@ CLOSED: [2019-01-16 Wed 16:13]
|
|
|
(defmethod eqal ((expression-a <variable>) (expression-b <variable>))
|
|
|
(equalp (value expression-a)
|
|
|
(value expression-b)))
|
|
|
-
|
|
|
- (defmethod to-sexp ((expression <variable>) &optional resolve-constants-p)
|
|
|
- (declare (ignore resolve-constants-p))
|
|
|
- (slot-value expression 'name))
|
|
|
#+END_SRC
|
|
|
|
|
|
*** DONE Constants
|
|
|
-CLOSED: [2019-01-16 Wed 16:23]
|
|
|
+CLOSED: [2019-01-05 Sat 12:07]
|
|
|
:PROPERTIES:
|
|
|
:ID: 806bbce0-ab52-411a-8178-29bda6bbb36a
|
|
|
:END:
|
|
@@ -282,14 +271,9 @@ Equality of constants is a bit different, and is checked as follows:
|
|
|
(defmethod eqal ((expression-a <constant>) (expression-b <number>))
|
|
|
(= (slot-value expression-a 'value)
|
|
|
(slot-value expression-b 'value)))
|
|
|
-
|
|
|
- (defmethod to-sexp ((expression <constant>) &optional resolve-constants-p)
|
|
|
- (if resolve-constants-p
|
|
|
- (slot-value expression 'value)
|
|
|
- (slot-value expression 'name)))
|
|
|
#+END_SRC
|
|
|
|
|
|
-** WORKING Compound Types [0/7]
|
|
|
+** WORKING Compound Types [6/7]
|
|
|
:PROPERTIES:
|
|
|
:ID: a0d2eb19-8a1e-4dee-9b41-c454a49cacc4
|
|
|
:END:
|
|
@@ -307,7 +291,8 @@ Compound types are the majority of expressions. An atom is well and good, but o
|
|
|
nil)
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Additions
|
|
|
+*** DONE Additions
|
|
|
+CLOSED: [2019-01-05 Sat 16:00]
|
|
|
:PROPERTIES:
|
|
|
:ID: a1a01fb4-59e1-4459-9ab9-d32269af77dd
|
|
|
:END:
|
|
@@ -332,7 +317,8 @@ Compound types are the majority of expressions. An atom is well and good, but o
|
|
|
:test #'eqal)))))
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Subtractions
|
|
|
+*** DONE Subtractions
|
|
|
+CLOSED: [2019-01-05 Sat 16:41]
|
|
|
:PROPERTIES:
|
|
|
:ID: aad16971-81c8-48da-aaa5-bb84b03d6912
|
|
|
:END:
|
|
@@ -359,7 +345,8 @@ Subtractions again, contain only a list of terms. However, unlike other types h
|
|
|
((or (not keep) (null a) (null b)) keep)))))
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Multiplications
|
|
|
+*** DONE Multiplications
|
|
|
+CLOSED: [2019-01-05 Sat 12:17]
|
|
|
:PROPERTIES:
|
|
|
:ID: 0c601f5c-a614-4c30-9107-220a5d45a334
|
|
|
:END:
|
|
@@ -382,7 +369,8 @@ Multiplication is one of the more frequently used expression types, and is, surp
|
|
|
:test #'eqal))))
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Divisions
|
|
|
+*** DONE Divisions
|
|
|
+CLOSED: [2019-01-05 Sat 12:25]
|
|
|
:PROPERTIES:
|
|
|
:ID: bcc56ff0-0a6f-4eb6-8185-2cab3eed99da
|
|
|
:END:
|
|
@@ -408,7 +396,8 @@ Division is similar to ~<multiplication>~, although instead of having ~terms~ it
|
|
|
(div-denominator expression-b))))
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Exponentials
|
|
|
+*** DONE Exponentials
|
|
|
+CLOSED: [2019-01-05 Sat 15:28]
|
|
|
:PROPERTIES:
|
|
|
:ID: d8c87457-5c3b-4263-ba60-53b9b9f5e816
|
|
|
:END:
|
|
@@ -445,7 +434,8 @@ There are two primary forms of exponential -- the natural (~exp~) and the genera
|
|
|
:value 2.71828))
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Logarithmics
|
|
|
+*** DONE Logarithmics
|
|
|
+CLOSED: [2019-01-05 Sat 15:47]
|
|
|
:PROPERTIES:
|
|
|
:ID: 7d4a23af-6c6b-4ae3-a8af-e477cbee9082
|
|
|
:END:
|
|
@@ -482,108 +472,10 @@ There are two primary forms of exponential -- the natural (~exp~) and the genera
|
|
|
(log-of expression-b))))
|
|
|
#+END_SRC
|
|
|
|
|
|
-*** WORKING Trigonometric
|
|
|
-:PROPERTIES:
|
|
|
-:ID: adbef278-121d-4ef4-a607-7fc129d4d6ea
|
|
|
-:END:
|
|
|
-
|
|
|
-Trigonemtric functions are also a bit weird -- as given a "normal" trig function, /e.g.,/ $\sin{\theta}$, there's the normal, the inverse, the hyperbolic, and the hyperbolic inverse. As such, we have a superclass for each, and then equality, which checks type and ~eqal~-ness of the inner expression.
|
|
|
-
|
|
|
-#+Caption: Trig Bases
|
|
|
-#+Name: type-trigs
|
|
|
-#+BEGIN_SRC lisp
|
|
|
- @export
|
|
|
- (defclass <trig> (<expression>)
|
|
|
- ((expression :reader expression
|
|
|
- :initarg :expression
|
|
|
- :type <expression>)))
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <inverse-trig> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <hyperbolic-trig> (<trig>) ())
|
|
|
-
|
|
|
- (defmethod eqal ((expression-a <trig>) (expression-b <trig>))
|
|
|
- (and (equalp (type-of expression-a)
|
|
|
- (type-of expression-b))
|
|
|
- (eqal (expression expression-a)
|
|
|
- (expression expression-b))))
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <sin> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <cos> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <tan> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <csc> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <sec> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <cot> (<trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <asin> (<inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <acos> (<inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <atan> (<inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <acsc> (<inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <asec> (<inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <acot> (<inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <sinh> (<hyperbolic-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <cosh> (<hyperbolic-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <tanh> (<hyperbolic-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <csch> (<hyperbolic-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <sech> (<hyperbolic-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <coth> (<hyperbolic-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <asinh> (<hyperbolic-trig> <inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <acosh> (<hyperbolic-trig> <inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <atanh> (<hyperbolic-trig> <inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <acsch> (<hyperbolic-trig> <inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <asech> (<hyperbolic-trig> <inverse-trig>) ())
|
|
|
-
|
|
|
- @export
|
|
|
- (defclass <acoth> (<hyperbolic-trig> <inverse-trig>) ())
|
|
|
-#+END_SRC
|
|
|
+*** TODO Trigonometric
|
|
|
|
|
|
-** WORKING Blended Types -- Polynomial Terms
|
|
|
+** DONE Blended Types -- Polynomial Terms
|
|
|
+CLOSED: [2019-01-05 Sat 09:46]
|
|
|
:PROPERTIES:
|
|
|
:ID: a7258c20-bdd1-4565-9ada-41026ea5e1a0
|
|
|
:END:
|
|
@@ -1490,7 +1382,6 @@ As all of the packages are defined centrally, this makes resolving inter-package
|
|
|
<<type-division>>
|
|
|
<<type-exponentials>>
|
|
|
<<type-logarithmics>>
|
|
|
- <<type-trigs>>
|
|
|
|
|
|
<<type-poly-term>>
|
|
|
#+END_SRC
|