|
From: peterpall <pet...@us...> - 2025-08-24 05:38:24
|
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 cea93eb38e42058a968f849fc287eff469179e97 (commit)
from 68d0a0a417b2a22e1634eb937a880e802ea67e78 (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 cea93eb38e42058a968f849fc287eff469179e97
Author: Gunter Königsmann <gu...@pe...>
Date: Sun Aug 24 07:35:55 2025 +0200
wrstcse: wc_mintypmax2tol now no more overswings its target values.
The original version did try to find a quadratic equation that met
the three values for tol[n]=-1,0 and 1. The new version now replaces
this with two linear equations coupled by an abs(), if the quadratic
equation overswings.
diff --git a/doc/info/wrstcse.texi b/doc/info/wrstcse.texi
index 0c7ece418..7fc865378 100644
--- a/doc/info/wrstcse.texi
+++ b/doc/info/wrstcse.texi
@@ -751,11 +751,6 @@ R_4 = 1000.0 (0.01 tol + 1)]
Generates a parameter that uses the tolerance @var{tolname} and tolerates between the
given values.
-Caveat: This function returns a quadratic equation. If
-@code{typval-minval} greatly differs from @code{maxval-typval} the
-resulting curve will overshoot, if this parameter is used with values
-of @var{tolname} that aren't integers.
-
Example:
@c ===beg===
@c load("wrstcse")$
diff --git a/share/contrib/rtest_wrstcse.mac b/share/contrib/rtest_wrstcse.mac
index 32cc8c581..fe82aba98 100644
--- a/share/contrib/rtest_wrstcse.mac
+++ b/share/contrib/rtest_wrstcse.mac
@@ -8,6 +8,22 @@ ratsimp(subst(tol[1]=0,rhs(val1)));
b;
ratsimp(subst(tol[1]=1,rhs(val1)));
c;
+(val1:a=wc_mintypmax2tol(tol[1],-2,1,3),done);
+done;
+ratsimp(subst(tol[1]=-2,rhs(val1)));
+a;
+ratsimp(subst(tol[1]=1,rhs(val1)));
+b;
+ratsimp(subst(tol[1]=3,rhs(val1)));
+c;
+(val1:a=wc_mintypmax2tol(tol[1],-1,-1,2),done);
+done;
+ratsimp(subst(tol[1]=-1,rhs(val1)));
+a;
+ratsimp(subst(tol[1]=-1,rhs(val1)));
+b;
+ratsimp(subst(tol[1]=2,rhs(val1)));
+c;
(vals:wc_tolappend([val1],[b=2+tol[1]]),done);
done;
length(unique(sort(listofvars(vals))));
diff --git a/share/contrib/wrstcse.mac b/share/contrib/wrstcse.mac
index 5538d3262..dcb57c8ed 100644
--- a/share/contrib/wrstcse.mac
+++ b/share/contrib/wrstcse.mac
@@ -140,11 +140,20 @@ wc_inputvalueranges(wc_x):=apply('matrix,
);
/* A function that generates an equation out of the min, typ and maximum value for an element */
-
-wc_mintypmax2tol(wc_tol,wc_min,wc_typ,wc_max):=
- ((-2*wc_typ+wc_min+wc_max)*wc_tol^2)/2-((wc_min-wc_max)*wc_tol)/2+wc_typ;
-
-
+wc_mintypmax2tol(wc_tol,wc_min,wc_typ,wc_max):=block([wc_try,wc_dff],
+ if wc_min>wc_typ then warning("wc_mintypmax2tol: Min value bigger than typ value"),
+ if wc_typ>wc_max then warning("wc_mintypmax2tol: Max value smaller than typ value"),
+ /* Try to find a quadratic equation that hits all three points */
+ wc_try:((-2*wc_typ+wc_min+wc_max)*wc_tol^2)/2-((wc_min-wc_max)*wc_tol)/2+wc_typ,wc_tol,
+ /* Let's see if the quadratic equation overswings the targets */
+ wc_dff:diff(wc_try,wc_tol),
+ if (subst (wc_tol=-1,wc_dff)<0) or (subst (wc_tol=0,wc_dff)<0) or (subst (wc_tol=1,wc_dff)<0) then
+ wc_try:
+ wc_typ+
+ (wc_tol+abs(wc_tol))/2*(wc_max-wc_typ)+
+ (wc_tol-abs(wc_tol))/2*(wc_min-wc_typ),
+ return(wc_try)
+);
/* How many sigmas the range of tol[x]=-1...1 is assumed to be wide */
wc_defaultsigma:6;
-----------------------------------------------------------------------
Summary of changes:
doc/info/wrstcse.texi | 5 -----
share/contrib/rtest_wrstcse.mac | 16 ++++++++++++++++
share/contrib/wrstcse.mac | 19 ++++++++++++++-----
3 files changed, 30 insertions(+), 10 deletions(-)
hooks/post-receive
--
Maxima CAS
|