|
From: peterpall <pet...@us...> - 2026-05-13 18:01:38
|
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 8c6f19d1709d065dac9f4926ec80658f158b4afc (commit)
from 2325bc155430b654a6bdc9656dac4e2f74d2b1e4 (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 8c6f19d1709d065dac9f4926ec80658f158b4afc
Author: Gunter Königsmann <gu...@pe...>
Date: Wed May 13 19:56:26 2026 +0200
wrstcse: The results of an extensive code review.
- Corrected some comments and warning messages
- Work to avoid variable name collisions
- toltaylor's result was wrong for orders 2 and up
- Another try to make wc_mintypmax map over equations
- wc_mintypmax_num actually uses the optional argument
- Removed debug code
diff --git a/share/contrib/rtest_wrstcse.mac b/share/contrib/rtest_wrstcse.mac
index 1f9f2e1e2..61b7cd517 100644
--- a/share/contrib/rtest_wrstcse.mac
+++ b/share/contrib/rtest_wrstcse.mac
@@ -184,7 +184,7 @@ is(R_1>100);
unknown;
wc_toltaylor(sin(tol[1])+cos(tol[2]),20);
-tol[2]^20/20-tol[2]^18/18+tol[2]^16/16-tol[2]^14/14+tol[2]^12/12-tol[2]^10/10+tol[2]^8/8-tol[2]^6/6+tol[2]^4/4-tol[2]^2/2-tol[1]^19/19+tol[1]^17/17-tol[1]^15/15+tol[1]^13/13-tol[1]^11/11+tol[1]^9/9-tol[1]^7/7+tol[1]^5/5-tol[1]^3/3+tol[1]+1;
+tol[2]^20/2432902008176640000-tol[2]^18/6402373705728000+tol[2]^16/20922789888000-tol[2]^14/87178291200+tol[2]^12/479001600-tol[2]^10/3628800+tol[2]^8/40320-tol[2]^6/720+tol[2]^4/24-tol[2]^2/2-tol[1]^19/121645100408832000+tol[1]^17/355687428096000-tol[1]^15/1307674368000+tol[1]^13/6227020800-tol[1]^11/39916800+tol[1]^9/362880-tol[1]^7/5040+tol[1]^5/120-tol[1]^3/6+tol[1]+1
(kill(R_1),done);
done;
diff --git a/share/contrib/wrstcse.mac b/share/contrib/wrstcse.mac
index 5d70a4d29..f2bf88019 100644
--- a/share/contrib/wrstcse.mac
+++ b/share/contrib/wrstcse.mac
@@ -1,7 +1,7 @@
/* %wc_tols lists all tol[n] contained in the list, nested list
or equation it gets as its argument. */
-%wc_tols(wc_x):=block([vars,retval:[]],
+%wc_tols(wc_x):=block([vars,retval:[],i],
/* A list of all variables contained in wc_x */
vars:listofvars(wc_x),
for i in vars do
@@ -39,7 +39,7 @@ wc_tolappend([x]):=block([wc_usedTols:[],wc_tolCntr:1,retval:[]],
if numberp(wc_arg) then
if wc_arg >= wc_tolCntr then wc_tolCntr:wc_arg+1,
- /* Iterate over all parameters f this function */
+ /* Iterate over all parameters of this function */
for wc_param in x do
(
/* Iterate over all tol[n] of this parameter*/
@@ -49,7 +49,6 @@ wc_tolappend([x]):=block([wc_usedTols:[],wc_tolCntr:1,retval:[]],
if member(wc_arg,wc_usedTols) then
/* It is already in use => substitute it by a new one. */
(
- disp(used=wc_arg),
wc_param:subst(tol[wc_arg]=tol[wc_tolCntr],wc_param),
wc_tolCntr:wc_tolCntr+1
),
@@ -75,7 +74,7 @@ wc_systematic(wc_x,[wc_valuespertol]):=block(
/* Default the number of values per tolerance parameter to 3 */
if wc_valuespertol=[] then wc_valuespertol:wc_defaultvaluespertol else wc_valuespertol:first(wc_valuespertol),
if (wc_valuespertol < 2) and (wc_valuespertol >-1) then
- error("wc_mintypmax_num: The optional parameter needs to be negative or > 2"),
+ error("wc_systematic: The optional parameter needs to be <= -1 or >= 2"),
makelist(
(
subst(
@@ -162,7 +161,7 @@ wc_mintypmax(wc_x,[wc_params]):=block([wc_allvalues,wc_param1,min,wc_typ,max],
['min=min,'typ=wc_typ,'max=max]
);
/* Make this function map over equations */
- ?putprop('mintypmax, ?cdr([?mlist,?mequal]), '?distribute_over)$
+ ?putprop('wc_mintypmax, ?cdr([?mlist,?mequal]), '?distribute_over)$
/* wc_mintypmax, but solves wc_equation numerically to wx_var,
expecting ec_var to lie between wc_var_min and wc_var_max */
@@ -179,7 +178,7 @@ block([wc_allvalues, wc_param1, min, wc_typ,max],
[i,wc_var,wc_var_min,wc_var_max]
),
i,
- wc_systematic(wc_equation)
+ wc_systematic(wc_equation, wc_param1)
),
min:apply('min,wc_allvalues),
wc_typ:find_root(wc_typicalvalues(wc_equation),wc_var,wc_var_min,wc_var_max),
@@ -202,7 +201,7 @@ wc_inputvalues_max(wc_x):=
i,wc_x
);
-/* A function that sets all the input values to their max value */
+/* A function that sets all the input values to their min value */
wc_inputvalues_min(wc_x):=
makelist(
apply(op(i),[lhs(i),wc_min(rhs(i))]),
@@ -245,12 +244,11 @@ wc_inputvalueassumptions(wc_x):=block([wc_line,wc_assumptions:[]],
);
/* A function that creates assumptions on the range the tol[n] of wc_x are in */
-wc_tolassumptions(wc_x):=block([wc_line,wc_assumptions:[]],
+wc_tolassumptions(wc_x):=block([wc_assumptions:[]],
for wc_i in %wc_tols(wc_x) do
(
- wc_line:wc_mintypmax(rhs(wc_i)),
- push(lhs(wc_i)<=1,wc_assumptions),
- push(lhs(wc_i)>=-1,wc_assumptions)
+ push(wc_i<=1,wc_assumptions),
+ push(wc_i>=-1,wc_assumptions)
),
apply('assume,wc_assumptions)
);
@@ -261,7 +259,7 @@ wc_mintypmax2tol(wc_tol,wc_min,wc_typ,wc_max):=block([wc_try],
if wc_typ>wc_max then warning("wc_mintypmax2tol: Max value smaller than typ value"),
/* Try to find a linear equation that hits all three points */
wc_try:wc_typ+(wc_max-wc_typ)*wc_tol,
- /* Let's see if the quadratic equation hitss the targets */
+ /* Let's see if the linear equation hits the targets */
if subst (wc_tol=-1,wc_try) = wc_min then
return(wc_try)
else
@@ -325,10 +323,10 @@ wc_distrib2rssparams(data):=block([wc_mu,wc_sigma,wc_len],
/* Generates input data for the tolerance parameters from measurement data */
wc_distrib2toldata(tol,data,[sigmas]):=block(
[wc_rssparams:wc_distrib2rssparams(data),wc_sigmas:wc_defaultsigma],
- if length(sigmas) > 1 then error("wc_distrib2toldata: More than 3 parameters)"),
+ if length(sigmas) > 1 then error("wc_distrib2toldata: Too many optional parameters"),
if length(sigmas) = 1 then
(
- if not numberp(sigmas[1]) then error("wc_distrib2toldata: sigmas needs to be a number)"),
+ if not numberp(sigmas[1]) then error("wc_distrib2toldata: sigmas needs to be a number"),
wc_sigmas:sigmas[1]
),
wc_rssparams@sigma*wc_sigmas*tol+wc_rssparams@mu
@@ -372,7 +370,7 @@ brute-force step.
defs allows to add things like
tol[1]=0 for preventing tol[1] from being merged, or
- tol[2]=1 for preventing tol[1] from being merged and assuming it to read 1.
+ tol[2]=1 for preventing tol[2] from being merged and assuming it to read 1.
*/
wc_ewc_simplify(x,[defs]):=block(
[
@@ -452,7 +450,7 @@ wc_ewc_simplify(x,[defs]):=block(
);
/* Sometimes the secret of engineering is simplifying something, for example by
-approximating it by a taylor series. This is what this function does do */
+approximating it by a taylor series. This is what this function does */
wc_toltaylor(x,[maxorder]):=block(
[
/* The derivate of x to the tol[n] we currently look at */
@@ -492,7 +490,7 @@ wc_toltaylor(x,[maxorder]):=block(
wc_diffofwctollimit:wc_neglimit
),
/* Add the taylor term we just learned about to the result */
- retval:retval+wc_tol^wc_difforder/wc_difforder*wc_typicalvalues(wc_diffofwctollimit)
+ retval:retval+wc_tol^wc_difforder/factorial(wc_difforder)*wc_typicalvalues(wc_diffofwctollimit)
),
return(retval)
);
@@ -510,4 +508,4 @@ wc_sensitivities(expr):=block([tols:[],wc_tol,wc_typ:wc_typicalvalues(expr),wc_r
push([i,subst(i=-1,wc_tol)-wc_typ,subst(i=1,wc_tol)-wc_typ],wc_result)
),
return(apply('matrix,wc_result))
-);
+);
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
share/contrib/rtest_wrstcse.mac | 2 +-
share/contrib/wrstcse.mac | 34 ++++++++++++++++------------------
2 files changed, 17 insertions(+), 19 deletions(-)
hooks/post-receive
--
Maxima CAS
|