Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Python Calculator

1. Units, Constants and quick calculations

scipy.constants knows every physical constant (full list):

A scratchpad, seeded with a photon-energy calculation. Edit it and press play; the value of the last line is displayed:

2. Plotting panel

A ready-to-edit plotting template. Swap in any function of x; the slider is yours to repurpose:

3. Numerical integral

Define any function and limits in the pad; the plot shades area above the axis in green and below in red, and the value comes from np.trapezoid, the same tool your homework uses:

The green and red areas fight each other: an integral is a signed sum. For probability densities like ∣ψ∣2|\psi|^2 the red never appears, which is exactly why they can be interpreted as probabilities.

4. Symbolic window

Derivatives, integrals, and equation solving with sympy; results render as typeset math. Each pad is editable:

5. Orbital visualizer

Pick quantum numbers (the menus only ever offer valid combinations). The first plot is a 2D cross-section of the orbital in the xz-plane, with blue and red marking the wavefunction’s positive and negative lobes. Below it, the radial view shows the radial function Rnl(r)R_{nl}(r) and the radial distribution P(r)=r2R2P(r) = r^2 R^2, and reports the most probable radius, the mean radius ⟨r⟩\langle r\rangle, and the node count.

6. One-dimensional Schrödinger solver

Pick a potential and get its bound states instantly: energies as horizontal lines, wavefunctions drawn at their own energy (units: ℏ=m=1\hbar = m = 1, hard walls at x=±4x = \pm 4). To see how the solver works inside, open the numerical Schrödinger lab.

Try the classics: the box gives the n2n^2 ladder, the harmonic well gives perfectly even spacing (the fingerprint of vibrations), the linear well spaces levels like Airy zeros, and the double well pairs levels into tunneling doublets. The square barrier does the same with sharp walls: it cuts the box into two halves that talk only by tunneling, so raise aa and watch each pair of levels squeeze together.

7. Tunneling through a square barrier

An electron with energy EE comes in from the left toward a barrier of height V0V_0 and width aa. Classically it bounces back whenever E<V0E < V_0. Quantum mechanically the wave leaks in, decays as e−κxe^{-\kappa x} inside, and whatever amplitude reaches the far side carries on as a transmitted wave. The fraction that gets through is

T=[1+V02sinh⁡2(κa)4E(V0−E)]−1,κ=2m(V0−E)ℏT = \left[1 + \frac{V_0^2 \sinh^2(\kappa a)}{4E(V_0 - E)}\right]^{-1}, \qquad \kappa = \frac{\sqrt{2m(V_0 - E)}}{\hbar}

For a thick barrier (κa≫1\kappa a \gg 1) this becomes T≈16EV0(1−EV0)e−2κaT \approx 16\frac{E}{V_0}\left(1 - \frac{E}{V_0}\right)e^{-2\kappa a}, exponential in the width. Units here are eV and Å with the electron mass. The derivation is in the tunneling lecture.

Start below the barrier and widen it in steps of 1 Å: TT drops by roughly the same factor each step, and the log scale turns that exponential into a straight line. Then push EE above V0V_0: the classical electron always passes, but the quantum one still reflects, and TT wiggles up to 1 only at the resonances. The same exponential is why a scanning tunneling microscope current changes about tenfold per ångström of tip height, and why a proton, 1836 times heavier than an electron, has a κ\kappa about 43 times larger and tunnels only through barriers a fraction of an ångström thick.

8. Quadratic equation solver

Every quadratic ax2+bx+c=0ax^2 + bx + c = 0 is solved by one formula:

x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

The sign of the discriminant Δ=b2−4ac\Delta = b^2 - 4ac decides what comes out: two real crossings for Δ>0\Delta > 0, one repeated root for Δ=0\Delta = 0, and for Δ<0\Delta < 0 a pair of complex conjugates that never touch the axis. Drag the coefficients and watch the roots leave the real line.

Start from the defaults and raise cc: the two crossings slide together, merge at Δ=0\Delta = 0, and then step off the real line as a mirror pair, real part shared and imaginary parts opposite. The curve stops touching the axis, but the number of roots never changes. That is the fundamental theorem of algebra in miniature: a degree nn polynomial has exactly nn complex roots. The background is in the complex numbers appendix.