Ask Your Question

lxman's profile - activity

2013-04-08 11:53:32 +0200 received badge  Taxonomist
2012-11-11 06:28:49 +0200 received badge  Famous Question (source)
2011-12-13 18:57:28 +0200 received badge  Notable Question (source)
2011-07-20 18:16:53 +0200 received badge  Popular Question (source)
2010-12-31 19:03:50 +0200 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 19:01:14 +0200 received badge  Supporter (source)
2010-12-31 05:57:18 +0200 received badge  Student (source)
2010-12-30 18:51:37 +0200 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?