File r34/xlog/elem.log artifact 15a01fc0f7 part of check-in ab67b20f90


Sat Jun 29 13:38:22 PDT 1991
REDUCE 3.4, 15-Jul-91 ...

1: 1: 
2: 2: 
3: 3: comment

Integer functions that work in all domain modes, independent of switch
NUMVAL, so long as their arguments evaluate to real numbers.

Functions of one argument:
FIX, SGN, ROUND, CEILING, FLOOR, ISQRT, ICBRT, ILOG2.

Function of two arguments:  IROOTN
The second argument of IROOTN must evaluate to an integer;
 $



fix a;


FIX(A)
  % will be evaluated only if a evaluates to a real number.

a := 27/4;


      27
A := ----
      4


fix a;


6


fix 12.345;


12


sgn (-15/2);


-1


round 12.5;


13


ceiling 12.5;


13


floor 12.5;


12


isqrt 12.5;


3


icbrt 12.5;


2


ilog2 130.7;


7


irootn(72,4);


2


irootn(72,3/2);


           3
IROOTN(72,---)
           2
 % this will not evaluate.


comment   Functions which require arguments which evaluate to integers:

Function of one argument:  FACTORIAL

Fumction of two arguments:  PERM, CHOOSE;
$



factorial 10;


3628800


perm(5,10);


30240
  % permutations of 5 out of 10.

choose(5,10);


252
  % choose 5 out of 10;


comment

These functions are evaluated in dmodes REALS and COMPLEX-VARIABLE
(ON REALS,COMPLEX) so long as their arguments and values evaluate to
real numbers and NUMVAL (normally ON) is ON.

Variable treated as function of no arguments:  E, PI.

Functions of one argument:
EXP, LOG, LN, LOG10, NORM, ARG, SQRT, CBRT,
RAD2DEG, RAD2DMS, DEG2RAD, DEG2DMS, DMS2DEG, DMS2RAD,
SIN, ASIN, COS, ACOS, TAN, ATAN, COT, ACOT, SEC, ASEC, CSC, ACSC,
SINH, ASINH, COSH, ACOSH, TANH, ATANH, COTH, ACOTH, SECH, ASECH,
CSCH, ACSCH,
SIND, ASIND, COSD, ACOSD, TAND, ATAND, COTD, ACOTD, SECD, ASECD,
CSCD, ACSCD.

Functions of two arguments:
EXPT, LOGB, HYPOT, ATAN2, ATAN2D.

Function evaluation is carried out to the precision specified in the
latest PRECISION statement.;
 $





on rounded;

 precision 6;


12


a := exp 3;


A := 20.0855


log a;


3.0


ln a;


3.0


log10 1000;


3.0


norm (-12.345);


12.345
  % for real x, this is equivalent to ABS x.

arg (-12.345);


3.14159
  % for real x, this -> if x<0 then pi else 0.0.

sqrt 3;


1.73205


ws**2;


3.0


cbrt 3;


1.44225


ws**3;


3.0


deg2rad 30;


0.523599


rad2deg ws;


30.0


a := deg2dms 12.345;


A := {12,20,42.0}
 % a will be a list.

dms2deg ws;


12.345


dms2rad a;


0.215461


rad2deg ws;


12.345


asin 0.5;


0.523599


sin ws;


0.5


acos 0.5;


1.0472


cos ws;


0.5


atan 0.5;


0.463648


tan ws;


0.5


acot 0.5;


1.10715


cot ws;


0.5


asec 3;


1.23096


sec ws;


3.0


acsc 3;


0.339837


csc ws;


3.0


asinh 0.5;


0.481212


sinh ws;


0.5


acosh 2;


1.31696


cosh ws;


2.0


atanh 0.5;


0.549306


tanh ws;


0.5


acoth 2;


0.549306


coth ws;


2.0


sech 1;


0.648054


asech ws;


1


csch 1;


0.850918


acsch ws;


1


sind 30;


0.5


asind ws;


30.0


cosd 30;


0.866025


acosd ws;


30.0


tand 30;


0.57735


atand ws;


30.0


cotd 30;


1.73205


acotd ws;


30.0


secd 30;


1.1547


asecd ws;


30.0


cscd 30;


2.0


acscd ws;


30.0


expt(2,1.234);


2.35218


logb(ws,2);


1.234


hypot(3,4);


5.0


a := -3*pi/4;


A :=  - 2.35619
 % any  -pi<a<=pi should work.

atan2(sin a,cos a);


 - 2.35619
  % this should = a.

a := -135;


A := -135


atan2d(sind a,cosd a);


 - 135.0



precision 20;


6
  % functions will be computed to 20 places.

sind 60;


0.866 02540 37844 38646 76


asind ws;


60.0


precision 50;


20
  % fuctions computed to 50 places.

sind 60;


0.866 02540 37844 38646 76372 31707 52936 18347 14026 26905 19


asind ws;


60.0


precision 6;


50


comment   If argument or value are complex, functions are not computed
when dmode is REALS;
 $



sin(1+i);


SIN(I + 1)
  % complex argument.

asin 2;


ASIN(2)
  % value would be complex.

on complex;


*** Domain mode ROUNDED changed to COMPLEX-ROUNDED 


comment   Complex functions of one argument:
EXP, LOG, NORM, ARG, SQRT,
SIN, ASIN, COS, ACOS, TAN, ATAN, COT, ACOT, SEC, ASEC, CSC, ACSC,
SINH, ASINH, COSH. ACOSH, TANH, ATANH, COTH, ACOTH, SECH, ASECH,
CSCH, ACSCH.

Complex function of two variables:  EXPT;
 $



e**(pi*i);


 - 1


log(1+i);


0.346574 + 0.785398*I


exp ws;


1 + I


norm(5*exp(2i));


5.0


arg(5*exp(2i));


2.0


sqrt(1+i);


1.09868 + 0.45509*I


ws**2;


1 + I


asin 2;


1.5708 - 1.31696*I


sin ws;


2.0


acos 2;


1.31696*I


cos ws;


2.0


atan(1+i);


1.01722 + 0.402359*I


tan ws;


1 + I


acot(1+i);


0.553574 - 0.402359*I


cot ws;


1 + I


asec 0.1;


2.99322*I


sec ws;


0.1


acsc 0.1;


1.5708 - 2.99322*I


csc ws;


0.1


sinh(1+i);


0.634964 + 1.29846*I


asinh ws;


1 + I


cosh(1+i);


0.83373 + 0.988898*I


acosh ws;


1 + I


atanh 2;


0.549306 + 1.5708*I


tanh ws;


2.0


acoth 0.3;


0.30952 + 1.5708*I


coth ws;


0.3


asech(1-i);


0.530638 + 1.11852*I


sech ws;


1 - I


acsch(1-i);


0.530638 + 0.452278*I


csch ws;


1 - I


expt(1+i,1-i);


2.80788 + 1.31787*I


logb(ws,1+i);


1 - I


end;

4: 4: 
Quitting
Sat Jun 29 13:38:31 PDT 1991


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]