Bc

Using bc to crank out pi. The answer becomes more trustworthy the longer you let bc think about it.

#!/bin/bash
echo “scale=$1;a(1)*4” | bc -l

Calculate absolute magnitude of Sirius

  • Visual magnitude = -1.46
  • Distance = 8.6 light-years

$ echo ‘mvis=-1.46; dist=8.6; mvis-5*((l(dist/3.26156)/l(10))-1)’ |bc -l

1.43463460507643045915

Calculate absolute magnitude of Tau Ceti

  • Visual magnitude = 3.5
  • Distance = 11.912

$ echo ‘mvis=3.5; dist=11.912; mvis-5*((l(dist/3.26156)/l(10))-1)’ |bc -l

5.68720343757367040805

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s