Simulate a rotating equal triangle with sides L inside a circle of radius r . I have tried it.but my code can not display the simulation of the rotating equal triangle with sides L inside a circle of radius r .

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please help me solve this using python

Simulate a rotating equal triangle with sides L inside a circle of radius r .

I have tried it.but my code can not display the simulation of the rotating equal triangle with sides L inside a circle of radius r .

Here is my code:

import numpy as np
from matplotlib import pyplot as plt
from IPython import display

r=1.0
θa=-20; θb=70 ; θc=160
xa=r*np.cos(θa)
ya=r*np.sin(θa)
xb=r*np.cos(θb)
yb=r*np.sin(θb)
xc=r*np.cos(θc)
yc=r*np.sin(θc)

line_abx = [xa,xb]
line_aby = [ya,yb]
line_bcx = [xb,xc]
line_bcy = [yb,yc]
line_cax = [xc,xa]
line_cay = [yc,ya]

T=2*np.pi/5
tarr=np.linspace(0,10*T,150)

theta = np.linspace(0,10*T,150)
radius = 1.0
a = radius*np.cos(theta)
b = radius*np.sin(theta)

figure , axes = plt.subplots()
axes.plot(a,b,c='red')
axes.set_aspect(1)

plt.plot(0 , 0, '.')
plt.plot(xa ,ya, 'o')
plt.plot(xb ,yb, 'o')
plt.plot(xc ,yc, 'o')
plt.plot(line_abx , line_aby)
plt.plot(line_bcx , line_bcy)
plt.plot(line_cax , line_cay)
plt.show()

-can you spot the problem in my code?

The output must be similar to the diagram attached

• First, set up an coordinate system. Choose to locate the center of the triangle in the origin.
• Set the radius of the circle that encloses the equal triangle r.
• Lable the apexes in polar coordinate form, A(r,0₁), B(r,0b),C(r,0c). Fix the polar coordinates of the sites of the apexes
symmetrically, i.e., set the values, and based on the most natural symmetrical arrangement.
• Convert the coordinates into rectanular form, i.e.,
x A = r cos(0A), YA = r sin(0)
xß = r cos((B), YB = r sin(0B),
xc = r cos(0c), yc = r sin(0c).
• Connect the pairs of apexes {A, B}, {B, C'}, {C, A} by a line. Display the triangle along with the circle that encloses them. The points
should locate exactly on the circumference of the circle.
• Choose an angular rotational speed w. Let the angles to change with time via 0(t + At) = 0(t) + wAt. Hence, simulate the rotation
of the triangle for as t evolves from say t = 0 to t = 10T, where T = 2
Transcribed Image Text:• First, set up an coordinate system. Choose to locate the center of the triangle in the origin. • Set the radius of the circle that encloses the equal triangle r. • Lable the apexes in polar coordinate form, A(r,0₁), B(r,0b),C(r,0c). Fix the polar coordinates of the sites of the apexes symmetrically, i.e., set the values, and based on the most natural symmetrical arrangement. • Convert the coordinates into rectanular form, i.e., x A = r cos(0A), YA = r sin(0) xß = r cos((B), YB = r sin(0B), xc = r cos(0c), yc = r sin(0c). • Connect the pairs of apexes {A, B}, {B, C'}, {C, A} by a line. Display the triangle along with the circle that encloses them. The points should locate exactly on the circumference of the circle. • Choose an angular rotational speed w. Let the angles to change with time via 0(t + At) = 0(t) + wAt. Hence, simulate the rotation of the triangle for as t evolves from say t = 0 to t = 10T, where T = 2
1.00
0.75
0.50
0.25
0.00
-0.25
-0.50
-0.75
-1.00
-1.0
вс 210%
-0.5
8₁=3
0.0
360°
3
L
30%
120°
0.5
10
A triangle is a special case of polygon with
n = 3 apexes.
n = 3
05 (360)
[²=2r² + 2 r² cos
360°
O₁+1= 0₁ += -,i € [1,2,...,n - 1]
72
0₁10₁-30°.
Note that the first angle 0₁-1can be fixed at
any arbitrary value, including 0°.
Transcribed Image Text:1.00 0.75 0.50 0.25 0.00 -0.25 -0.50 -0.75 -1.00 -1.0 вс 210% -0.5 8₁=3 0.0 360° 3 L 30% 120° 0.5 10 A triangle is a special case of polygon with n = 3 apexes. n = 3 05 (360) [²=2r² + 2 r² cos 360° O₁+1= 0₁ += -,i € [1,2,...,n - 1] 72 0₁10₁-30°. Note that the first angle 0₁-1can be fixed at any arbitrary value, including 0°.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY