how to use degree in sin function



On Mon, Jan 19, 2009 at 12:47 PM, Wolfgang Lindner <LindnerW at t-online.de> wrote:

> .. or you could use a nonfunctional 'unit-like' solution:
>
> degree:= %pi/180$
> sin(30*degree)

Well, for your amusement ...

load (ezunits);
matchdeclare (dd, lambda ([e], unitp(e) and units(e) = 'deg));
simp : false;
tellsimp (sin(dd), sin(qty(dd) * %pi/180));
simp : true;

sin (30);
 => sin(30)
sin (30 ` deg);
 => 1/2
sin (31 ` deg);
 => sin(31*%pi/180)

I suppose one could define the degree symbol as a postfix
operator and match against that.

Robert