Hello,
>> As a first pass, just surround the evaluation with a try/except, as
>> you would in Python. Perhaps you could set the value in the except
>> clause to nan.
>>
For the 2d-plot, I test if a result is a real number by theses tests :
#
# The real number without infty nor NaN=NotANumber verifies this test.
# The result is either (x,y) either False
#
def plotFuncCall (self, t) :
try :
K = [float(self.fct[0](t)), float(self.fct[1]]
if not (self.minusInfty<K[0] and K[0]<self.plusInfty) : return False
if not (self.minusInfty<K[1] and K[1]<self.plusInfty) : return False
except (ZeroDivisionError, TypeError, ValueError, OverflowError) :
return False
return K
float ('nan') <> float('nan') is true ! : it seems very difficult to
test if a result is nan.
But only real number, neither nan nor infty verify this test -infty < x
< +infty.
And at an other place I have self.minusInfty = float('-inf') and
self.plusInfty=float('inf')
--~--~---------~--~----~------------~-------~--~----~
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/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---