質問編集履歴
1
アドバイスを元にした変更を行いました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,116 @@
|
|
1
|
+
```Python
|
2
|
+
|
3
|
+
import matplotlib.pyplot as plt
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
a = 1200
|
8
|
+
|
9
|
+
b = 1800
|
10
|
+
|
11
|
+
L = 3000
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
print("E")
|
16
|
+
|
17
|
+
E = input()
|
18
|
+
|
19
|
+
E = int(E)
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
print("I")
|
24
|
+
|
25
|
+
I = input()
|
26
|
+
|
27
|
+
I = int(I)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
print("P")
|
32
|
+
|
33
|
+
P = input()
|
34
|
+
|
35
|
+
P = int(P)
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
print("E2")
|
40
|
+
|
41
|
+
E2 = input()
|
42
|
+
|
43
|
+
E2 = int(E2)
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
print("I2")
|
48
|
+
|
49
|
+
I2 = input()
|
50
|
+
|
51
|
+
I2 = int(I2)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
print("P2")
|
56
|
+
|
57
|
+
P2=input()
|
58
|
+
|
59
|
+
P2=int(P2)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
def f(x_i) :
|
64
|
+
|
65
|
+
if x_i < a:
|
66
|
+
|
67
|
+
return (b * P) * (-x_i**3 + a * (a + 2 * b) * x_i) / (6 * E * I * L)
|
68
|
+
|
69
|
+
else:
|
70
|
+
|
71
|
+
return (a * P) / (6 * E * I * L) * (-(L - x_i)**3 + b * (2 * a + b) * (L - x_i))
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
if x_i < a:
|
76
|
+
|
77
|
+
return (b * P2) * (-x_i**3 + a * (a + 2 * b) * x_i) / (6 * E2 * I2 * L)
|
78
|
+
|
79
|
+
else:
|
80
|
+
|
81
|
+
return (a * P2) / (6 * E2 * I2 * L) * (-(L - x_i)**3 + b * (2 * a + b) * (L - x_i))
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
x = list(range(L))
|
86
|
+
|
87
|
+
y=list(map(f,x))
|
88
|
+
|
89
|
+
y2=list(map(f,x))
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
plt.grid(which="major", color="gray", linestyle="-")
|
94
|
+
|
95
|
+
plt.xlim(0, L)
|
96
|
+
|
97
|
+
plt.ylim(min(y) - 1, max(y) + 1)
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
plt.plot(x, y, label = "label-A")
|
106
|
+
|
107
|
+
plt.plot(x,y2, label = "label-B")
|
108
|
+
|
109
|
+
plt.legend(loc = 'lower right')
|
110
|
+
|
111
|
+
plt.show()
|
112
|
+
|
1
|
-
### 前提・実現したいこと
|
113
|
+
```### 前提・実現したいこと
|
2
114
|
|
3
115
|
|
4
116
|
|