Ask Your Question

lxman's profile - activity

2013-04-08 04:53:32 -0600 received badge  Taxonomist
2012-11-10 23:28:49 -0600 received badge  Famous Question (source)
2011-12-13 11:57:28 -0600 received badge  Notable Question (source)
2011-07-20 11:16:53 -0600 received badge  Popular Question (source)
2010-12-31 12:03:50 -0600 commented answer Numerical approximation of symbolic equation

Thank you for all the hard work. This definitely looks promising. I will experiment with it to see how it goes. It seems to me that if this sort of thing was implemented generally it would make sage a *much* more attractive package.

2010-12-31 12:01:14 -0600 received badge  Supporter (source)
2010-12-30 22:57:18 -0600 received badge  Student (source)
2010-12-30 11:51:37 -0600 asked a question Numerical approximation of symbolic equation

What I would like to do is the following:

sage: var('theta')
theta
sage: theta=25*units.angles.degree
sage: print theta
25*degree
sage: a=sin(theta)
sage: print a
sin(25*degree)

At this point, I type 'a.' and tab and in the popup list of functions I find numerical_approx. So I type in:

sage: a.numerical_approx()
Traceback (click to the left of this block for traceback)
...
TypeError: cannot evaluate symbolic expression numerically

Okay, it would appear that adding the units to theta turns it into a symbolic variable which turns my expression a into a symbolic expression. But what I would like to do is enter my angle theta in either degrees or radians and get a numerical approximation of the answer based on the units of the input. Is there a clean way to do this?