回答編集履歴
3
d
test
CHANGED
@@ -126,7 +126,7 @@
|
|
126
126
|
|
127
127
|
for a, b, c in zip(A, B, C):
|
128
128
|
|
129
|
-
print(f"a={a:.6f}, b={
|
129
|
+
print(f"a={a:.6f}, b={b:.6f}, c={c:.6f}")
|
130
130
|
|
131
131
|
# a=-1.000000, b=-1.000000, c=-1.000000
|
132
132
|
|
2
d
test
CHANGED
@@ -91,3 +91,83 @@
|
|
91
91
|
print(f"y/c={y:.6f}")
|
92
92
|
|
93
93
|
```
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
## 追記
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
> ご回答ありがとうございます.
|
102
|
+
|
103
|
+
y/c=..., p=..., q=...と横に並べて変数を表示する際は.
|
104
|
+
|
105
|
+
for in をどのように書き換えればいいですか?
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
複数のリストを zip を使って for 文で回してください。
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
```python
|
114
|
+
|
115
|
+
import numpy as np
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
A = np.arange(-1, 1.1, 0.1)
|
120
|
+
|
121
|
+
B = np.arange(-1, 1.1, 0.1)
|
122
|
+
|
123
|
+
C = np.arange(-1, 1.1, 0.1)
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
for a, b, c in zip(A, B, C):
|
128
|
+
|
129
|
+
print(f"a={a:.6f}, b={a:.6f}, c={c:.6f}")
|
130
|
+
|
131
|
+
# a=-1.000000, b=-1.000000, c=-1.000000
|
132
|
+
|
133
|
+
# a=-0.900000, b=-0.900000, c=-0.900000
|
134
|
+
|
135
|
+
# a=-0.800000, b=-0.800000, c=-0.800000
|
136
|
+
|
137
|
+
# a=-0.700000, b=-0.700000, c=-0.700000
|
138
|
+
|
139
|
+
# a=-0.600000, b=-0.600000, c=-0.600000
|
140
|
+
|
141
|
+
# a=-0.500000, b=-0.500000, c=-0.500000
|
142
|
+
|
143
|
+
# a=-0.400000, b=-0.400000, c=-0.400000
|
144
|
+
|
145
|
+
# a=-0.300000, b=-0.300000, c=-0.300000
|
146
|
+
|
147
|
+
# a=-0.200000, b=-0.200000, c=-0.200000
|
148
|
+
|
149
|
+
# a=-0.100000, b=-0.100000, c=-0.100000
|
150
|
+
|
151
|
+
# a=-0.000000, b=-0.000000, c=-0.000000
|
152
|
+
|
153
|
+
# a=0.100000, b=0.100000, c=0.100000
|
154
|
+
|
155
|
+
# a=0.200000, b=0.200000, c=0.200000
|
156
|
+
|
157
|
+
# a=0.300000, b=0.300000, c=0.300000
|
158
|
+
|
159
|
+
# a=0.400000, b=0.400000, c=0.400000
|
160
|
+
|
161
|
+
# a=0.500000, b=0.500000, c=0.500000
|
162
|
+
|
163
|
+
# a=0.600000, b=0.600000, c=0.600000
|
164
|
+
|
165
|
+
# a=0.700000, b=0.700000, c=0.700000
|
166
|
+
|
167
|
+
# a=0.800000, b=0.800000, c=0.800000
|
168
|
+
|
169
|
+
# a=0.900000, b=0.900000, c=0.900000
|
170
|
+
|
171
|
+
# a=1.000000, b=1.000000, c=1.000000
|
172
|
+
|
173
|
+
```
|
1
d
test
CHANGED
@@ -67,3 +67,27 @@
|
|
67
67
|
y/c=1.000000
|
68
68
|
|
69
69
|
```
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
np.arange は range と違い、step に小数を指定できるので、以下でもよいです。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
```python
|
80
|
+
|
81
|
+
import numpy as np
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
y_c = np.arange(-1, 1.1, 0.1)
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
for y in y_c:
|
90
|
+
|
91
|
+
print(f"y/c={y:.6f}")
|
92
|
+
|
93
|
+
```
|