[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shell wrappers for trig and other mathematical functions



Hi,

Dan Hitt wrote:
> I'm half-way looking for some shell wrappers for common trig functions like
> sin, cos, exp, log, and others.
> 
> I'm aware of bc, but it seems cumbersome.
> 
> I would like to just type 'sin 1' and get the sine (of 1 radian), or type
> 'log 2' and get the natural or maybe common log of 2.  (Probably any such
> program should do something intelligent when faced with multiple or zero
> arguments, such as computing the sine or log of each, so that they could be
> chained together.  And maybe such a program would pay attention to
> environment variables or optional command line arguments to tune its
> behavior.)

to put in a word for bc...

Did you try "bc -l"? "man bc" gives more details

To get the sine of 1 radian:
	s(1) 

To get the log 2:
	l(2)

Similar are exp, cosine, arctangent:
	e(), c(), a()

Don't miss the fact that "." is the last result. Try out e.g.
	8^2
	./2

Best regards,
	Klaus.
-- 
Klaus Singvogel
GnuPG-Key-ID: 1024R/5068792D  1994-06-27


Reply to: