-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathglobalvariables.py
More file actions
70 lines (60 loc) · 1.56 KB
/
globalvariables.py
File metadata and controls
70 lines (60 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 13 15:21:27 2024
@author: Jacob Watkiss
"""
import numpy as np
"""
I have made this against my best nature,
I wish there were 0 global variables in
the code, but I think that certain things
(such as IErr, the error checker) and
universal constants like c, e and h should
be referable so that they don't have to be
declared every time.
I am aware that numpy is good for some constants
and scipy can do any others, but I am merely
translating this code, so I have just copied
the values for these constants from the original
felix.
All values in here should be constants except for,
of course, IErr.
- Jacob
"""
IErr=0
TINY=10**-9
HUGE=10**9
RSpeedOfLight=float(2.99762458*10**8)
RElectronMass=float(9.10938291*10**-31)
RElectronMassMeV=float(0.510998928)
RPlanckConstant=float(6.62606957*10**-34)
RElectronCharge=float(1.602176565*10**-19)
RAngstromConversion=float(10**10)
def cos(angle):
if angle==0:
result=1
elif angle==np.pi/6:
result=np.sqrt(3)/2
elif angle==np.pi/4:
result=1/np.sqrt(2)
elif angle==np.pi/3:
result=1/2
elif angle==np.pi/2:
result=0
else:
result=np.cos(angle)
return result
def sin(angle):
if angle==0:
result=0
elif angle==np.pi/6:
result=1/2
elif angle==np.pi/4:
result=1/np.sqrt(2)
elif angle==np.pi/3:
result=np.sqrt(3)/2
elif angle==np.pi/2:
result=1
else:
result=np.sin(angle)
return result