Lab1temp_151_24A
pdf
keyboard_arrow_up
School
Texas A&M University *
*We aren’t endorsed by this school
Course
151
Subject
Mathematics
Date
Apr 3, 2024
Type
Pages
9
Uploaded by SargentSeahorsePerson1986
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
1/9
MATH 151 Lab 1
Put team members' names and section number here.
Section 404 - Group 3
Lisa Pham, Coby Holley, Bradley White, Owen Koss, Redlin Krueger, Garret Worden
Question 1
1a
(8(ln(12.1) - ln(8.6))) / (2024 - 28^2) = 0.00220285967318215
1b
In [ ]:
import
sympy as
sp
from
sympy.plotting import
(
plot
,
plot_parametric
)
In [7]:
from
sympy import
*
a1 =
(
8 *
(
ln
(
12.1
) -
ln
(
8.6
))) /
(
2024 -
28
**
2
)
print (
"(8(ln(12.1) - ln(8.6))) / (2024 - 28^2) ="
,
a1
)
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
2/9
sin(pi/2) + cos(3) = cos(3) + 1
Question 2
2a
The identity holds for the value pi/3
In [6]:
from
sympy import
*
b1 =
sin
(
pi
/
2
) +
cos
(
3
)
print (
"sin(pi/2) + cos(3) ="
,
b1
)
In [2]:
import
sympy as
sp
#define the function
def
identity
(
x
):
def
side1
(
x
):
(
sp
.
cos
(
x
))
**
2
def
side2
(
x
):
.5
*
(
1 +
sp
.
cos
(
2
*
x
))
if
side1
(
x
) ==
side2
(
x
):
print
(
'The identity holds for the value'
,
x
,)
else
:
print
(
'The identity does not hold for the value'
,
x
,)
#test the values
identity
((
sp
.
pi
)
/
3
)
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
3/9
2b
The identity holds for the value 2.71
Question 3
3a
In [3]:
import
sympy as
sp
#define the function
def
identity
(
x
):
def
side1
(
x
):
(
sp
.
cos
(
x
))
**
2
def
side2
(
x
):
.5
*
(
1 +
sp
.
cos
(
2
*
x
))
if
side1
(
x
) ==
side2
(
x
):
print
(
'The identity holds for the value'
,
x
,)
else
:
print
(
'The identity does not hold for the value'
,
x
,)
#test the values
identity
(
2.71
)
In [11]:
import
sympy as
sp
# defining vectors
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
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
4/9
a + b: [1, 8]
a - b: [3, -2]
3a - 5b: [11, -16]
3b
a =
[
2
, 3
]
b =
[
-
1
, 5
]
# Question 3 part A
a_add_b =
[
a
[
i
] +
b
[
i
] for
i in
range
(
len
(
a
))]
a_minus_b =
[
a
[
i
] -
b
[
i
] for
i in
range
(
len
(
a
))]
a_minus_b_x3 =
[
3 *
a
[
i
] -
5 *
b
[
i
] for
i in
range
(
len
(
a
))]
print
(
"a + b:"
, a_add_b
)
print
(
"a - b:"
, a_minus_b
)
print
(
"3a - 5b:"
, a_minus_b_x3
)
In [3]:
import
math
# defining vectors
a =
[
2
, 3
]
b =
[
-
1
, 5
]
# Question 3 part A
a_add_b =
[
a
[
i
] +
b
[
i
] for
i in
range
(
len
(
a
))]
a_minus_b =
[
a
[
i
] -
b
[
i
] for
i in
range
(
len
(
a
))]
a_minus_b_x3 =
[
3 *
a
[
i
] -
5 *
b
[
i
] for
i in
range
(
len
(
a
))]
# Question 3 part B
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
5/9
Angle a makes relative to the x-axis (rads): 0.982793723247329
3c
Unit vector of 3a - 5b: [0.5665288228870652, -0.8240419241993676]
Question 4
4a
angle_radians =
math
.
atan2
(
a
[
1
], a
[
0
])
print
(
"Angle a makes relative to the x-axis (rads):"
, angle_radians
)
In [10]:
import
math
# defining vectors
a =
[
2
, 3
]
b =
[
-
1
, 5
]
a_minus_b_x3 =
[
3 *
a
[
i
] -
5 *
b
[
i
] for
i in
range
(
len
(
a
))]
magnitude =
math
.
sqrt
(
a_minus_b_x3
[
0
]
**
2 +
a_minus_b_x3
[
1
]
**
2
)
unit_vector =
[
a_minus_b_x3
[
i
] /
magnitude for
i in
range
(
len
(
a_minus_b_x3
print
(
"Unit vector of 3a - 5b:"
, unit_vector
)
In [3]:
from
sympy import
*
# Given force vector F = 5i + 9j
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
6/9
Magnitude of the force vector: sqrt(106)
4b
Displacement vector: (2, 6)
4c
F =
(
5
, 9
)
initial_point =
(
3
, 4
)
final_point =
(
5
, 10
)
# (a) Magnitude of the force vector
magnitude_force =
sqrt
(
F
[
0
]
**
2 +
F
[
1
]
**
2
)
print
(
f"Magnitude of the force vector: {
magnitude_force
}"
)
In [4]:
from
sympy import
*
# Given force vector F = 5i + 9j
F =
(
5
, 9
)
initial_point =
(
3
, 4
)
final_point =
(
5
, 10
)
# (b) Displacement vector
displacement_vector =
(
final_point
[
0
] -
initial_point
[
0
], final_point
[
1
] -
print
(
f"Displacement vector: {
displacement_vector
}"
)
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
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
7/9
Magnitude of the displacement vector: 2*sqrt(10)
4d
work/dot product = 64
In [6]:
from
sympy import
*
# Given force vector F = 5i + 9j
F =
(
5
, 9
)
initial_point =
(
3
, 4
)
final_point =
(
5
, 10
)
# (c) Magnitude of the displacement vector
magnitude_displacement =
sqrt
(
displacement_vector
[
0
]
**
2 +
displacement_vec
print
(
f"Magnitude of the displacement vector: {
magnitude_displacement
}"
)
In [34]:
from
sympy import
*
p =
[
2
,
6
]
F =
[
5
,
9
]
num =
dot
(
p
,
F
)
print (
"work/dot product ="
,
num
)
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
8/9
4e
cos of angle = 64/(2*sqrt(10) + sqrt(106))
4f
In [36]:
from
sympy import
*
p =
[
2
,
6
]
F =
[
5
,
9
]
num =
dot
(
p
,
F
)
mag_p =
sqrt ((
p
[
0
]
**
2
) +
(
p
[
1
]
**
2
))
mag_F =
sqrt ((
F
[
0
]
**
2
) +
(
F
[
1
]
**
2
))
cos_theta =
num /
(
mag_p +
mag_F
)
print
(
'cos of angle ='
, cos_theta
)
In [37]:
from
sympy import
*
p =
[
2
,
6
]
F =
[
5
,
9
]
num =
dot
(
p
,
F
)
mag_p =
sqrt ((
p
[
0
]
**
2
) +
(
p
[
1
]
**
2
))
mag_F =
sqrt ((
F
[
0
]
**
2
) +
(
F
[
1
]
**
2
))
cos_theta =
num /
(
mag_p +
mag_F
)
2/7/24, 12:32 AM
Lab1temp_151_24A
localhost:8890/nbconvert/html/Lab1temp_151_24A.ipynb?download=false
9/9
theta (angle)= acos(64/(2*sqrt(10) + sqrt(106)))
rad =
acos
(
cos_theta
)
print (
'theta (angle)='
,
rad
)
In [ ]:
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