On 05/07/2015 11:19 AM, Douglas Davis wrote: > Is there a way to convert a symbolic result from using rational expressions > and constants to the corresponding expression using reals? > > For example if I have a result of > > -15/28*2^(2/3)*a*hh^2+32/pi*b^3 > > I need to convert it to > > -0.85039*a*hh^2 + 10.186*b^3 >
You want the (hidden!) _convert() method: sage: a,b,hh = SR.var('a,b,hh') sage: f = -15/28*2^(2/3)*a*hh^2+32/pi*b^3 sage: f._convert({'parent':RR}) 10.1859163578813*b^3 - 0.850393420697250*a*hh^2 This is useful all the time and has been asked for before. There's a ticket to make it public: http://trac.sagemath.org/ticket/12577 Although now it would be nice to add some sugar on top so that e.g. f.convert(RR) would work without the weird dict. (The dict wasn't needed back when I created the ticket.) -- 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 http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.