[Ilugc] .a-tip-a-day. (bc - interactive calculator)
- From: kapil@xxxxxxxxxxx (Kapil Hari Paranjape)
- Date: Wed Sep 23 10:46:02 2009
Hello,
On Wed, 23 Sep 2009, Girish Venkatachalam wrote:
On Wed, Sep 23, 2009 at 6:30 AM, Kapil Hari Paranjape <kapil@xxxxxxxxxxx>
wrote:
Hello,
?$ bc -l
which is required if you want to use things like sine, cosine, etc.
This is driving me mad Kapil.
Sorry! ;-> I agree that the math library is a bit limited. More
complicated functions need to be defined and made available.
But I have a problem. How will I convert from degrees to radians?
You can define a function in bc.
define dtor (d) { return d*a(1)/45; }
The reason this works is that a() is the arctan or inverse of tan
function and tan(45 degrees)=1.
But how to ask for sin(30), sin(60), sin(90) in degrees to radians?
define sin (d) { return s(dtor(d)); }
Regards,
Kapil.
--
Other related posts: