BASH : constante PI et commande cos, sin et tan existent ?

Bonjour,

je voudrais savoir s’il existe en bash la constante PI et des commandes simples qui permettent de calculer le cosinus, sinus et tangente d’un angle ?

J’ai regardé du côté de la commande bc, mais je n’ai rien trouvé.

Merci d’avance, cordialement.

salut,

bash' ne fait des calculs que sur des entiers.bc’, appelé avec l’option `-l’ dispose de ces fonctions (voir man bc / MATH LIBRARY), mais pas Pi (il faut le calculer, une formule est donnée dans le man).

Salut,

merci pour le PI :

root@localhost:../..# man bc | grep -i pi
       to ibase will result in a value of 2 or 16.  Input numbers may contain the characters 0-9 and A-F. (Note: They must  be  capitals.   Lower
       These statements are not statements in the traditional sense.  They are not executed statements.  Their function is performed at "compile"
       In /bin/sh,  the following will assign the value of "pi" to the shell variable pi.
               pi=$(echo "scale=10; 4*a(1)" | bc -l)
       GNU  bc can be compiled (via a configure option) to use the GNU readline input editor library or the BSD libedit library.  This allows the
              would typically contain function definitions for functions the user wants defined every time bc is run.
       If any file on the command line can not be opened, bc will report that the file is unavailable and terminate.  Also, there are compile and
root@localhost:../..# 

Et pour la trigonométrie :

s (x)  The sine of x, x is in radians.
       c (x)  The cosine of x, x is in radians.
       a (x)  The arctangent of x, arctangent returns radians.
       e (x)  The exponential function of raising e to the value x.