diff --git a/larcs.org b/larcs.org index ef49eec72f6a19bca82ee59a1007e19dec7a575e..46576f299b0a23b21063bcbe15761f7de1a32dea 100644 --- a/larcs.org +++ b/larcs.org @@ -662,14 +662,12 @@ This assembles the classification library, which in the ~#:larcs.classify~ packa <> #+END_SRC -* WORKING Algebraic Manipulation [3/5] +* WORKING Polynomial Related Functions [3/10] :PROPERTIES: -:CREATED: <2016-06-09 Thu 09:20> -:ID: b2c1fd45-b631-48f9-a093-66e1a0faa77f +:CREATED: <2016-05-01 Sun 12:29> +:ID: 984d0f52-4c52-4bfa-a150-f3289d25bdf1 :END: -One of the most important parts of this system is the "algebraic manipulator", a sub-system that provides utilities for symbolic arithmetic, that is to say addition, subtraction, multiplication and division, along with trigonometric functions and exponential/logarithmic functions. These function, as many other portions of this system, using rewrite rules, implementing a form of specialized generic programming. - ** DONE Collect Variables CLOSED: [2016-06-21 Tue 22:10] :PROPERTIES: @@ -707,7 +705,7 @@ An expression is passed in, and if a variable, it is collected, if non-atomic, a [[file:imgs/variable-collection.png]] #+Caption: Collect Variables -#+Name: am-collect-variables +#+Name: poly-collect-variables #+BEGIN_SRC lisp (defun collect-variables (expression) (let ((variables '())) @@ -722,86 +720,7 @@ An expression is passed in, and if a variable, it is collected, if non-atomic, a (reverse variables))) #+END_SRC -** DONE Term Collection -CLOSED: [2016-06-24 Fri 20:57] -:PROPERTIES: -:CREATED: <2016-04-30 Sat 22:59> -:ID: c1856735-914b-4f73-8825-3e5a062113d2 -:END: - -To aid in the design and implementation of various sub-systems, from simplification to the basics of algebraic manipulators, the ability to collect terms is extremely important. It is accomplished as follows: - - 1. Lists for each of the types are initialized as empty. - 2. For each term in the given expression, put it into the given list. - 3. Return an alist containing the names of the types and the given lists, with the conses removed if the CDR is null. - -#+Caption: Collect Terms -#+Name: am-collect-terms -#+BEGIN_SRC lisp - (defun collect-terms (expression &aux (terms (rest expression))) - (let ((numerics '()) - (variables '()) - (additives '()) - (subtractives '()) - (multiplicatives '()) - (polynomial-terms '()) - (rationals '()) - (powers '()) - (natural-exponentials '()) - (exponentials '()) - (natural-logarithmics '()) - (trigonometrics '())) - (dolist (term terms) - (classification-case term - (numeric (pushnew term numerics)) - (variable (pushnew term variables)) - (power (pushnew term powers)) - (additive (pushnew term additives)) - (subtractive (pushnew term subtractives)) - (polynomial-term (pushnew term polynomial-terms)) - (multiplicative (pushnew term multiplicatives)) - (rational (pushnew term rationals)) - (power (pushnew term powers)) - (natural-exponential (pushnew term natural-exponentials)) - (exponential (pushnew term exponentials)) - (natural-logarithmic (pushnew term natural-logarithmics)) - (trigonometric (pushnew term trigonometrics)))) - (remove-if #'(lambda (expr) (null (cdr expr))) - (list (cons :numerics numerics) - (cons :variables variables) - (cons :powers powers) - (cons :additives additives) - (cons :subtractives subtractives) - (cons :multiplicatives multiplicatives) - (cons :polynomial-terms polynomial-terms) - (cons :rationals rationals) - (cons :powers powers) - (cons :natural-exponentials natural-exponentials) - (cons :exponentials exponentials) - (cons :natural-logarithmics natural-logarithmics) - (cons :trigonometrics trigonometrics))))) -#+END_SRC - -** WORKING Polynomial Related Functions [2/8] -:PROPERTIES: -:CREATED: <2016-05-01 Sun 12:29> -:ID: 984d0f52-4c52-4bfa-a150-f3289d25bdf1 -:END: - -#+Caption: Polynomial Related Functions -#+Name: am-polynomial-related-functions -#+BEGIN_SRC lisp - <> - <> - <> - <> - <> - <> - <> - <> -#+END_SRC - -*** DONE Get Coefficient +** DONE Get Coefficient CLOSED: [2016-06-26 Sun 19:50] :PROPERTIES: :CREATED: <2016-05-31 Tue 19:08> @@ -815,7 +734,7 @@ To get the coefficient of a polynomial term there are three possibilities - All else :: 1 #+Caption: Get Coefficient -#+Name: am-get-coefficient +#+Name: poly-get-coefficient #+BEGIN_SRC lisp (defun coefficient (term) (when (classified-as-p term 'polynomial-term) @@ -825,7 +744,7 @@ To get the coefficient of a polynomial term there are three possibilities (* 1)))) #+END_SRC -*** DONE Get Term Variables +** DONE Get Term Variables CLOSED: [2016-06-27 Mon 18:40] :PROPERTIES: :CREATED: <2016-05-31 Tue 19:08> @@ -835,21 +754,21 @@ CLOSED: [2016-06-27 Mon 18:40] The ability to retrieve tha variable in a polynomial term is important. This is accomplished by collecting the variables in the term and returning the first. If this is simply a numeric expression, ~nil~ is returned as there are no variables. #+Caption: Get Term Variable -#+Name: am-get-term-variable +#+Name: poly-get-term-variable #+BEGIN_SRC lisp (defun term-variable (term) (when (classified-as-p term 'polynomial-term) (first (collect-variables term)))) #+END_SRC -*** TODO Get Power +** TODO Get Power :PROPERTIES: :CREATED: <2016-05-31 Tue 19:08> :ID: 7d5a10da-bb30-496f-b285-470057a46db0 :END: #+Caption: Get Power -#+Name: am-get-power +#+Name: poly-get-power #+BEGIN_SRC lisp (defun get-power (term) (classification-case term @@ -863,76 +782,165 @@ The ability to retrieve tha variable in a polynomial term is important. This is (* 0))) #+END_SRC -*** TODO Term Order Less Than +** TODO Term Order Less Than :PROPERTIES: :CREATED: <2016-06-24 Fri 20:57> :ID: b7fcb056-2494-4142-aad5-7619629b1980 :END: #+Caption: Term Order Less Than -#+Name: am-term-order-less-than +#+Name: poly-term-order-less-than #+BEGIN_SRC lisp (defun term-order-< (a b) (< (get-power a) (get-power b))) #+END_SRC -*** TODO Same Order +** TODO Same Order :PROPERTIES: :CREATED: <2016-05-31 Tue 19:08> :ID: c56a1496-f4c2-4693-9448-5043570a752f :END: #+Caption: Same Order -#+Name: am-same-order +#+Name: poly-same-order #+BEGIN_SRC lisp (defun term-order-= (term-a term-b) (= (get-power term-a) (get-power term-b))) #+END_SRC -*** TODO Term Order Greater Than +** TODO Term Order Greater Than :PROPERTIES: :CREATED: <2016-06-24 Fri 20:57> :ID: 27f836aa-8522-4a4c-88b3-6f19a505916f :END: #+Caption: Term Order Greater Than -#+Name: am-term-order-greater-than +#+Name: poly-term-order-greater-than #+BEGIN_SRC lisp (defun term-order-> (a b) (> (get-power a) (get-power b))) #+END_SRC -*** TODO Same Variable +** TODO Same Variable :PROPERTIES: :CREATED: <2016-05-31 Tue 19:08> :ID: 3806c97a-12fa-4488-b38c-d9ff3570c139 :END: #+Caption: Same Variable -#+Name: am-same-variable +#+Name: poly-same-variable #+BEGIN_SRC lisp (defun same-variable-p (term-a term-b) (eq (term-variable term-a) (term-variable term-b))) #+END_SRC -*** TODO Is Combinable +** TODO Is Combinable :PROPERTIES: :CREATED: <2016-05-31 Tue 19:08> :ID: db0410aa-bb12-4933-9be7-1a50d70ae90f :END: #+Caption: Is Combinable -#+Name: am-is-combinable +#+Name: poly-is-combinable #+BEGIN_SRC lisp (defun single-term-combinable-p (term-a term-b) (and (term-order-= term-a term-b) (same-variable-p term-a term-b))) #+END_SRC +** TODO Assembly +:PROPERTIES: +:CREATED: <2016-08-21 Sun 11:03> +:ID: 0c64cf6f-818d-4d39-9dc3-ab9353a6d66e +:END: + +#+Caption: Polynomial Related Functions +#+Name: poly-assembly +#+BEGIN_SRC lisp :tangle "larcs-polynomials.lisp" + (in-package #:larcs.polynomials) + <> + <> + <> + <> + <> + <> + <> + <> + <> +#+END_SRC + +* WORKING Algebraic Manipulation [3/5] +:PROPERTIES: +:CREATED: <2016-06-09 Thu 09:20> +:ID: b2c1fd45-b631-48f9-a093-66e1a0faa77f +:END: + +One of the most important parts of this system is the "algebraic manipulator", a sub-system that provides utilities for symbolic arithmetic, that is to say addition, subtraction, multiplication and division, along with trigonometric functions and exponential/logarithmic functions. These function, as many other portions of this system, using rewrite rules, implementing a form of specialized generic programming. + +** DONE Term Collection +CLOSED: [2016-06-24 Fri 20:57] +:PROPERTIES: +:CREATED: <2016-04-30 Sat 22:59> +:ID: c1856735-914b-4f73-8825-3e5a062113d2 +:END: + +To aid in the design and implementation of various sub-systems, from simplification to the basics of algebraic manipulators, the ability to collect terms is extremely important. It is accomplished as follows: + + 1. Lists for each of the types are initialized as empty. + 2. For each term in the given expression, put it into the given list. + 3. Return an alist containing the names of the types and the given lists, with the conses removed if the CDR is null. + +#+Caption: Collect Terms +#+Name: am-collect-terms +#+BEGIN_SRC lisp + (defun collect-terms (expression &aux (terms (rest expression))) + (let ((numerics '()) + (variables '()) + (additives '()) + (subtractives '()) + (multiplicatives '()) + (polynomial-terms '()) + (rationals '()) + (powers '()) + (natural-exponentials '()) + (exponentials '()) + (natural-logarithmics '()) + (trigonometrics '())) + (dolist (term terms) + (classification-case term + (numeric (pushnew term numerics)) + (variable (pushnew term variables)) + (power (pushnew term powers)) + (additive (pushnew term additives)) + (subtractive (pushnew term subtractives)) + (polynomial-term (pushnew term polynomial-terms)) + (multiplicative (pushnew term multiplicatives)) + (rational (pushnew term rationals)) + (power (pushnew term powers)) + (natural-exponential (pushnew term natural-exponentials)) + (exponential (pushnew term exponentials)) + (natural-logarithmic (pushnew term natural-logarithmics)) + (trigonometric (pushnew term trigonometrics)))) + (remove-if #'(lambda (expr) (null (cdr expr))) + (list (cons :numerics numerics) + (cons :variables variables) + (cons :powers powers) + (cons :additives additives) + (cons :subtractives subtractives) + (cons :multiplicatives multiplicatives) + (cons :polynomial-terms polynomial-terms) + (cons :rationals rationals) + (cons :powers powers) + (cons :natural-exponentials natural-exponentials) + (cons :exponentials exponentials) + (cons :natural-logarithmics natural-logarithmics) + (cons :trigonometrics trigonometrics))))) +#+END_SRC + ** WORKING Expression Manipulators [0/7] :PROPERTIES: :CREATED: <2016-04-30 Sat 22:58> @@ -1371,7 +1379,6 @@ This is the assembly of the ~#:larcs.manipulate~ package. It includes, in corre <> <> <> - <> <> #+END_SRC @@ -2319,7 +2326,7 @@ The final assembly of this portion of the system is as simple as the rest, resol :ID: 89370949-8f58-41cf-8c4f-92f81d48ac23 :END: -** WORKING Package Definitions [0/5] +** WORKING Package Definitions [0/6] :PROPERTIES: :CREATED: <2016-06-13 Mon 15:00> :ID: 573a8352-8cbe-408c-8c27-3cf0b66da885 @@ -2330,6 +2337,7 @@ The final assembly of this portion of the system is as simple as the rest, resol #+BEGIN_SRC lisp :tangle "larcs-packages.lisp" <> <> + <> <> <> <> @@ -2374,6 +2382,31 @@ The final assembly of this portion of the system is as simple as the rest, resol (:nicknames #:classify)) #+END_SRC +*** TODO Polynomial Functions +:PROPERTIES: +:CREATED: <2016-08-21 Sun 10:58> +:ID: c97b187c-22c8-4332-902e-3be2247b277e +:END: + +#+Caption: Polynomial Package Definition +#+Name: polynomial-package-def +#+BEGIN_SRC lisp + (defpackage #:larcs.polynomials + (:use #:cl + #:larcs.common + #:larcs.classify) + (:export #:collect-variables + #:coefficient + #:term-variable + #:get-power + #:term-order-< + #:term-order-= + #:term-order-> + #:save-variable-p + #:single-term-combinable-p) + (:nicknames #:polynomials)) +#+END_SRC + *** TODO Manipulation :PROPERTIES: :CREATED: <2016-08-05 Fri 22:07> @@ -2386,20 +2419,12 @@ The final assembly of this portion of the system is as simple as the rest, resol (defpackage #:larcs.manipulate (:use #:cl #:larcs.common - #:larcs.classify) + #:larcs.classify + #:larcs.polynomials) (:import-from #:alexandria #:symbolicate) (:export #:manipulate - #:collect-variables - #:collect-terms - #:coefficient - #:term-variable - #:get-power - #:term-order-< - #:term-order-= - #:term-order-> - #:save-variable-p - #:single-term-combinable-p) + #:collect-terms) (:nicknames #:manipulate)) #+END_SRC @@ -2416,7 +2441,8 @@ The final assembly of this portion of the system is as simple as the rest, resol (:use #:cl #:larcs.common #:larcs.classify - #:larcs.manipulate) + #:larcs.manipulate + #:larcs.polynomials) (:import-from #:alexandria #:symbolicate) (:import-from #:com.informatimago.common-lisp.cesarum.list @@ -2439,7 +2465,8 @@ The final assembly of this portion of the system is as simple as the rest, resol (:use #:cl #:larcs.common #:larcs.classify - #:larcs.manipulate) + #:larcs.manipulate + #:larcs.polynomials) (:import-from #:alexandria #:symbolicate) (:import-from #:com.informatimago.common-lisp.cesarum.list @@ -2468,6 +2495,7 @@ The final assembly of this portion of the system is as simple as the rest, resol :components ((:file "larcs-packages") (:file "larcs-common") (:file "larcs-classify") + (:file "larcs-polynomials") (:file "larcs-manipulation") (:file "larcs-differentiate") (:file "larcs-typeset")))