On Nov 19, 2008, at 2:23 PM, Alex Raichev wrote: > > Hi all: > > I want to check if an expression A is a complex number? I tried the > obvious > > sage: if A in CC: > print "Yep." > > but that doesn't work.
This should work for everything *except* symbolic objects. sqrt(2) is symbolic... > For instance, > > sage: sqrt(2) in CC: > False > > One method that does work is > > sage: try: > CC(A) > except: > print "Nope" > else: > print "Yep" > > but is there a simpler way? For symbolic objects, I don't think there is yet an easier way. http://trac.sagemath.org/sage_trac/ticket/4560 - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---