How about the patches to have drawing of badly behaved functions work on sbcl?

(actually, I see that I have two slightly differing sets of patches on my
computer now, I'm attaching the more plausible one)

Martin

Index: src/algebra/clip.spad.pamphlet
===================================================================
--- src/algebra/clip.spad.pamphlet      (revision 495)
+++ src/algebra/clip.spad.pamphlet      (working copy)
@@ -95,13 +95,18 @@
     Fnan? x == x~=x
     Pnan? p == any?(Fnan?,p)
 
+    safeNorm(x: Pt): SF ==
+      s := trapNumericErrors(norm(x))$Lisp :: Union(SF, "failed")
+      s case "failed" => max()$SF
+      s::SF
+
     iClipParametric(pointLists,fraction,scale) ==
       -- error checks and special cases
       (fraction < 0) or (fraction > 1) =>
         error "clipDraw: fraction should be between 0 and 1"
       empty? pointLists => [nil(),segment(0,0),segment(0,0)]
       -- put all points together , sort them according to norm
-      sortedList := sort(norm(#1) < norm(#2),select(not Pnan? #1,concat
pointLists))
+      sortedList := sort(safeNorm(#1) < safeNorm(#2),select(not Pnan?
#1,concat pointLists))
       empty? sortedList => [nil(),segment(0,0),segment(0,0)]
       n := # sortedList 
       num := numer fraction
Index: src/algebra/draw.spad.pamphlet
===================================================================
--- src/algebra/draw.spad.pamphlet      (revision 495)
+++ src/algebra/draw.spad.pamphlet      (working copy)
@@ -318,7 +318,7 @@
     myTrap1: (SF-> SF, SF) -> SF
     myTrap1(ff:SF-> SF, f:SF):SF ==
       s := trapNumericErrors(ff(f))$Lisp :: Union(SF, "failed")
-      s case "failed" => 0
+      s case "failed" => max()$SF
       r:=s::SF
       r >max()$SF => max()$SF
       r < min()$SF => min()$SF
Index: src/algebra/plot.spad.pamphlet
===================================================================
--- src/algebra/plot.spad.pamphlet      (revision 495)
+++ src/algebra/plot.spad.pamphlet      (working copy)
@@ -278,6 +278,20 @@
       yRange := select(q,yCoord,min) .. select(q,yCoord,max)
       [ f, [nRange,xRange,yRange], c, q]
 
+    computes1s2dp: (P, P, P, F, F) -> List F
+    computes1s2dp(sp1, sp2, sp3, xDiff, yDiff) ==
+        x0 := xCoord sp1; y0 := yCoord sp1
+        x1 := xCoord sp2; y1 := yCoord sp2
+        x2 := xCoord sp3; y2 := yCoord sp3
+
+        a1 := (x1-x0)/xDiff; b1 := (y1-y0)/yDiff
+        a2 := (x2-x1)/xDiff; b2 := (y2-y1)/yDiff
+
+        s1 := sqrt(a1**2+b1**2) -- distance between sp1 and sp2
+        s2 := sqrt(a2**2+b2**2) -- distance between sp2 and sp3
+        dp := a1*a2+b1*b2       -- 
+        [s1, s2, dp]
+
     adaptivePlot(curve,tRange,xRange,yRange,pixelfraction) ==
       xDiff := hi xRange - lo xRange
       yDiff := hi yRange - lo yRange
@@ -324,21 +338,21 @@
             todo2 := rest todo2
             if not null todo1 then (t := first(todo1); p := first(todo2))
         sp := first(todo2)
-        x0 := xCoord first(sp); y0 := yCoord first(sp)
-        x1 := xCoord second(sp); y1 := yCoord second(sp)
-        x2 := xCoord third(sp); y2 := yCoord third(sp)
-        a1 := (x1-x0)/xDiff; b1 := (y1-y0)/yDiff
-        a2 := (x2-x1)/xDiff; b2 := (y2-y1)/yDiff
-        s1 := sqrt(a1**2+b1**2); s2 := sqrt(a2**2+b2**2)
-        dp := a1*a2+b1*b2
 
-        s1 < maxLength and s2 < maxLength and _
-          (s1 = 0::F or s2 = 0::F or
-             s1 < minLength and s2 < minLength or _
-             dp/s1/s2 > ANGLEBOUND) =>
+        safes1s2dp := 
+            trapNumericErrors(computes1s2dp(first sp, second sp, third sp, 
+                                            xDiff, yDiff))$Lisp
+                             ::Union(List F, "failed")
+
+        (not (safes1s2dp case "failed")) and
+            (s := safes1s2dp::List F).1 < maxLength and s.2 < maxLength and _
+            (s.1 = 0::F or s.2 = 0::F or
+            s.1 < minLength and s.2 < minLength or _
+                s.3/s.1/s.2 > ANGLEBOUND) =>
                 todo1 := rest todo1
                 todo2 := rest todo2
                 if not null todo1 then (t := first(todo1); p := first(todo2))
+
         if n > MAXPOINTS then leave else n := n + 1
         st := rest t
         if not null rest rest st then
Index: src/interp/spaderror.lisp
===================================================================
--- src/interp/spaderror.lisp  (revision 495)
+++ src/interp/spaderror.lisp   (working copy)
@@ -75,7 +75,8 @@
 #-(or :GCL :CCL)
 (defmacro |trapNumericErrors| (form)
     `(handler-case (cons 0 ,form)
-         (arithmetic-error () |$numericFailure|)))
+         (arithmetic-error () |$numericFailure|)
+         (simple-type-error () |$numericFailure|)))
 
 ;;;;;; considering this version for kcl
 ;;(defmacro |trapNumericErrors| (form)



-- plot.input.pamphlet
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input lode.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1991.
@
<<*>>=
<<license>>
)set break resume
)expose UnittestCount UnittestAux Unittest
testsuite "plotting"
 
testcase "plotting large values"

testTrue("(draw(exp(-1/x)*sin(1/x), x=-1..1); true)")
testTrue("draw(exp(-1/x^3)*sin(1/x), x=-1..1); true")
testTrue("draw(Gamma x, x=10^(-100)..1); true")
testTrue("draw(log2 x, x=0..1); true")
testTrue("draw((x:DFLOAT):DFLOAT +-> log2 x, 10^-10..1);true")
testTrue("draw((x:DFLOAT):DFLOAT +-> tan x, -10..10);true")
testTrue("draw((x:DFLOAT):DFLOAT +-> sec(1/exp x), -10..10);true")

expected() ==
    messagePrint("testsuite | testcases: failed (total) | tests: failed
    (total)")$OutputForm;
    messagePrint("plotting                    0     (1)               0
    (7)")$OutputForm

statistics()
expected()
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to