From: Robert D. <rob...@us...> - 2016-06-24 01:21:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Maxima CAS". The branch, master has been updated via 9ad3f2f09bb1a1499f9d76338b4a0a557259dd33 (commit) via b1a14c3d1f3f5bda1df853c8bef6cefe88dd5884 (commit) via f6cf5718d2558c8127e597cc9ad2930bf0ecf21f (commit) via 472c3eafca87856df55e41f96e6abd52f8e8d747 (commit) via 8dc9f504a0b63f483ede9f99bebc6487727ab01d (commit) via a57ff0cda4cae4bb17b74c5a975abbb005011b83 (commit) via 76bcb5a74b2ee2684a156128510b28744a543046 (commit) via 2247c1f2029a9dfea20879abe34566e59759456a (commit) via 9203cc3c941db2f0eea9d7e49dfaad85ad693e7d (commit) from 7310a179bd7b4bef53d493fa7fd869bd16182634 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9ad3f2f09bb1a1499f9d76338b4a0a557259dd33 Author: Robert Dodier <rob...@us...> Date: Thu Jun 23 14:02:59 2016 -0700 Test for SF bug #3090: "erfi switches sign at approximately -0.476 and 0.476" This tests commits 2247c1f and b1a14c3. diff --git a/tests/rtest_gamma.mac b/tests/rtest_gamma.mac index 62c7ece..e3443bd 100755 --- a/tests/rtest_gamma.mac +++ b/tests/rtest_gamma.mac @@ -3728,3 +3728,19 @@ true; (fpprec:oldfpprec,done); done; +/* SF bug #3090: "erfi switches sign at approximately -0.476 and 0.476" */ + +block + (kill (x, L1, L2), + x : makelist (i/10.0, i, -20, 20), + L1 : makelist (erfi (x1), x1, x), + L2 : makelist (-%i*erf (%i*x1), x1, x), + every (lambda ([x1, x2], x1 = x2), L1, L2)); +true; + +every (lambda ([x1, e1], sign(x1) = sign(e1)), x, L1); +true; + +every (lambda ([x1, e1], sign(x1) = sign(e1)), x, L2); +true; + commit b1a14c3d1f3f5bda1df853c8bef6cefe88dd5884 Author: Robert Dodier <rob...@us...> Date: Wed Jun 22 15:26:05 2016 -0700 In COMPLEX-ERF, be careful about sqrt(z^2)/z for pure imaginary z. This (along with commits 9203cc3 and 2247c1f) fix SF bug #3090: "erfi switches sign at approximately -0.476 and 0.476" diff --git a/src/gamma.lisp b/src/gamma.lisp index af1251c..0b7183b 100755 --- a/src/gamma.lisp +++ b/src/gamma.lisp @@ -1952,7 +1952,7 @@ ;; erf(z) = sqrt(z^2)/z*(1 - gamma_incomplete(1/2,z^2)/sqrt(%pi)) ;; ;; When z is real sqrt(z^2)/z is signum(z). For complex z, -;; sqrt(z^2)/z = 1 if abs(arg(z)) <= %pi/2 and -1 otherwise. +;; sqrt(z^2)/z = 1 if -%pi/2 < arg(z) <= %pi/2 and -1 otherwise. ;; ;; This relationship has serious round-off issues when z is small ;; because gamma_incomplete(1/2,z^2)/sqrt(%pi) is near 1. @@ -1964,7 +1964,7 @@ (defun complex-erf (z) (let ((result (* - (if (< (realpart z) 0.0) + (if (or (< (realpart z) 0.0) (and (= (realpart z) 0.0) (< (imagpart z) 0.0))) -1 1) (- 1.0 commit f6cf5718d2558c8127e597cc9ad2930bf0ecf21f Author: Robert Dodier <rob...@us...> Date: Wed Jun 22 11:50:57 2016 -0700 In share directories, remove generated documentation files from Git. Remove foo.info and foo-index.lisp from Git and add rules to Makefile.am to generate these files via 'make dist' and 'make install'. Existing foo.pdf and foo.html are not affected by this commit, although ideally those will be removed from Git as well. diff --git a/share/contrib/integration/Makefile.am b/share/contrib/integration/Makefile.am index ef8991a..6d23123 100644 --- a/share/contrib/integration/Makefile.am +++ b/share/contrib/integration/Makefile.am @@ -7,3 +7,7 @@ abs_integrate.info: abs_integrate.texi integration-index.lisp: abs_integrate.info perl $(top_srcdir)/doc/info/build_index.pl $< > $@ + +info_TEXINFOS = abs_integrate.texi + +EXTRA_DIST = integration-index.lisp diff --git a/share/contrib/integration/abs_integrate.info b/share/contrib/integration/abs_integrate.info deleted file mode 100644 index d6fe671..0000000 --- a/share/contrib/integration/abs_integrate.info +++ /dev/null @@ -1,317 +0,0 @@ -This is abs_integrate.info, produced by makeinfo version 6.0 from -abs_integrate.texi. - - -File: abs_integrate.info, Node: Top, Next: Introduction to abs_integrate, Prev: (dir), Up: (dir) - -abs_integrate -************* - -* Menu: - -* Introduction to abs_integrate:: -* Definitions for abs_integrate:: -* Function and variable index:: - -1 abs_integrate -*************** - - -File: abs_integrate.info, Node: Introduction to abs_integrate, Next: Definitions for abs_integrate, Prev: Top, Up: Top - -1.1 Introduction to abs_integrate -================================= - -The package 'abs_integrate' extends Maxima's integration code to some -integrands that involve the absolute value, max, min, signum, or unit -step functions. For integrands of the form p(x) |q(x)|, where p is a -polynomial and q is a polynomial that 'factor' is able to factor into a -product of linear or constant terms, the 'abs_integrate' package -determines an antiderivative that is continuous on the entire real line. -Additionally, for an integrand that involves one or more parameters, the -function 'conditional_integrate' tries to determine an antiderivative -that is valid for all parameter values. - - Examples To use the 'abs_integrate' package, you'll first need to -load it: - (%i1) load("abs_integrate.mac")$ - - (%i2) integrate(abs(x),x); - (%o2) (x^2*signum(x))/2 - To convert (%o2) into an expression involving the absolute value -function, apply 'signum_to_abs'; thus - (%i3) signum_to_abs(%); - (%o3) (x*abs(x))/2 - When the integrand has the form p(x) |x - c1| |x - c2| ... |x - cn|, -where p(x) is a polynomial and c1, c2, ..., cn are constants, the -'abs_integrate' package returns an antiderivative that is valid on the -entire real line; thus without making assumptions on a and b; for -example - (%i4) factor(convert_to_signum(integrate(abs((x-a)*(x-b)),x,a,b))); - (%o4) ((b-a)^3*signum(b-a)^2)/6 - - Additionally, 'abs_integrate' is able to find antiderivatives of some -integrands involving 'max, min, signum', and 'unit_step'; examples: - (%i5) integrate(max(x,x^2),x); - (%o5) signum(x-1)*((x^3*signum(x))/6-1/6)+signum(x-1)*(1/4-(x^2*signum(x))/4)+x^3/6+x^2/4 - - (%i6) integrate(signum(x) - signum(1-x),x); - (%o6) x*signum(x)+(x-1)*signum(x-1) - A plot indicates that indeed (%o5) and (%o6) are continuous at zero -and at one. - - For definite integrals with numerical integration limits (including -both minus and plus infinity), the 'abs_integrate' package converts the -integrand to signum form and then it tries to subdivide the integration -region so that the integrand simplifies to a non-signum expression on -each subinterval; for example - (%i1) integrate(1 / (1 + abs(x-5)),x,-5,6); - (%o1) log(11)+log(2) - - Finally, 'abs_integrate' is able to determine antiderivatives of -_some_ functions of the form F(x, |x - a|); examples - (%i2) integrate(1/(1 + abs(x)),x); - (%o2) ((signum(x)+1)*log(x+1))/2-(log(1-x)*(1-signum(x)))/2 - - (%i3) integrate(cos(x + abs(x)),x); - (%o3) ((signum(x)+1)*sin(2*x)-2*x*signum(x)+2*x)/4 - - Barton Willis (Professor of Mathematics, University of Nebraska at -Kearney) wrote the 'abs_integrate' package and its English language user -documentation. This documentation also describes the 'partition' -package for integration. Richard Fateman wrote 'partition'. Additional -documentation for 'partition' is located at -http://www.cs.berkeley.edu/~fateman/papers/partition.pdf. - - To use 'load(abs_integrate)' - - -File: abs_integrate.info, Node: Definitions for abs_integrate, Next: Function and variable index, Prev: Introduction to abs_integrate, Up: Top - -1.2 Definitions for abs_integrate -================================= - - -- Option: extra_integration_methods - Default value: '['signum_int, 'abs_integrate_use_if]' - - The list 'extra_integration_methods' is a list of functions for - integration. When 'integrate' is unable to find an antiderivative, - Maxima uses the methods in 'extra_integration_methods' to attempt - to determine an antiderivative. - - Each function 'f' in 'extra_integration_methods' should have the - form 'f(integrand, variable)'. The function 'f' may either return - 'false' to indicate failure, or it may return an expression - involving an integration noun form. The integration methods are - tried from the first to the last member of - 'extra_integration_methods'; when no method returns an expression - that does not involve an integration noun form, the value of the - integral is the last value that does not fail (or a pure noun form - if all methods fail). - - When the function 'abs_integrate_use_if' is successful, it returns - a conditional expression; for example - (%i2) integrate(1/(1 + abs(x+1) + abs(x-1)),x); - (%o2) %if(-(x+1)>0,-log(1-2*x)/2+log(3)-2/3,%if(-(x-1)>0,x/3+log(3)/2-1/3,log(2*x+1)/2)) - - (%i3) integrate(exp(-abs(x-1) - abs(x)),x); - (%o3) %if(-x>0,%e^(2*x-1)/2-2*%e^(-1),%if(-(x-1)>0,%e^(-1)*x-(3*%e^(-1))/2,-%e^(1-2*x)/2)) - For definite integration, these conditional expressions can cause - trouble: - (%i4) integrate(exp(-abs(x-1) - abs(x)),x, minf,inf); - (%o4) limit(%if(-x>0,(%e^(-1)*(%e^(2*x)-4))/2,%if(-(x-1)>0,(%e^(-1)*(2*x-3))/2,-%e^(1-2*x)/2)),x,inf,minus)-limit(%if(-x>0,(%e^(-1)*(%e^(2*x)-4))/2,%if(-(x-1)>0,(%e^(-1)*(2*x-3))/2,-%e^(1-2*x)/2)),x,-inf,plus) - For such definite integrals, try disallowing the method - 'abs_integrate_use_if': - (%i9) integrate(exp(-abs(x-1) - abs(x)),x, minf,inf), extra_integration_methods : ['signum_int]; - (%o9) 2*%e^(-1) - - Related options extra_definite_integration_methods - - To use 'load(abs_integrate)' - - -- Option: extra_definite_integration_methods - Default value: '['abs_defint]' - - The list 'extra_definite_integration_methods' is a list of extra - functions for definite integration. When 'integrate' is unable to - find a definite integral, Maxima uses the methods in - 'extra_definite_integration_methods' to attempt to determine an - antiderivative. - - Each function 'f' in 'extra_definite_integration_methods' should - have the form 'f(integrand, variable, lo, hi)', where 'lo' and 'hi' - are the lower and upper limits of integration, respectively. The - function 'f' may either return 'false' to indicate failure, or it - may return an expression involving an integration noun form. The - integration methods are tried from the first to the last member of - 'extra_definite_integration_methods'; when no method returns an - expression that does not involve an integration noun form, the - value of the integral is the last value that does not fail (or a - pure noun form if all methods fail). - - Related options extra_integration_methods - - To use 'load(abs_integrate)' - - -- Function: intfudu(<e>, <x>) - - This function uses the derivative divides rule for integrands of - the form f(w(x)) * diff(w(x),x) When 'infudu' is unable to find an - antiderivative, it returns false. - - (%i1) intfudu(cos(x^2) * x,x); - (%o1) sin(x^2)/2 - - (%i3) intfudu(x * sqrt(1+x^2),x); - (%o3) (x^2+1)^(3/2)/3 - - (%i4) intfudu(x * sqrt(1 + x^4),x); - (%o4) false - - For the last example, the derivative divides rule fails, so - 'intfudu' returns false. - - A hashed array 'intable' contains the antiderivative data. To - append a fact to the hash table, say integrate(f) = g, do this: - - (%i1) intable[f] : lambda([u], [g(u),diff(u,%voi)]); - (%o1) lambda([u],[g(u),diff(u,%voi)]) - - (%i2) intfudu(f(z),z); - (%o2) g(z) - - (%i3) intfudu(f(w(x)) * diff(w(x),x),x); - (%o3) g(w(x)) - - An alternative to calling 'intfudu' directly is to use the - 'extra_integration_methods' mechanism; an example: - (%i1) load("abs_integrate.mac")$ - (%i2) load(basic)$ - (%i3) load("partition.mac")$ - - (%i4) integrate(bessel_j(1,x^2) * x,x); - (%o4) integrate(bessel_j(1,x^2)*x,x) - - (%i5) push('intfudu, extra_integration_methods)$ - - (%i6) integrate(bessel_j(1,x^2) * x,x); - (%o6) -bessel_j(0,x^2)/2 - - To use 'load(partition)' - - Additional documentation - http://www.cs.berkeley.edu/~fateman/papers/partition.pdf - - Related functions intfugudu - - -- Function: intfugudu (<e>, <x>) - - This function uses the derivative divides rule for integrands of - the form f(w(x)) * g(w(x)) * diff(w(x),x). When 'infudu' is unable - to find an antiderivative, it returns false. - - (%i1) diff(jacobi_sn(x,2/3),x); - (%o1) jacobi_cn(x,2/3)*jacobi_dn(x,2/3) - - (%i2) intfugudu(%,x); - (%o2) jacobi_sn(x,2/3) - - (%i3) diff(jacobi_dn(x^2,a),x); - (%o3) -2*a*x*jacobi_cn(x^2,a)*jacobi_sn(x^2,a) - - (%i4) intfugudu(%,x); - (%o4) jacobi_dn(x^2,a) - - For a method for automatically calling 'infugudu' from 'integrate', - see the documentation for 'intfudu'. - - To use 'load(partition)' - - Additional documentation - http://www.cs.berkeley.edu/~fateman/papers/partition.pdf - - Related functions intfudu - - -- Function: signum_to_abs (<e>) - - This function replaces subexpressions of the form q signum(q) by - abs(q). Before it does these substitutions, it replaces - subexpressions of the form signum(p) * signum(q) by signum(p * q); - examples: - - (%i1) map('signum_to_abs, [x * signum(x), x * y * signum(x)* signum(y)/2]); - (%o1) [abs(x),(abs(x)*abs(y))/2] - To use 'load(abs_integrate)' - - -- Function: conditional_integrate (<e>, <x>) - - For an integrand with one or more parameters, this function tries - to determine an antiderivative that is valid for all parameter - values. When successful, this function returns a conditional - expression for the antiderivative. - - (%i1) conditional_integrate(cos(m*x),x); - (%o1) %if(m#0,sin(m*x)/m,x) - - (%i2) conditional_integrate(cos(m*x)*cos(x),x); - (%o2) %if((m-1#0) %and (m+1#0),-((m-1)*cos((m+1)*x)+(m+1)*cos((m-1)*x))/(2*m^2-2),(sin(2*x)+2*x)/4) - - (%i3) sublis([m=6],%); - (%o3) -(5*cos(7*x)+7*cos(5*x))/70 - - (%i4) conditional_integrate(exp(a*x^2+b*x),x); - (%o4) %if(a#0,-(sqrt(%pi)*%e^(-b^2/(4*a))*erf((2*a*x+b)/(2*sqrt(-a))))/(2*sqrt(-a)),%if(b#0,%e^(b*x)/b,x)) - - -- Function: convert_to_signum (<e>) - - This function replaces subexpressions of the form abs(q), - unit_step(q), min(q1,q2, ..., qn) and max(q1,q2, ..., qn) by - equivalent signum terms. - - (%i1) map('convert_to_signum, [abs(x), unit_step(x), max(a,2), min(a,2)]); - (%o1) [x*signum(x),(signum(x)+1)/2,((a-2)*signum(a-2)+a+2)/2,(-(a-2)*signum(a-2)+a+2)/2] - - To convert 'unit_step' to signum form, the function - 'convert_to_signum' uses unit_step(x) = (1 + signum(x))/2. - - To use 'load(abs_integrate)' - - Related functions signum_to_abs - - -File: abs_integrate.info, Node: Function and variable index, Prev: Definitions for abs_integrate, Up: Top - -Appendix A Function and variable index -************************************** - --* Menu: - -* conditional_integrate: Definitions for abs_integrate. - (line 158) -* convert_to_signum: Definitions for abs_integrate. - (line 177) -* intfudu(<e>,: Definitions for abs_integrate. - (line 68) -* intfugudu: Definitions for abs_integrate. - (line 119) -* signum_to_abs: Definitions for abs_integrate. - (line 147) - --* Menu: - -* extra_definite_integration_methods: Definitions for abs_integrate. - (line 44) -* extra_integration_methods: Definitions for abs_integrate. - (line 6) - - - -Tag Table: -Node: Top87 -Node: Introduction to abs_integrate363 -Node: Definitions for abs_integrate3492 -Node: Function and variable index11059 - -End Tag Table diff --git a/share/contrib/integration/integration-index.lisp b/share/contrib/integration/integration-index.lisp deleted file mode 100644 index 3b38ad8..0000000 --- a/share/contrib/integration/integration-index.lisp +++ /dev/null @@ -1,18 +0,0 @@ -(in-package :cl-info) -(let ( -(deffn-defvr-pairs '( -; CONTENT: (<INDEX TOPIC> . (<FILENAME> <BYTE OFFSET> <LENGTH IN CHARACTERS> <NODE NAME>)) -("conditional_integrate" . ("abs_integrate.info" 9670 806 "Definitions for abs_integrate")) -("convert_to_signum" . ("abs_integrate.info" 10477 582 "Definitions for abs_integrate")) -("extra_definite_integration_methods" . ("abs_integrate.info" 5744 1135 "Definitions for abs_integrate")) -("extra_integration_methods" . ("abs_integrate.info" 3710 2033 "Definitions for abs_integrate")) -("intfudu(<e>," . ("abs_integrate.info" 6880 1541 "Definitions for abs_integrate")) -("intfugudu" . ("abs_integrate.info" 8422 826 "Definitions for abs_integrate")) -("signum_to_abs" . ("abs_integrate.info" 9249 420 "Definitions for abs_integrate")) -)) -(section-pairs '( -; CONTENT: (<NODE NAME> . (<FILENAME> <BYTE OFFSET> <LENGTH IN CHARACTERS>)) -("Definitions for abs_integrate" . ("abs_integrate.info" 3642 7417)) -("Introduction to abs_integrate" . ("abs_integrate.info" 489 3003)) -))) -(load-info-hashtables (maxima::maxima-load-pathname-directory) deffn-defvr-pairs section-pairs)) diff --git a/share/contrib/maxima-odesolve/Makefile.am b/share/contrib/maxima-odesolve/Makefile.am index 410488f..ca5ee4d 100644 --- a/share/contrib/maxima-odesolve/Makefile.am +++ b/share/contrib/maxima-odesolve/Makefile.am @@ -8,3 +8,7 @@ kovacicODE.info: kovacicODE.texi maxima-odesolve-index.lisp: kovacicODE.info perl $(top_srcdir)/doc/info/build_index.pl $< > $@ + +info_TEXINFOS = kovacicODE.texi + +EXTRA_DIST = maxima-odesolve-index.lisp diff --git a/share/draw/Makefile.am b/share/draw/Makefile.am index 72ff08f..f6a9eb2 100644 --- a/share/draw/Makefile.am +++ b/share/draw/Makefile.am @@ -7,3 +7,7 @@ drawutils.info: drawutils.texi draw-index.lisp: drawutils.info perl $(top_srcdir)/doc/info/build_index.pl $< > $@ + +info_TEXINFOS = drawutils.texi + +EXTRA_DIST = draw-index.lisp diff --git a/share/draw/draw-index.lisp b/share/draw/draw-index.lisp deleted file mode 100644 index ffd6f0a..0000000 --- a/share/draw/draw-index.lisp +++ /dev/null @@ -1,12 +0,0 @@ -(in-package :cl-info) -(let ( -(deffn-defvr-pairs '( -; CONTENT: (<INDEX TOPIC> . (<FILENAME> <BYTE OFFSET> <LENGTH IN CHARACTERS> <NODE NAME>)) -("plot_vector_field" . ("drawutils.info" 786 766 "Vector fields")) -("plot_vector_field3d" . ("drawutils.info" 1553 858 "Vector fields")) -("vennplot" . ("drawutils.info" 2913 314 "Venn diagrams")) -)) -(section-pairs '( -; CONTENT: (<NODE NAME> . (<FILENAME> <BYTE OFFSET> <LENGTH IN CHARACTERS>)) -))) -(load-info-hashtables (maxima::maxima-load-pathname-directory) deffn-defvr-pairs section-pairs)) diff --git a/share/draw/drawutils.info b/share/draw/drawutils.info deleted file mode 100644 index cd00496..0000000 Binary files a/share/draw/drawutils.info and /dev/null differ diff --git a/share/logic/Makefile.am b/share/logic/Makefile.am index fbb945d..5385377 100644 --- a/share/logic/Makefile.am +++ b/share/logic/Makefile.am @@ -7,3 +7,7 @@ logic.info: logic.texi logic-index.lisp: logic.info perl ../../doc/info/build_index.pl $< > $@ + +info_TEXINFOS = logic.texi + +EXTRA_DIST = logic-index.lisp diff --git a/share/logic/logic-index.lisp b/share/logic/logic-index.lisp deleted file mode 100644 index d444c89..0000000 --- a/share/logic/logic-index.lisp +++ /dev/null @@ -1,28 +0,0 @@ -(in-package :cl-info) -(let ( -(deffn-defvr-pairs '( -; CONTENT: (<INDEX TOPIC> . (<FILENAME> <BYTE OFFSET> <LENGTH IN CHARACTERS> <NODE NAME>)) -("boolean_form" . ("logic.info" 11592 541 "Definitions for logic")) -("characteristic_vector" . ("logic.info" 3038 1297 "Definitions for logic")) -("closed_under_f" . ("logic.info" 6415 397 "Definitions for logic")) -("closed_under_t" . ("logic.info" 6813 394 "Definitions for logic")) -("demorgan" . ("logic.info" 12134 380 "Definitions for logic")) -("dual_function" . ("logic.info" 5618 353 "Definitions for logic")) -("functionally_complete" . ("logic.info" 8945 626 "Definitions for logic")) -("linear" . ("logic.info" 8341 603 "Definitions for logic")) -("logic_basis" . ("logic.info" 9572 1437 "Definitions for logic")) -("logic_diff" . ("logic.info" 11010 581 "Definitions for logic")) -("logic_equiv" . ("logic.info" 4886 731 "Definitions for logic")) -("logic_simp" . ("logic.info" 2376 661 "Definitions for logic")) -("monotonic" . ("logic.info" 7208 1132 "Definitions for logic")) -("pcnf" . ("logic.info" 12763 226 "Definitions for logic")) -("pdnf" . ("logic.info" 12515 247 "Definitions for logic")) -("self_dual" . ("logic.info" 5972 442 "Definitions for logic")) -("zhegalkin_form" . ("logic.info" 4336 549 "Definitions for logic")) -)) -(section-pairs '( -; CONTENT: (<NODE NAME> . (<FILENAME> <BYTE OFFSET> <LENGTH IN CHARACTERS>)) -("Definitions for logic" . ("logic.info" 2324 10665)) -("Introduction to logic" . ("logic.info" 385 1813)) -))) -(load-info-hashtables (maxima::maxima-load-pathname-directory) deffn-defvr-pairs section-pairs)) diff --git a/share/logic/logic.info b/share/logic/logic.info deleted file mode 100644 index d6288dc..0000000 --- a/share/logic/logic.info +++ /dev/null @@ -1,441 +0,0 @@ -This is logic.info, produced by makeinfo version 6.0 from logic.texi. - - -File: logic.info, Node: Top, Next: Introduction to logic, Prev: (dir), Up: (dir) - -logic -***** - -* Menu: - -* Introduction to logic:: -* Definitions for logic:: -* Function and variable index:: - -1 logic -******* - - -File: logic.info, Node: Introduction to logic, Next: Definitions for logic, Prev: Top, Up: Top - -1.1 Introduction to logic -========================= - -This is a draft version of logic algebra package for Maxima. It is -being developed by Alexey Beshenov (al...@be...). All source code is -available uder the terms of GNU GPL 2.1. - - List of recognized operators: - -Operator Type Binding Description Properties - power ----------------------------------------------------------------------------- -'not' Prefix '70' Logical NOT (negation) -'and' N-ary '65' Logical AND (conjunction) Commutative -'nand' N-ary '62' Sheffer stroke (alternative Commutative - denial, NAND) -'nor' N-ary '61' Webb-operation or Peirce arrow Commutative - (Quine's dagger, NOR) -'or' N-ary '60' Logical OR (disjunction) Commutative -'implies' Infix '59' Implication -'eq' N-ary '58' Equivalence Commutative -'xor' N-ary '58' Sum modulo 2 (exclusive or) Commutative - -1.2 TeX output -============== - -logic.mac assigns the following TeX output: - -'not' - '\neg' -'and' - '\wedge' -'nand' - '\mid' -'nor' - '\downarrow' -'or' - '\vee' -'implies' - '\rightarrow' -'eq' - '\sim' -'xor' - '\oplus' - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) tex (a implies b)$ - $$a \rightarrow b$$ - (%i3) tex ((a nor b) nand c)$ - $$\left(a \downarrow b\right) \mid c$$ - (%i4) tex (zhegalkin_form (a or b or c))$ - $$a \wedge b \wedge c \oplus a \wedge b \oplus a \wedge c \oplus b - \wedge c \oplus a \oplus b \oplus c$$ - (%i5) tex (boolean_form (a implies b implies c)); - $$ \neg \left( \neg a \vee b\right) \vee c$$ - (%i6) tex (a eq b eq c); - $$a \sim b \sim c$$ - - - -File: logic.info, Node: Definitions for logic, Next: Function and variable index, Prev: Introduction to logic, Up: Top - -1.3 Definitions for logic -========================= - - -- Function: logic_simp (<expr>) - - Returns a simplified version of logical expression <expr>. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) logic_simp (a or (b or false or (a or b))); - (%o2) a or b - (%i3) logic_simp (b eq a eq false eq true); - (%o3) eq a eq b false - (%i4) logic_simp ((a xor true) xor b xor true); - (%o4) a xor b - - The function applies only basic simplification rules without - introducing new functions. - - N.B. It should be merged somehow with the basic Maxima simplifier. - - -- Function: characteristic_vector (<expr>, <var_1>, ..., <var_n>) - - Returns a list of size 2^n with all possible values of <expr>. - - For example, 'characteristic_vector (f(x,y,z), x, y, z)' is - equivalent to list - - [ - f (false, false, false), - f (false, false, true), - f (false, true, false), - f (false, true, true), - f ( true, false, false), - f ( true, false, true), - f ( true, true, false), - f ( true, true, true) - ] - - If '<var_1>, ..., <var_n>' is omitted, it is assumed that - - [<var_1>, ..., <var_n>] = sort(listofvars(<expr>)) - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) characteristic_vector (true); - (%o2) [true] - (%i3) characteristic_vector (a xor b); - (%o3) [false, true, true, false] - (%i4) characteristic_vector (a implies b); - (%o4) [true, true, false, true] - (%i5) characteristic_vector (a implies b, a, b); - (%o5) [true, true, false, true] - (%i6) characteristic_vector (a implies b, b, a); - (%o6) [true, false, true, true] - - -- Function: zhegalkin_form (<expr>) - - Returns the representation of <expr> in Zhegalkin basis '{xor, and, - true}'. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) zhegalkin_form (a or b or c); - (%o2) (a and b and c) xor (a and b) xor (a and c) - xor (b and c) xor a xor b xor c - (%i3) zhegalkin_form ((a implies b) or c); - (%o3) (a and b and c) xor (a and b) xor (a and c) xor a - xor true - - -- Function: logic_equiv (<expr_1>, <expr_2>) - - Returns 'true' if <expr_1> is equivalent to <expr_2> and 'false' - otherwise. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) e : ((a or b) xor c) and d$ - (%i3) zhegalkin_form (e); - (%o3) (a and b and d) xor (a and d) xor (b and d) - xor (c and d) - (%i4) logic_equiv (%i2, %o3); - (%o4) true - (%i5) is (characteristic_vector(%i2) = characteristic_vector(%o3)); - (%o5) true - (%i6) logic_equiv (x and y eq x, x implies y); - (%o6) true - - -- Function: dual_function (<expr>) - - dual_function (f (x_1, ..., x_n)) := not f (not x_1, ..., not x_n). - - Example: - - (%i1) load ("logic.mac")$ - (%i2) dual_function (x or y); - (%o2) not ((not x) or (not y)) - (%i3) demorgan (%); - (%o3) x and y - - -- Function: self_dual (<expr>) - Returns 'true' if <expr> is equivalent to 'dual_function (<expr>)' - and 'false' otherwise. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) self_dual (a); - (%o2) true - (%i3) self_dual (not a); - (%o3) true - (%i4) self_dual (a eq b); - (%o4) false - - -- Function: closed_under_f (<expr>) - 'closed_under_f (f (x_1, ..., x_n)' returns 'true' if 'f (false, - ..., false) = false' and 'false' otherwise. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) closed_under_f (x and y); - (%o2) true - (%i3) closed_under_f (x or y); - (%o3) true - - -- Function: closed_under_t (<expr>) - 'closed_under_t (f (x_1, ..., x_n)' returns 'true' if 'f (true, - ..., true) = true' and 'false' otherwise. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) closed_under_t (x and y); - (%o2) true - (%i3) closed_under_t (x or y); - (%o3) true - - -- Function: monotonic (<expr>) - Returns 'true' if characteristic vector of <expr> is monotonic, - i.e. - - charvec : characteristic_vector(expr) - charvec[i] <= charvec[i+1], i = 1, ..., n-1 - - where 'a<=b := (a=b or (a=false and b=true))'. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) monotonic (a or b); - (%o2) true - (%i3) monotonic (a and b); - (%o3) true - (%i4) monotonic (a implies b); - (%o4) false - (%i5) monotonic (a xor b); - (%o5) false - (%i6) characteristic_vector (a or b); - (%o6) [false, true, true, true] - (%i7) characteristic_vector (a and b); - (%o7) [false, false, false, true] - (%i8) characteristic_vector (a implies b); - (%o8) [true, true, false, true] - (%i9) characteristic_vector (a xor b); - (%o9) [false, true, true, false] - - -- Function: linear (<expr>) - Returns 'true' if 'zhegalkin_form(<expr>)' is linear and 'false' - otherwise. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) linear (a or b); - (%o2) false - (%i3) linear (a eq b); - (%o3) true - (%i4) zhegalkin_form (a or b); - (%o4) (a and b) xor a xor b - (%i5) zhegalkin_form (a eq b); - (%o5) a xor b xor true - - Linear functions are also known as counting or alternating - functions. - - -- Function: functionally_complete (<expr_1>, ..., <expr_n>) - Returns 'true' if <expr_1>, ..., <expr_n> is a functionally - complete system and 'false' otherwise. The constants are essential - (see the example below). - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) functionally_complete (x and y, x xor y); - (%o2) false - (%i3) functionally_complete (x and y, x xor y, true); - (%o3) true - (%i4) functionally_complete (x and y, x or y, not x); - (%o4) true - - -- Function: logic_basis (<expr_1>, ..., <expr_n>) - Returns 'true' if <expr_1>, ..., <expr_n> is a functionally - complete system without redundant elements and 'false' otherwise. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) logic_basis (x and y, x or y); - (%o2) false - (%i3) logic_basis (x and y, x or y, not x); - (%o3) false - (%i4) logic_basis (x and y, not x); - (%o4) true - (%i5) logic_basis (x or y, not x); - (%o5) true - (%i8) logic_basis (x and y, x xor y, true); - (%o8) true - - All possible bases: - - (%i1) load ("logic.mac")$ - (%i2) logic_functions : { not x, x nand y, x nor y, - x implies y, x and y, x or y, - x eq y, x xor y, true, false }$ - (%i3) subset (powerset(logic_functions), - lambda ([s], apply ('logic_basis, listify(s)))); - (%o3) {{false, x eq y, x and y}, {false, x eq y, x or y}, - {false, x implies y}, {true, x xor y, x and y}, - {true, x xor y, x or y}, {not x, x implies y}, - {not x, x and y}, {not x, x or y}, - {x eq y, x xor y, x and y}, {x eq y, x xor y, x or y}, - {x implies y, x xor y}, {x nand y}, {x nor y}} - - -- Function: logic_diff (<f>, <x>) - Returns the logic derivative df/dx of f wrt x. - - logic_diff (f (x_1, ..., x_k, ..., x_n), x_k) := - f (x_1, ..., true, ..., x_n) xor - f (x_1, ..., false, ..., x_n) - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) logic_diff (a or b or c, a); - (%o2) (b and c) xor b xor c xor true - (%i3) logic_diff (a and b and c, a); - (%o3) b and c - (%i4) logic_diff (a or (not a), a); - (%o4) false - - -- Function: boolean_form (<expr>) - - Returns the representation of <expr> in Boolean basis '{and, or, - not}'. - - Examples: - - (%i1) load ("logic.mac")$ - (%i2) boolean_form (a implies b implies c); - (%o2) (not ((not a) or b)) or c - (%i3) demorgan (%); - (%o3) ((not b) and a) or c - (%i4) logic_equiv (boolean_form (a implies b implies c), - zhegalkin_form (a implies b implies c)); - (%o4) true - - -- Function: demorgan (<expr>) - - Applies De Morgan's rules to <expr>: - - not (x_1 and ... and x_n) => (not x_1 or ... or not x_n) - not (x_1 or ... or x_n) => (not x_1 and ... and not x_n) - - Example: - - (%i1) load ("logic.mac")$ - (%i2) demorgan (boolean_form (a nor b nor c)); - (%o2) (not a) and (not b) and (not c) - - -- Function: pdnf (<expr>) - - Returns the perfect disjunctive normal form of <expr>. - - Example: - - (%i1) load ("logic.mac")$ - (%i2) pdnf (x implies y); - (%o2) (x and y) or ((not x) and y) or ((not x) and (not y)) - - -- Function: pcnf (<expr>) - - Returns the perfect conjunctive normal form of <expr>. - - Example: - - (%i1) load ("logic.mac")$ - (%i2) pcnf (x implies y); - (%o2) (not x) or y - - -File: logic.info, Node: Function and variable index, Prev: Definitions for logic, Up: Top - -Appendix A Function and variable index -************************************** - --* Menu: - -* boolean_form: Definitions for logic. - (line 258) -* characteristic_vector: Definitions for logic. - (line 25) -* closed_under_f: Definitions for logic. - (line 121) -* closed_under_t: Definitions for logic. - (line 133) -* demorgan: Definitions for logic. - (line 274) -* dual_function: Definitions for logic. - (line 95) -* functionally_complete: Definitions for logic. - (line 193) -* linear: Definitions for logic. - (line 174) -* logic_basis: Definitions for logic. - (line 208) -* logic_diff: Definitions for logic. - (line 241) -* logic_equiv: Definitions for logic. - (line 76) -* logic_simp: Definitions for logic. - (line 6) -* monotonic: Definitions for logic. - (line 145) -* pcnf: Definitions for logic. - (line 297) -* pdnf: Definitions for logic. - (line 287) -* self_dual: Definitions for logic. - (line 107) -* zhegalkin_form: Definitions for logic. - (line 61) - - - -Tag Table: -Node: Top71 -Node: Introduction to logic283 -Node: Definitions for logic2198 -Node: Function and variable index12989 - -End Tag Table commit 472c3eafca87856df55e41f96e6abd52f8e8d747 Merge: 8dc9f50 7310a17 Author: Robert Dodier <rob...@us...> Date: Wed Jun 22 11:36:26 2016 -0700 Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code commit 8dc9f504a0b63f483ede9f99bebc6487727ab01d Merge: a57ff0c f73f6b5 Author: Robert Dodier <rob...@us...> Date: Mon Jun 20 16:37:35 2016 -0700 Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code commit a57ff0cda4cae4bb17b74c5a975abbb005011b83 Author: Robert Dodier <rob...@us...> Date: Sat Jun 11 13:23:09 2016 -0700 Add test for SF bug #3170: "Error in simtran" (already fixed by commit 3e4e107). diff --git a/tests/rtest15.mac b/tests/rtest15.mac index eaf1d78..e15ecde 100644 --- a/tests/rtest15.mac +++ b/tests/rtest15.mac @@ -1415,3 +1415,15 @@ true; /* Test changevar for summation */ changevar(sum(a[N-1-r]*x^r, r, 0, N-1), s = N-1-r, s, r); sum(a[s]*x^(N-1-s), s, 0, N-1); + +/* SF bug report #3170: "Error in simtran" */ + +(A:matrix([-2,1,1],[1,-2,1],[1,1,-2]), + simtran(A))$ +[[[-3,0],[2,1]], + [[[1/sqrt(2),0,-1/sqrt(2)],[0,1/sqrt(2),-1/sqrt(2)]], + [[1/sqrt(3),1/sqrt(3),1/sqrt(3)]]]]$ + +leftmatrix . A . rightmatrix $ +matrix([-3,0,0],[0,-3,0],[0,0,0])$ + commit 76bcb5a74b2ee2684a156128510b28744a543046 Merge: 2247c1f 5b5e352 Author: Robert Dodier <rob...@us...> Date: Sat Jun 11 13:12:21 2016 -0700 Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code commit 2247c1f2029a9dfea20879abe34566e59759456a Author: Robert Dodier <rob...@us...> Date: Sun May 22 23:23:59 2016 -0700 In COMPLEX-ERF, compute z^2 via (* Z Z) instead of (EXPT Z 2.0) since for some Lisps, the latter yields a small spurious imaginary part when Z is pure imaginary. In GAMMA-INCOMPLETE, squash signed zeros by adding zero. In rtest_gamma, adjust a test tolerance to ensure test passes on all Lisps. diff --git a/src/gamma.lisp b/src/gamma.lisp index 3e3eaae..d22cc49 100755 --- a/src/gamma.lisp +++ b/src/gamma.lisp @@ -783,6 +783,8 @@ ;;; Maxima returns the numercial result for gamma_incomplete_regularized (defun gamma-incomplete (a x &optional (regularized nil)) + (setq x (+ x (cond ((complexp x) #C(0.0 0.0)) ((realp x) 0.0)))) + (let ((factor ;; Compute the factor needed to scale the series or continued ;; fraction. This is x^a*exp(-x) or x^a*exp(-x)/gamma(a) @@ -1966,7 +1968,7 @@ -1 1) (- 1.0 - (* (/ (sqrt (float pi))) (gamma-incomplete 0.5 (expt z 2.0))))))) + (* (/ (sqrt (float pi))) (gamma-incomplete 0.5 (* z z))))))) (cond ((= (imagpart z) 0.0) ;; Pure real argument, the result is real diff --git a/tests/rtest_gamma.mac b/tests/rtest_gamma.mac index 7a40310..62c7ece 100755 --- a/tests/rtest_gamma.mac +++ b/tests/rtest_gamma.mac @@ -2502,7 +2502,7 @@ closeto( erf(-0.75+%i), (-1.372897192365736489613456241111589390954675856186764729607156305b0 + 0.539788632227100129936591912063260716699852732091113612337142798b0*%i), - 5.0e-15); + 6.0e-15); true; closeto( commit 9203cc3c941db2f0eea9d7e49dfaad85ad693e7d Author: Robert Dodier <rob...@us...> Date: Sun May 22 14:59:15 2016 -0700 Revert commit 8f10856 in preparation for another attempt to fix COMPLEX-ERF. diff --git a/src/gamma.lisp b/src/gamma.lisp index 3ab4359..3e3eaae 100755 --- a/src/gamma.lisp +++ b/src/gamma.lisp @@ -1950,7 +1950,7 @@ ;; erf(z) = sqrt(z^2)/z*(1 - gamma_incomplete(1/2,z^2)/sqrt(%pi)) ;; ;; When z is real sqrt(z^2)/z is signum(z). For complex z, -;; sqrt(z^2)/z = 1 if -%pi/2 < arg(z) <= %pi/2 and -1 otherwise. +;; sqrt(z^2)/z = 1 if abs(arg(z)) <= %pi/2 and -1 otherwise. ;; ;; This relationship has serious round-off issues when z is small ;; because gamma_incomplete(1/2,z^2)/sqrt(%pi) is near 1. @@ -1959,26 +1959,14 @@ ;; bfloats, and complex-bfloat-erf is for complex bfloats. Care is ;; taken to return real results for real arguments and imaginary ;; results for imaginary arguments -;; -;; Pure imaginary z with Im(z) < 0 causes trouble for Lisp implementations -;; which recognize signed zero, so just avoid Im(z) < 0 altogether. - (defun complex-erf (z) - (if (< (imagpart z) 0.0) - (conjugate (complex-erf-upper-half-plane (conjugate z))) - (complex-erf-upper-half-plane z))) - -(defun complex-erf-upper-half-plane (z) (let ((result (* - (if (< (realpart z) 0.0) ;; only test needed in upper half plane + (if (< (realpart z) 0.0) -1 1) (- 1.0 - ;; GAMMA-INCOMPLETE returns conjugate when z is pure imaginary - ;; with Im(z) < 0 and Lisp implementation recognizes signed zero. - ;; Good thing we are in the upper half plane. - (* (/ (sqrt (float pi))) (gamma-incomplete 0.5 (* z z))))))) + (* (/ (sqrt (float pi))) (gamma-incomplete 0.5 (expt z 2.0))))))) (cond ((= (imagpart z) 0.0) ;; Pure real argument, the result is real diff --git a/tests/rtest_gamma.mac b/tests/rtest_gamma.mac index 62c7ece..7a40310 100755 --- a/tests/rtest_gamma.mac +++ b/tests/rtest_gamma.mac @@ -2502,7 +2502,7 @@ closeto( erf(-0.75+%i), (-1.372897192365736489613456241111589390954675856186764729607156305b0 + 0.539788632227100129936591912063260716699852732091113612337142798b0*%i), - 6.0e-15); + 5.0e-15); true; closeto( ----------------------------------------------------------------------- Summary of changes: share/contrib/integration/Makefile.am | 4 + share/contrib/integration/abs_integrate.info | 317 ---------------- share/contrib/integration/integration-index.lisp | 18 - share/contrib/maxima-odesolve/Makefile.am | 4 + share/draw/Makefile.am | 4 + share/draw/draw-index.lisp | 12 - share/draw/drawutils.info | Bin 3806 -> 0 bytes share/logic/Makefile.am | 4 + share/logic/logic-index.lisp | 28 -- share/logic/logic.info | 441 ---------------------- src/gamma.lisp | 16 +- tests/rtest15.mac | 12 + tests/rtest_gamma.mac | 16 + 13 files changed, 47 insertions(+), 829 deletions(-) delete mode 100644 share/contrib/integration/abs_integrate.info delete mode 100644 share/contrib/integration/integration-index.lisp delete mode 100644 share/draw/draw-index.lisp delete mode 100644 share/draw/drawutils.info delete mode 100644 share/logic/logic-index.lisp delete mode 100644 share/logic/logic.info hooks/post-receive -- Maxima CAS |