Skip to content

Commit

Permalink
Update chapter_2.md
Browse files Browse the repository at this point in the history
  • Loading branch information
EiseWN authored Oct 1, 2023
1 parent 4b114aa commit 76a0ad0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions course/practicals/chapter_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,12 @@ For illustrative purposes, let's start with an example of a function that is so
# input R radius(m)
# h cylinder height(m)
import numpy as np
def a_circ(R):
return 2*np.pi*(R**2)
def a_lat(R,h):
return 2*np.pi*R*h
return a_lat(R,h)+a_circ(R)
# first calculate the area of the circles at the top and base
a_circ = 2*np.pi*(R**2)
# then calculate the area of the side of the cylinder (= lateral area)
a_lat = 2*np.pi*R*h
# return the entire cylinder area as a sum of both
return a_lat+a_circ
```

- Now try call upon these functions specifying a radius of ```2``` and a height of ```3```. Do you understand the results?
Expand Down

0 comments on commit 76a0ad0

Please sign in to comment.