Is there a way to trick SageMath into presenting numeric approximations 
with symbolics? In this specific case, handling numbers with units attached.

For example:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.1, Release Date: 2017-12-07                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: cm = units.length.centimeter;
sage: x = 1e-6*cm;
sage: x
(1.00000000000000e-6)*centimeter
sage: x.n(digits=2)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-3595ea137553> in <module>()
----> 1 x.n(digits=Integer(2))


/home/Scratch/Install/Linux/SageMath/sage-8.1-Fedora_26-x86_64/SageMath/src/
sage/structure/element.pyx in sage.structure.element.Element.n (build/
cythonized/sage/structure/element.c:8063)()
    861             0.666666666666667
    862         """
--> 863         return self.numerical_approx(prec, digits, algorithm)
    864 
    865     N = deprecated_function_alias(13055, n)


/home/Scratch/Install/Linux/SageMath/sage-8.1-Fedora_26-x86_64/SageMath/src/sage/symbolic/expression.pyx
 
in sage.symbolic.expression.Expression.numerical_approx 
(build/cythonized/sage/symbolic/expression.cpp:36128)()
   5782             res = x.pyobject()
   5783         else:
-> 5784             raise TypeError("cannot evaluate symbolic expression 
numerically")
   5785 
   5786         # Important -- the  we get might not be a valid output for 
numerical_approx in


TypeError: cannot evaluate symbolic expression numerically


Thank you for any suggestions!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to