Mathematical Functions in programming languages

Mathematical Functions in programming languages

Mathematical Functions

Mathematical functions not intrinsic to BASIC can be calculated as follows:

FunctionBASIC Equivalent
SecantSEC(X)=1/COS(X)
CosecantCSC(X)=1/SIN(X)
CotangentCOT(X)=1/TAN(X)
Inverse SineARCSIN(X)=ATN(X/SQR(-X*X+1))
Inverse CosineARCCOS(X)=ATN (X/SQR(-X*X+1))+ PI/2
Inverse SecantARCSEC(X)=ATN(X/SQR(X*X-1))+SGN(SGN(X)-1)* PI/2
Inverse CosecantARCCSC(X)=ATN(X/SQR(X*X-1))+SGN(X)-1)* PI/2
Inverse CotangentARCCOT(X)=ATN(X)+ PI/2
Hyperbolic SineSINH(X)=(EXP(X)-EXP(-X))/2
Hyperbolic CosineCOSH(X)=(EXP(X)+EXP(-X))/2
Hyperbolic TangentTANH(X)=EXP(X)-EXP(-X))/+(EXP(X)+EXP(-X))
Hyperbolic SecantSECH(X)=2/(EXP(X)+EXP(-X))
Hyperbolic CosecantCSCH(X)=2/(EXP(X)-EXP(-X))
Hyperbolic CotangentCOTH(X)=EXP(-X)/(EXP(X)-EXP(-X))*2+1
Inverse Hyperbolic SineARCSINH(X)=LOG(X/SQR(X*X+1))
Inverse Hyperbolic CosineARCCOSH(X)=LOG(X+SQR(X*X-1))
Inverse Hyperbolic TangentARCTANH(X)=LOG((1+X)/(1-X))/2
Inverse Hyperbolic CosecantARCCSCH(X)=LOG(SGN(X)*SQR(X*X+1)+1)/X
Inverse Hyperbolic SecantARCSECH(X)=LOG(SQR(-X*X+1)+1)/X
Inverse Hyperbolic CotangentARCCOTH(X)=LOG((X+1)/(X-1))/2

BASIC commands Main Menu

Index