Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 1.53 KB

pi_and_precision.org

File metadata and controls

72 lines (53 loc) · 1.53 KB

This one’s about p and P and mostly about pi.

First, let’s pi it up:

M-x calc
P (this gives you pi)

Result:
1:  3.14159265359

Well, I guess that’s a reasonable pi. But, c’mon, this is calc. Can’t we get a bit more digits? How about 100?

p 100 (sets precisions to 100)
P (need to ask calc again for pi, it doesn't recalculate)

Result:
1:  3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068

Well, but actually evaluating it robs it of its never-ending charm. Let’s just use it as a variable. How about calculating the area of a circle with a 5 km radius?

'5000 m
2
^
'pi (enter pi as a variable)
*

We get:
1:  25000000 m^2 pi

Yeah, sure that’s what I said I wanted, but I’ve changed my mind - now I want a number.

=

1:  78539816.3397448309615660845819875721049292349843776455243736148076954101571552249657008706335529267 m^2

Whoops, looked like I forgot to set the precision back to normal. And I can’t read this. Let’s make it a bit nicer.

Control-_ (normal emacs undo)
p 7
d g (turn digit grouping on)
=

Result:
1:  7.853983e7 m^2

Oh, that’s because I didn’t have enough precision to render it without resorting to scientific notation. Let’s just bump the precision up again.

Control-_ (undo, since we have to redo the pi conversion with more precision)
p 10
=

Result:
1:  78,539,816.35 m^2

Ah, that’s better.