Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Virtual environments
.venv/
venv/
env/

# Distribution / packaging
build/
dist/
*.egg-info/
*.egg

# Jupyter Notebook checkpoints
.ipynb_checkpoints/

# OS files
Thumbs.db
.DS_Store

# IDE
.vscode/
.idea/

# Logs
*.log
25 changes: 18 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
ipython>=8.5.0
jupytext>=1.16.2
matplotlib>=3.6.1
mpmath>=1.2.1
numpy>=1.23.3
scipy>=1.9.0
sympy>=1.11.1
ipython>=8.18.1
jupytext>=1.16.4
matplotlib>=3.8.2
matplotlib-inline>=0.1.6
mpmath>=1.3.0
numpy>=1.26.4
scipy>=1.11.4
sympy>=1.12.1

# Used by sympy.parsing.latex.parse_latex (see libphysics/src/libsympy.py)
antlr4-python3-runtime==4.11

# Logging
loguru>=0.7.0

# Torch utilities (see libphysics/src/libsympy.py, libphysics/src/libtorch.py)
torch>=2.0.0
torchquad>=0.5.0
12 changes: 5 additions & 7 deletions src/libsympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
from sympy.parsing.latex import parse_latex
from sympy.parsing.sympy_parser import parse_expr
from sympy.interactive import printing
printing.init_printing()

printing.init_printing()

# Sets global defaults for all plots
plt.rcParams.update({
Expand Down Expand Up @@ -297,7 +297,7 @@ def get_iterated_functions(f, fixed_vals={C1:0, C2:0}, prm=alpha,
funcs = list(map(ifunc, param_vals))
return(funcs)

def get_piecewise():
def get_piecewise(fV, xs):
"""
todo
Returns a piecewise function of the function.
Expand All @@ -318,7 +318,6 @@ def getfV(self, fV, xs):
return(res)
"""
xintervals = []
[fV, xs] = [self.V, self.xs]
for i in range(len(xs)):
if i == 0:
xintervals.append((fV[i], x < xs[i]))
Expand Down Expand Up @@ -406,13 +405,12 @@ def tensor_to_product(expr):
expr = TensorProduct(a, b) + TensorProduct(a, b, c)
converted = tensor_to_product(expr)
"""
from sympy.physics.quantum import TensorProduct as _TensorProduct
return expr.replace(
lambda x: isinstance(x, TensorProduct),
lambda x: isinstance(x, _TensorProduct),
lambda x: Mul(*x.args)
)


#----Plotting
#----Plotting
def plot_energy_levels(data, constYs=None, title="", line_width=0.025):
"""
Plots horizontal lines at y-points grouped by x-coordinates.
Expand Down
Loading