possibly another bug:

g: DFLOAT -> DFLOAT := x +-> 10^300

draw(g, x=-1..1)

seems to take forever.

Unfortunately, it seems that I need to rebuild the whole system to make changes
in CLIP and DRAW take effect.  Since this is several hours everytime, I cannot
really continue.  Below is a patch for Clip, that should fix at least the issue
with sin(1/x)*exp(-1/x), but I cannot test it.

(I removed Fnan?, since it doesn't have any effect on gcl, ecl, sbcl, and is
obscure anyway.)

Please ignore the debugging statements...

Martin


Index: clip.spad.pamphlet
===================================================================
--- clip.spad.pamphlet  (revision 419)
+++ clip.spad.pamphlet  (working copy)
@@ -86,22 +86,32 @@
     intersectWithVertLine:(SF,SF,SF,SF,SF) -> Pt
     intersectWithBdry:(SF,SF,SF,SF,Pt,Pt) -> Pt
     discardAndSplit: (L Pt,Pt -> B,SF,SF,SF,SF) -> L L Pt
-    norm: Pt -> SF
     iClipParametric: (L L Pt,RN,RN) -> CLIPPED
     findPt: L L Pt -> Union(Pt,"failed")
-    Fnan?: SF ->Boolean
-    Pnan?:Pt ->Boolean
 
-    Fnan? x == x~=x
-    Pnan? p == any?(Fnan?,p)
+    safeLength(x: Pt): SF ==
+      s := trapNumericErrors(length(x))$Lisp :: Union(SF, "failed")
+      s case "failed" => 0
+      s::SF
 
+--    myTrap1: (SF->SF, SF) -> SF
+--    myTrap1(ff:SF-> SF, f:SF):SF ==
+--      s := trapNumericErrors(ff(f))$Lisp :: Union(SF, "failed")
+--      s case "failed" => 0
+--      r:=s::SF
+--      r >max()$SF => max()$SF
+--      r < min()$SF => min()$SF
+--      r
+
     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))
+      output("iClipParametric: sort")$OutputPackage
+      sortedList := sort(safeLength(#1) < safeLength(#2), concat pointLists)
+      output("iClipParametric: sorted")$OutputPackage
       empty? sortedList => [nil(),segment(0,0),segment(0,0)]
       n := # sortedList 
       num := numer fraction
@@ -115,12 +125,14 @@
       yMax : SF := yCoord firstPt
       -- calculate min/max for the first (1-fraction)*N points
       -- this contracts the range
-      -- this unnecessarily clips monotonic functions (step-function, x^(high
power),etc.)
+      -- this unnecessarily clips monotonic functions (step-function,
x^(highpower),etc.)
+      output("iClipParametric: loop")$OutputPackage
       for k in 0..lastN  for pt in rest sortedList repeat
         xMin := min(xMin,xCoord pt)
         xMax := max(xMax,xCoord pt)
         yMin := min(yMin,yCoord pt)
         yMax := max(yMax,yCoord pt)
+      output("iClipParametric: finished loop")$OutputPackage
       xDiff := xMax - xMin; yDiff := yMax - yMin
       xDiff = 0 =>
         yDiff = 0 =>
@@ -135,7 +147,9 @@
       yMin := yMin - (numm :: SF) * yDiff / (denn :: SF)
       yMax := yMax + (numm :: SF) * yDiff / (denn :: SF)
       -- clip with the calculated range
+      output("iClipParametric: clipWithRanges")$OutputPackage
       newclip:=clipWithRanges(pointLists,xMin,xMax,yMin,yMax)
+      output("iClipParametric: clipWithRanges done")$OutputPackage
       -- if we split the lists use the new clip
       # (newclip.brans) > # pointLists   => newclip
       -- calculate extents
@@ -222,8 +236,6 @@
       -- throw out points with large and small y-coordinates
       yMin := yCoord(sortedList.clipNum)
       yMax := yCoord(sortedList.(n - 1 - clipNum))
-      if Fnan? yMin then yMin : SF := 0
-      if Fnan? yMax then yMax : SF := 0
       (yDiff := yMax - yMin) = 0 =>
         [pointLists,xRange plot,segment(yMin - 1,yMax + 1)]
       numm := numer scale; denn := denom scale
@@ -234,36 +246,18 @@
          (yCoord(#1) < yMax) and (yCoord(#1) > yMin),xMin,xMax,yMin,yMax)
       yMin := yCoord(sortedList.clipNum)
       yMax := yCoord(sortedList.(n - 1 - clipNum))
-      if Fnan? yMin then yMin : SF := 0
-      if Fnan? yMax then yMax : SF := 0
       for list in lists repeat
         for pt in list repeat
-          if not Fnan?(yCoord pt) then
-            yMin := min(yMin,yCoord pt)
-            yMax := max(yMax,yCoord pt)
+          yMin := min(yMin,yCoord pt)
+          yMax := max(yMax,yCoord pt)
       [lists,xVals,segment(yMin,yMax)]
 
     clip(plot:PLOT) == clip(plot,1/4,5/1)
 
-    norm(pt) == 
-      x := xCoord(pt); y := yCoord(pt)
-      if Fnan? x then
-        if Fnan? y then
-          r:SF := 0
-        else
-          r:SF := y**2
-      else
-        if Fnan? y then
-          r:SF := x**2
-        else
-          r:SF := x**2 + y**2
-      r
-
     findPt lists ==
       for list in lists repeat
         not empty? list => 
-             for p in list repeat 
-               not Pnan? p => return p
+             return first list
       "failed"
 
     clipWithRanges(pointLists,xMin,xMax,yMin,yMax) ==
@@ -280,11 +274,10 @@
       yMin : SF := yCoord firstPt; yMax : SF := yCoord firstPt
       for list in lists repeat
         for pt in list repeat
-          if not Pnan? pt then
-            xMin := min(xMin,xCoord pt)
-            xMax := max(xMax,xCoord pt)
-            yMin := min(yMin,yCoord pt)
-            yMax := max(yMax,yCoord pt)
+          xMin := min(xMin,xCoord pt)
+          xMax := max(xMax,xCoord pt)
+          yMin := min(yMin,yCoord pt)
+          yMax := max(yMax,yCoord pt)
       [lists,segment(xMin,xMax),segment(yMin,yMax)]
 
     clipParametric(plot,fraction,scale) ==


--~--~---------~--~----~------------~-------~--~----~
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 fricas-devel@googlegroups.com
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