Lab2_n
pdf
keyboard_arrow_up
School
Texas A&M University *
*We aren’t endorsed by this school
Course
152
Subject
Mathematics
Date
Feb 20, 2024
Type
Pages
4
Uploaded by MasterFireHeron35
MATH 152 Lab 2
Samuel Molero, Angus Ladd, Karthink Nuti, Arlin Birkby
Instructions: Complete the lab assignment in your assigned groups. Unless stated otherwise,
your answers should be obtained using Python code.
Do not modify the cell above, as it contains all the packages you will need. It is highly
recommended to not use any additional packages.
NOTE: If you took MATH 151 last semester, notice that the import statement for SymPy is
di
ff
erent- for each SymPy command you use, you have to preface it with "sp." For example,
"symbols('x')" becomes "sp.symbols('x')". Except for plot and plot_parametric
- you don't
need to type "sp." for those.
Question 1
1a
The Total Volume of Ice Cream is: 2*pi
1b
In
[19]:
from
sympy
import
*
from
sympy.plotting
import
(
plot
,
plot_parametric
)
In
[24]:
#start code here
y
=
symbols
(
'y'
,
real
=
True
)
r_squared
=
1
-
y
**
2
#display(r_squared)
formula_1
=
pi
*
r_squared
Volume_top
=
integrate
(
formula_1
,(
y
,
0
,
1
))
#display(Volume_top)
r_squared2
=
(
y
*
Rational
(
1
,
4
))
**
Rational
(
2
)
#display(r_squared2)
formula_2
=
pi
*
r_squared2
Volume_bottom
=
integrate
(
formula_2
,(
y
,
0
,
4
))
#display(Volume_bottom)
Total_Volume
=
Volume_top
+
Volume_bottom
print
(
'The Total Volume of Ice Cream is:'
,
Total_Volume
)
Lab2temp_152_23C
http://localhost:8888/nbconvert/html/Desktop/152/Lab...
1 of 4
9/12/23, 10:04 PM
The radius must be: 1.62726396978388 in order for the volume to be 14.500
0000000000
Question 2
2a
In
[25]:
#start code here
x
=
symbols
(
'x'
,
Real
=
True
,
positive
=
True
)
vol_top
=
pi
*
Rational
(
2
,
3
)
*
x
vol_bot
=
pi
*
Rational
(
4
,
3
)
*
x
**
2
#display(vol_top+vol_bot)
equation_new
=
vol_top
+
vol_bot
-
14.5
soln
=
solve
(
equation_new
,
x
)
#print(soln)
volume_checkingwork
=
equation_new
.
subs
(
x
,
soln
[
0
])
check
=
volume_checkingwork
+
14.5
#print(check.evalf())
print
(
'The radius must be:'
,
*
soln
,
"in order for the volume to be"
,
" "
,
In
[9]:
#start code here
x
=
symbols
(
'x'
,
real
=
True
)
f_x
=
2
*
x
**
2
g_x
=
abs
((
x
**
2
)
-
9
)
plot_1
=
plot
((
f_x
,(
x
,
-
5
,
5
)),(
g_x
,(
x
,
-
5
,
5
)),
ylim
=
(
-
10
,
50
))
Lab2temp_152_23C
http://localhost:8888/nbconvert/html/Desktop/152/Lab...
2 of 4
9/12/23, 10:04 PM
2b
Interception Points: 2c
Question 3
3a
In
[11]:
#start code here
interceptions
=
solve
(
f_x
-
g_x
)
print
(
'Interception Points: '
)
display
(
interceptions
[
0
],
interceptions
[
1
])
−√
3
√
3
In
[12]:
#start code here
integrate
(
g_x
-
f_x
, (
x
,
interceptions
[
0
],
interceptions
[
1
]))
Out[12]:
12
√
3
Lab2temp_152_23C
http://localhost:8888/nbconvert/html/Desktop/152/Lab...
3 of 4
9/12/23, 10:04 PM
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
the area under the curve is: this represents the net change in the population from 0 to 5 months Question 4
4a
4b
4c
In
[15]:
#start code here
t
=
symbols
(
't'
,
real
=
True
)
birth
=
((
3.941109
)
*
E
**
(
0.01199
*
t
))
death
=
(
2.744248
)
*
E
**
(
0.009
*
t
)
eq
=
(
birth
-
death
) Area
=
integrate
(
eq
,(
t
,
0
,
5
))
print
(
'the area under the curve is: '
) display
(
Area
.
evalf
())
print
(
"this represents the net change in the population from 0 to 5 months 6.27355000167739
In
[57]:
# Write your answers as comments. Make sure all the text is visible at once # # Compared to the result obtained fin part (a) its a good estimate of how th
# as month progresses, if for part a we were to integrate from intervals 0, # a result close to the actual estimate. # In
[28]:
#start code here
c
=
symbols
(
'C'
,
real
=
True
)
x1
=
tan
(
x
)
**
2
display
(
integrate
(
x1
)
+
c
)
C
−
x
+
sin (
x
)
cos (
x
)
In
[29]:
#start code here
x2
=
x
*
tan
(
x
**
2
)
**
2
display
(
integrate
(
x2
)
+
c
)
C
−
+
x
2
2
tan
(
x
2
)
2
In
[11]:
# Write your answers as comments. Make sure all the text is visible at once # for part (a) you can simplify using trigonimetry and then integrate
# for part (b) you can implement the u sustitution method
# Lab2temp_152_23C
http://localhost:8888/nbconvert/html/Desktop/152/Lab...
4 of 4
9/12/23, 10:04 PM