質問編集履歴

2

誤字の修正

2020/08/05 03:15

投稿

hataki7
hataki7

スコア4

test CHANGED
File without changes
test CHANGED
@@ -100,7 +100,7 @@
100
100
 
101
101
 
102
102
 
103
- pa=math.pi/2#ピッチ角#
103
+ pa=math.pi/2
104
104
 
105
105
  sin_pa=math.sin(pa)
106
106
 
@@ -108,7 +108,7 @@
108
108
 
109
109
 
110
110
 
111
- lf1=10#ローレンツ因子#
111
+ lf1=10
112
112
 
113
113
  lf2=100
114
114
 
@@ -116,7 +116,7 @@
116
116
 
117
117
 
118
118
 
119
- B1=10*1e-6*1e-4#磁場#
119
+ B1=10*1e-6*1e-4
120
120
 
121
121
  B2=100*1e-6*1e-4
122
122
 

1

追記

2020/08/05 03:15

投稿

hataki7
hataki7

スコア4

test CHANGED
File without changes
test CHANGED
@@ -73,3 +73,431 @@
73
73
  ```
74
74
 
75
75
  ここから、x→ s/a1,s/a2 ~ みたいに変化させたいけど書き方の見当がつかない
76
+
77
+
78
+
79
+ ```python
80
+
81
+ from scipy.special import kv
82
+
83
+ import matplotlib.pyplot as plt
84
+
85
+ from scipy.integrate import quad
86
+
87
+ import numpy as np
88
+
89
+ import math
90
+
91
+ from math import gamma
92
+
93
+
94
+
95
+ m_e=9.10938356*1e-31
96
+
97
+ c=2.99792458*1e+8
98
+
99
+ q=1.6021766208*1e-19
100
+
101
+
102
+
103
+ pa=math.pi/2#ピッチ角#
104
+
105
+ sin_pa=math.sin(pa)
106
+
107
+ from sympy import *
108
+
109
+
110
+
111
+ lf1=10#ローレンツ因子#
112
+
113
+ lf2=100
114
+
115
+ lf3=1000
116
+
117
+
118
+
119
+ B1=10*1e-6*1e-4#磁場#
120
+
121
+ B2=100*1e-6*1e-4
122
+
123
+
124
+
125
+ omega_c1=3*lf1**2*q*B1*sin_pa/(2*m_e*c)
126
+
127
+ omega_c2=3*lf2**2*q*B1*sin_pa/(2*m_e*c)
128
+
129
+ omega_c3=3*lf3**2*q*B1*sin_pa/(2*m_e*c)
130
+
131
+ omega_c4=3*lf1**2*q*B2*sin_pa/(2*m_e*c)
132
+
133
+ omega_c5=3*lf2**2*q*B2*sin_pa/(2*m_e*c)
134
+
135
+ omega_c6=3*lf3**2*q*B2*sin_pa/(2*m_e*c)
136
+
137
+
138
+
139
+ ###################################################1#
140
+
141
+ ###x→ω x=x*ω_c#
142
+
143
+ xs1 = np.linspace(1e-4*omega_c1, 1e2*omega_c1, 10000)
144
+
145
+
146
+
147
+
148
+
149
+ f = lambda z: kv(5/3,z)
150
+
151
+ F = [quad(f,x/omega_c1,np.inf)[0]*(x/omega_c1) for x in xs1]
152
+
153
+
154
+
155
+ a = gamma(1/3)
156
+
157
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c1)/2)**(1/3) for x in xs1]
158
+
159
+ H = [((math.pi/2)**(1/2))*((x/omega_c1)**(1/2))*(math.exp(-(x/omega_c1)))for x in xs1]
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ def A(x,F,G,H):
168
+
169
+ if (x/omega_c1) <= 5.0*1e-3:
170
+
171
+ g =G
172
+
173
+ elif 5.0*1e-3 < (x/omega_c1) < 30:
174
+
175
+ g =F
176
+
177
+ elif 30 <= (x/omega_c1):
178
+
179
+ g =H
180
+
181
+ return g
182
+
183
+
184
+
185
+ vec_A = np.vectorize(A)
186
+
187
+ y = vec_A(xs1,F,G,H)
188
+
189
+
190
+
191
+ P1=(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2))*y
192
+
193
+ ###################################################2#
194
+
195
+ xs2 = np.linspace(1e-4*omega_c2, 1e2*omega_c2, 10000)
196
+
197
+
198
+
199
+
200
+
201
+ f = lambda z: kv(5/3,z)
202
+
203
+ F = [quad(f,x/omega_c2,np.inf)[0]*(x/omega_c2) for x in xs2]
204
+
205
+
206
+
207
+ a = gamma(1/3)
208
+
209
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c2)/2)**(1/3) for x in xs2]
210
+
211
+ H = [((math.pi/2)**(1/2))*((x/omega_c2)**(1/2))*(math.exp(-(x/omega_c2)))for x in xs2]
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ def A(x,F,G,H):
220
+
221
+ if (x/omega_c2) <= 5.0*1e-3:
222
+
223
+ g =G
224
+
225
+ elif 5.0*1e-3 < (x/omega_c2) < 30:
226
+
227
+ g =F
228
+
229
+ elif 30 <= (x/omega_c2):
230
+
231
+ g =H
232
+
233
+ return g
234
+
235
+
236
+
237
+ vec_A = np.vectorize(A)
238
+
239
+ y = vec_A(xs2,F,G,H)
240
+
241
+
242
+
243
+ P2=(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2))*y
244
+
245
+ ###################################################3#
246
+
247
+ xs3 = np.linspace(1e-4*omega_c3, 1e2*omega_c3, 10000)
248
+
249
+
250
+
251
+
252
+
253
+ f = lambda z: kv(5/3,z)
254
+
255
+ F = [quad(f,x/omega_c3,np.inf)[0]*(x/omega_c3) for x in xs3]
256
+
257
+
258
+
259
+ a = gamma(1/3)
260
+
261
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c3)/2)**(1/3) for x in xs3]
262
+
263
+ H = [((math.pi/2)**(1/2))*((x/omega_c3)**(1/2))*(math.exp(-(x/omega_c3)))for x in xs3]
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+ def A(x,F,G,H):
272
+
273
+ if (x/omega_c3) <= 5.0*1e-3:
274
+
275
+ g =G
276
+
277
+ elif 5.0*1e-3 < (x/omega_c3) < 30:
278
+
279
+ g =F
280
+
281
+ elif 30 <= (x/omega_c3):
282
+
283
+ g =H
284
+
285
+ return g
286
+
287
+
288
+
289
+ vec_A = np.vectorize(A)
290
+
291
+ y = vec_A(xs3,F,G,H)
292
+
293
+
294
+
295
+ P3=(math.sqrt(3)*q**3*B1*sin_pa/(2*math.pi*m_e*c**2))*y
296
+
297
+ ###################################################4#
298
+
299
+ xs4 = np.linspace(1e-4*omega_c4, 1e2*omega_c4, 10000)
300
+
301
+
302
+
303
+
304
+
305
+ f = lambda z: kv(5/3,z)
306
+
307
+ F = [quad(f,x/omega_c4,np.inf)[0]*(x/omega_c4) for x in xs4]
308
+
309
+
310
+
311
+ a = gamma(1/3)
312
+
313
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c4)/2)**(1/3) for x in xs4]
314
+
315
+ H = [((math.pi/2)**(1/2))*((x/omega_c4)**(1/2))*(math.exp(-(x/omega_c4)))for x in xs4]
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+ def A(x,F,G,H):
324
+
325
+ if (x/omega_c4) <= 5.0*1e-3:
326
+
327
+ g =G
328
+
329
+ elif 5.0*1e-3 < (x/omega_c4) < 30:
330
+
331
+ g =F
332
+
333
+ elif 30 <= (x/omega_c4):
334
+
335
+ g =H
336
+
337
+ return g
338
+
339
+
340
+
341
+ vec_A = np.vectorize(A)
342
+
343
+ y = vec_A(xs4,F,G,H)
344
+
345
+
346
+
347
+ P4=(math.sqrt(3)*q**3*B2*sin_pa/(2*math.pi*m_e*c**2))*y
348
+
349
+ ###################################################5#
350
+
351
+ xs5 = np.linspace(1e-4*omega_c5, 1e2*omega_c5, 10000)
352
+
353
+
354
+
355
+
356
+
357
+ f = lambda z: kv(5/3,z)
358
+
359
+ F = [quad(f,x/omega_c5,np.inf)[0]*(x/omega_c5) for x in xs5]
360
+
361
+
362
+
363
+ a = gamma(1/3)
364
+
365
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c5)/2)**(1/3) for x in xs5]
366
+
367
+ H = [((math.pi/2)**(1/2))*((x/omega_c5)**(1/2))*(math.exp(-(x/omega_c5)))for x in xs5]
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+ def A(x,F,G,H):
376
+
377
+ if (x/omega_c5) <= 5.0*1e-3:
378
+
379
+ g =G
380
+
381
+ elif 5.0*1e-3 < (x/omega_c5) < 30:
382
+
383
+ g =F
384
+
385
+ elif 30 <= (x/omega_c5):
386
+
387
+ g =H
388
+
389
+ return g
390
+
391
+
392
+
393
+ vec_A = np.vectorize(A)
394
+
395
+ y = vec_A(xs5,F,G,H)
396
+
397
+
398
+
399
+ P5=(math.sqrt(3)*q**3*B2*sin_pa/(2*math.pi*m_e*c**2))*y
400
+
401
+ ###################################################6#
402
+
403
+ xs6= np.linspace(1e-4*omega_c6, 1e2*omega_c6, 10000)
404
+
405
+
406
+
407
+
408
+
409
+ f = lambda z: kv(5/3,z)
410
+
411
+ F = [quad(f,x/omega_c6,np.inf)[0]*(x/omega_c6) for x in xs6]
412
+
413
+
414
+
415
+ a = gamma(1/3)
416
+
417
+ G = [(4*math.pi/np.sqrt(3)/a)*((x/omega_c6)/2)**(1/3) for x in xs6]
418
+
419
+ H = [((math.pi/2)**(1/2))*((x/omega_c6)**(1/2))*(math.exp(-(x/omega_c6)))for x in xs6]
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+ def A(x,F,G,H):
428
+
429
+ if (x/omega_c6) <= 5.0*1e-3:
430
+
431
+ g =G
432
+
433
+ elif 5.0*1e-3 < (x/omega_c6) < 30:
434
+
435
+ g =F
436
+
437
+ elif 30 <= (x/omega_c6):
438
+
439
+ g =H
440
+
441
+ return g
442
+
443
+
444
+
445
+ vec_A = np.vectorize(A)
446
+
447
+ y = vec_A(xs6,F,G,H)
448
+
449
+
450
+
451
+ P6=(math.sqrt(3)*q**3*B2*sin_pa/(2*math.pi*m_e*c**2))*y
452
+
453
+
454
+
455
+ #####################################################
456
+
457
+
458
+
459
+ fig = plt.figure()
460
+
461
+ ax = fig.add_subplot(1,1,1)
462
+
463
+ ax.grid()
464
+
465
+ ax.set_xlim(1e-4*omega_c1, 10000*1e2*omega_c1)
466
+
467
+ 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)))
468
+
469
+ ax.set_yscale('log')
470
+
471
+ ax.set_xscale('log')
472
+
473
+ ax.set_title('')
474
+
475
+ ax.set_xlabel('ω')
476
+
477
+ ax.set_ylabel('P')
478
+
479
+ ax.plot(xs1,P1,"c",label="1")
480
+
481
+ ax.plot(xs2,P2,"r",label="2")
482
+
483
+ ax.plot(xs3,P3,"g",label="3")
484
+
485
+ ax.plot(xs4,P4,"b",label="4")
486
+
487
+ ax.plot(xs5,P5,"black",label="5")
488
+
489
+ ax.plot(xs6,P6,"y",label="6")
490
+
491
+ ax.legend()
492
+
493
+
494
+
495
+ plt.show
496
+
497
+ ```
498
+
499
+ 上記の書き方では、狙っているような変換ができず、プロットされる。
500
+
501
+
502
+
503
+ ![イメージ説明](b12a54b82468de18f596fde87fd71478.png)