MuPAD
Pro Computing Essentials - Examples
Example 10.2 - Two simple procedures to convert between radians and degrees
deg := proc(x)
begin
if is(x, Type::Real) then
return(x*180/PI)
else
return(procname(args()))
end;
end:
rad := proc(x)
begin
if is(x, Type::Real) then
return(x*PI/180)
else
return(procname(args()))
end;
end:
deg(1);

deg(PI);
180
rad(180);
float(rad(1));
0.01745329252
|