Code
1 + 1 + 1
[1] 3
Code
= 1000 * 1000 * 1000* 1000
quadrillion <- 6372795.477598 #Earth radius in meters
erm_radius <- 4 * pi * erm_radius * erm_radius
eartharea print(eartharea/quadrillion)
[1] 510.352
George Girton
May 9, 2022
This is a post with executable code.
First, some code in R. When I first ran it in Visual Studio Code, I got an offer to install the R extensions (accepted).
[1] 3
[1] 510.352
Then, some code in python. When I first ran it in RStudio, I got an error message that looked like this:
after that, I did this:
install-packages("reticulate")
and everything worked just fine
1084122984296576747840.498564 cubic meters
510352085623125.659716 square meters
1000000000000
510.352085623125659716 quadrillion square meters
— all photos Copyright © 2022-2024 George D Girton all rights reserved
---
title: "One and one and one is ..."
author: "George Girton"
date: "2022-05-09"
categories: [news, code, analysis]
image: "ambulance-00263.jpg"
---
This is a post with executable code.
First, some code in R. When I first ran it in Visual Studio Code, I got an offer to install the R extensions (accepted).
```{r}
1 + 1 + 1
quadrillion = 1000 * 1000 * 1000* 1000
erm_radius <- 6372795.477598 #Earth radius in meters
eartharea <- 4 * pi * erm_radius * erm_radius
print(eartharea/quadrillion)
```
Then, some code in python.
When I first ran it in RStudio, I got an error message that looked like this:
![(picture of an error message meaning: You didn't install reticulate)](reticulate_error.png)
after that, I did this:
```
install-packages("reticulate")
```
and everything worked just fine
```{python}
from decimal import *
PI= Decimal('3.1415926535897931')
RADIUS= Decimal('6372795.477598') #Earth radius in meters
RADIUS1 = RADIUS+1
# Formula for volume is four-thirds pi R cubed
m1 = 4 * PI / 3
V= m1 * RADIUS * RADIUS * RADIUS
V1= m1 * RADIUS1 * RADIUS1 * RADIUS1
print (V ," cubic meters")
area = V1-V
print (area , " square meters")
quadrillion = 1000 * 1000 * 1000 * 1000
print(quadrillion)
print (area/quadrillion, "quadrillion square meters")
```