teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

誤字の修正

2020/08/05 03:15

投稿

hataki7
hataki7

スコア4

title CHANGED
File without changes
body CHANGED
@@ -49,15 +49,15 @@
49
49
  c=2.99792458*1e+8
50
50
  q=1.6021766208*1e-19
51
51
 
52
- pa=math.pi/2#ピッチ角#
52
+ pa=math.pi/2
53
53
  sin_pa=math.sin(pa)
54
54
  from sympy import *
55
55
 
56
- lf1=10#ローレンツ因子#
56
+ lf1=10
57
57
  lf2=100
58
58
  lf3=1000
59
59
 
60
- B1=10*1e-6*1e-4#磁場#
60
+ B1=10*1e-6*1e-4
61
61
  B2=100*1e-6*1e-4
62
62
 
63
63
  omega_c1=3*lf1**2*q*B1*sin_pa/(2*m_e*c)

1

追記

2020/08/05 03:15

投稿

hataki7
hataki7

スコア4

title CHANGED
File without changes
body CHANGED
@@ -35,4 +35,218 @@
35
35
  y = vec_A(xs,F,G,H)
36
36
 
37
37
  ```
38
- ここから、x→ s/a1,s/a2 ~ みたいに変化させたいけど書き方の見当がつかない
38
+ ここから、x→ s/a1,s/a2 ~ みたいに変化させたいけど書き方の見当がつかない
39
+
40
+ ```python
41
+ from scipy.special import kv
42
+ import matplotlib.pyplot as plt
43
+ from scipy.integrate import quad
44
+ import numpy as np
45
+ import math
46
+ from math import gamma
47
+
48
+ m_e=9.10938356*1e-31
49
+ c=2.99792458*1e+8
50
+ q=1.6021766208*1e-19
51
+
52
+ pa=math.pi/2#ピッチ角#
53
+ sin_pa=math.sin(pa)
54
+ from sympy import *
55
+
56
+ lf1=10#ローレンツ因子#
57
+ lf2=100
58
+ lf3=1000
59
+
60
+ B1=10*1e-6*1e-4#磁場#
61
+ B2=100*1e-6*1e-4
62
+
63
+ omega_c1=3*lf1**2*q*B1*sin_pa/(2*m_e*c)
64
+ omega_c2=3*lf2**2*q*B1*sin_pa/(2*m_e*c)
65
+ omega_c3=3*lf3**2*q*B1*sin_pa/(2*m_e*c)
66
+ omega_c4=3*lf1**2*q*B2*sin_pa/(2*m_e*c)
67
+ omega_c5=3*lf2**2*q*B2*sin_pa/(2*m_e*c)
68
+ omega_c6=3*lf3**2*q*B2*sin_pa/(2*m_e*c)
69
+
70
+ ###################################################1#
71
+ ###x→ω x=x*ω_c#
72
+ xs1 = np.linspace(1e-4*omega_c1, 1e2*omega_c1, 10000)
73
+
74
+
75
+ f = lambda z: kv(5/3,z)
76
+ F = [quad(f,x/omega_c1,np.inf)[0]*(x/omega_c1) for x in xs1]
77
+
78
+ a = gamma(1/3)
79
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c1)/2)**(1/3) for x in xs1]
80
+ H = [((math.pi/2)**(1/2))*((x/omega_c1)**(1/2))*(math.exp(-(x/omega_c1)))for x in xs1]
81
+
82
+
83
+
84
+ def A(x,F,G,H):
85
+ if (x/omega_c1) <= 5.0*1e-3:
86
+ g =G
87
+ elif 5.0*1e-3 < (x/omega_c1) < 30:
88
+ g =F
89
+ elif 30 <= (x/omega_c1):
90
+ g =H
91
+ return g
92
+
93
+ vec_A = np.vectorize(A)
94
+ y = vec_A(xs1,F,G,H)
95
+
96
+ P1=(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2))*y
97
+ ###################################################2#
98
+ xs2 = np.linspace(1e-4*omega_c2, 1e2*omega_c2, 10000)
99
+
100
+
101
+ f = lambda z: kv(5/3,z)
102
+ F = [quad(f,x/omega_c2,np.inf)[0]*(x/omega_c2) for x in xs2]
103
+
104
+ a = gamma(1/3)
105
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c2)/2)**(1/3) for x in xs2]
106
+ H = [((math.pi/2)**(1/2))*((x/omega_c2)**(1/2))*(math.exp(-(x/omega_c2)))for x in xs2]
107
+
108
+
109
+
110
+ def A(x,F,G,H):
111
+ if (x/omega_c2) <= 5.0*1e-3:
112
+ g =G
113
+ elif 5.0*1e-3 < (x/omega_c2) < 30:
114
+ g =F
115
+ elif 30 <= (x/omega_c2):
116
+ g =H
117
+ return g
118
+
119
+ vec_A = np.vectorize(A)
120
+ y = vec_A(xs2,F,G,H)
121
+
122
+ P2=(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2))*y
123
+ ###################################################3#
124
+ xs3 = np.linspace(1e-4*omega_c3, 1e2*omega_c3, 10000)
125
+
126
+
127
+ f = lambda z: kv(5/3,z)
128
+ F = [quad(f,x/omega_c3,np.inf)[0]*(x/omega_c3) for x in xs3]
129
+
130
+ a = gamma(1/3)
131
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c3)/2)**(1/3) for x in xs3]
132
+ H = [((math.pi/2)**(1/2))*((x/omega_c3)**(1/2))*(math.exp(-(x/omega_c3)))for x in xs3]
133
+
134
+
135
+
136
+ def A(x,F,G,H):
137
+ if (x/omega_c3) <= 5.0*1e-3:
138
+ g =G
139
+ elif 5.0*1e-3 < (x/omega_c3) < 30:
140
+ g =F
141
+ elif 30 <= (x/omega_c3):
142
+ g =H
143
+ return g
144
+
145
+ vec_A = np.vectorize(A)
146
+ y = vec_A(xs3,F,G,H)
147
+
148
+ P3=(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2))*y
149
+ ###################################################4#
150
+ xs4 = np.linspace(1e-4*omega_c4, 1e2*omega_c4, 10000)
151
+
152
+
153
+ f = lambda z: kv(5/3,z)
154
+ F = [quad(f,x/omega_c4,np.inf)[0]*(x/omega_c4) for x in xs4]
155
+
156
+ a = gamma(1/3)
157
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c4)/2)**(1/3) for x in xs4]
158
+ H = [((math.pi/2)**(1/2))*((x/omega_c4)**(1/2))*(math.exp(-(x/omega_c4)))for x in xs4]
159
+
160
+
161
+
162
+ def A(x,F,G,H):
163
+ if (x/omega_c4) <= 5.0*1e-3:
164
+ g =G
165
+ elif 5.0*1e-3 < (x/omega_c4) < 30:
166
+ g =F
167
+ elif 30 <= (x/omega_c4):
168
+ g =H
169
+ return g
170
+
171
+ vec_A = np.vectorize(A)
172
+ y = vec_A(xs4,F,G,H)
173
+
174
+ P4=(math.sqrt(3)*q**3*B2*sin_pa/(2*math.pi*m_e*c**2))*y
175
+ ###################################################5#
176
+ xs5 = np.linspace(1e-4*omega_c5, 1e2*omega_c5, 10000)
177
+
178
+
179
+ f = lambda z: kv(5/3,z)
180
+ F = [quad(f,x/omega_c5,np.inf)[0]*(x/omega_c5) for x in xs5]
181
+
182
+ a = gamma(1/3)
183
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c5)/2)**(1/3) for x in xs5]
184
+ H = [((math.pi/2)**(1/2))*((x/omega_c5)**(1/2))*(math.exp(-(x/omega_c5)))for x in xs5]
185
+
186
+
187
+
188
+ def A(x,F,G,H):
189
+ if (x/omega_c5) <= 5.0*1e-3:
190
+ g =G
191
+ elif 5.0*1e-3 < (x/omega_c5) < 30:
192
+ g =F
193
+ elif 30 <= (x/omega_c5):
194
+ g =H
195
+ return g
196
+
197
+ vec_A = np.vectorize(A)
198
+ y = vec_A(xs5,F,G,H)
199
+
200
+ P5=(math.sqrt(3)*q**3*B2*sin_pa/(2*math.pi*m_e*c**2))*y
201
+ ###################################################6#
202
+ xs6= np.linspace(1e-4*omega_c6, 1e2*omega_c6, 10000)
203
+
204
+
205
+ f = lambda z: kv(5/3,z)
206
+ F = [quad(f,x/omega_c6,np.inf)[0]*(x/omega_c6) for x in xs6]
207
+
208
+ a = gamma(1/3)
209
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c6)/2)**(1/3) for x in xs6]
210
+ H = [((math.pi/2)**(1/2))*((x/omega_c6)**(1/2))*(math.exp(-(x/omega_c6)))for x in xs6]
211
+
212
+
213
+
214
+ def A(x,F,G,H):
215
+ if (x/omega_c6) <= 5.0*1e-3:
216
+ g =G
217
+ elif 5.0*1e-3 < (x/omega_c6) < 30:
218
+ g =F
219
+ elif 30 <= (x/omega_c6):
220
+ g =H
221
+ return g
222
+
223
+ vec_A = np.vectorize(A)
224
+ y = vec_A(xs6,F,G,H)
225
+
226
+ P6=(math.sqrt(3)*q**3*B2*sin_pa/(2*math.pi*m_e*c**2))*y
227
+
228
+ #####################################################
229
+
230
+ fig = plt.figure()
231
+ ax = fig.add_subplot(1,1,1)
232
+ ax.grid()
233
+ ax.set_xlim(1e-4*omega_c1, 10000*1e2*omega_c1)
234
+ ax.set_ylim(1e-3*(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2)), 100*1e0*(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2)))
235
+ ax.set_yscale('log')
236
+ ax.set_xscale('log')
237
+ ax.set_title('')
238
+ ax.set_xlabel('ω')
239
+ ax.set_ylabel('P')
240
+ ax.plot(xs1,P1,"c",label="1")
241
+ ax.plot(xs2,P2,"r",label="2")
242
+ ax.plot(xs3,P3,"g",label="3")
243
+ ax.plot(xs4,P4,"b",label="4")
244
+ ax.plot(xs5,P5,"black",label="5")
245
+ ax.plot(xs6,P6,"y",label="6")
246
+ ax.legend()
247
+
248
+ plt.show
249
+ ```
250
+ 上記の書き方では、狙っているような変換ができず、プロットされる。
251
+
252
+ ![イメージ説明](b12a54b82468de18f596fde87fd71478.png)