Ahilan Kumaresan commited on
Commit
a5ec874
·
1 Parent(s): 5807ca9

added the harmonic potential function

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -473,8 +473,19 @@ def kinetic_operator(N, dx, hbar=1, m=1):
473
  T = (-(hbar**2 / (2*m)) * D2)
474
  return T
475
  """, language="python")
476
- st.success("Confirmed: Correct implementation of the Finite Difference Laplacian.")
477
-
 
 
 
 
 
 
 
 
 
 
 
478
  # ==========================================
479
  # 6. PAGE: THEORY
480
  # ==========================================
 
473
  T = (-(hbar**2 / (2*m)) * D2)
474
  return T
475
  """, language="python")
476
+ st.code("""
477
+ def harmonic(x,k,center=0.0):
478
+ # A Parabola, setting the global k-value.
479
+ global Last_k_value
480
+ Last_k_value = k
481
+
482
+ constant_factor = 1
483
+ potential = 0.5*k*(x - center)**2
484
+ return constant_factor * potential
485
+ """)
486
+
487
+
488
+
489
  # ==========================================
490
  # 6. PAGE: THEORY
491
  # ==========================================