<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nikolaos Pallikarakis, PhD on Medium]]></title>
        <description><![CDATA[Stories by Nikolaos Pallikarakis, PhD on Medium]]></description>
        <link>https://medium.com/@pallikarakis.n?source=rss-7ce73d3dd489------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y_9dY4IdOAjcFKAlHX0Ohg.jpeg</url>
            <title>Stories by Nikolaos Pallikarakis, PhD on Medium</title>
            <link>https://medium.com/@pallikarakis.n?source=rss-7ce73d3dd489------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 20:03:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pallikarakis.n/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Solving the Heat Equation with Physics-Informed Neural Networks: PyTorch vs TensorFlow]]></title>
            <link>https://medium.com/@pallikarakis.n/solving-the-heat-equation-with-physics-informed-neural-networks-pytorch-vs-tensorflow-1b82d10fa5da?source=rss-7ce73d3dd489------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b82d10fa5da</guid>
            <category><![CDATA[pdes-2701]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[physics-informed-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Nikolaos Pallikarakis, PhD]]></dc:creator>
            <pubDate>Mon, 18 May 2026 14:38:35 GMT</pubDate>
            <atom:updated>2026-05-18T14:47:50.679Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Reference: </em>This article builds on my previous work: <em>Solving the Heat Equation with Physics-Informed Neural Networks: A Practical Guide</em> found <a href="https://medium.com/@pallikarakis.n/solving-the-heat-equation-with-physics-informed-neural-networks-a-practical-guide-25df376f1b04">here</a>. For a detailed introduction to the core PINN concepts and the PDE problem definition, please refer to that article.</p><h3>Introduction</h3><p>In the previous article, we built a PINN from scratch using TensorFlow to solve a 1D heat equation with a source term. The network learned to satisfy the PDE without any labeled solution data, purely by embedding the physical laws into its loss function.</p><p>While the TensorFlow implementation was successful, there is growing interest in the PyTorch ecosystem for scientific computing, particularly for research and rapid prototyping. In this article, we’ll:</p><ol><li>Convert the entire PINN workflow to PyTorch</li><li>Explain the key differences between the TensorFlow and PyTorch implementations</li><li>Compare the performance and accuracy of both frameworks side-by-side</li><li>Provide a complete, reusable PyTorch PINN template</li></ol><h3>1. PyTorch PINNs Implementation</h3><p>The full code is available on <a href="https://github.com/npallikarakis/heat_pinn">GitHub</a>. Let’s break down the key components.</p><h4>1.1 Problem Definition (Identical to TensorFlow)</h4><p>The problem remains unchanged. We consider the 1D heat equation with a source term, same initial and boundary conditions and of course same exact solution.</p><h4>1.2 Generating Training Data (Same Strategy)</h4><p>We use 3,000 random interior collocation points, 150 initial condition points at t=0, and 20 boundary points per edge (mix of grid and random points).</p><pre>def generate_training_data(n_interior=3000, n_ic=150, n_bc=20, n_bc_grid=5, seed=42):<br>    np.random.seed(seed)<br>    X_interior = np.random.rand(n_interior, 2).astype(np.float32)<br>    # ... (identical to TensorFlow version)<br>    return X_interior, X_ic, y_ic, X_bc, y_bc</pre><h4>1.3 Neural Network Architecture (Same Structure)</h4><p>The network has 3 hidden layers with 64 neurons each and tanh activation:</p><pre>class PINN(nn.Module):<br>    def __init__(self, hidden_layers=3, hidden_units=64):<br>        super(PINN, self).__init__()<br>        layers = []<br>        layers.append(nn.Linear(2, hidden_units))<br>        layers.append(nn.Tanh())<br>        for _ in range(hidden_layers - 1):<br>            layers.append(nn.Linear(hidden_units, hidden_units))<br>            layers.append(nn.Tanh())<br>        layers.append(nn.Linear(hidden_units, 1))<br>        self.net = nn.Sequential(*layers)<br><br>        # Xavier (Glorot) uniform initialization<br>        def init_weights(m):<br>            if isinstance(m, nn.Linear):<br>                nn.init.xavier_uniform_(m.weight)<br>                nn.init.zeros_(m.bias)<br>        self.apply(init_weights)<br><br>    def forward(self, x):<br>        return self.net(x)</pre><p><em>Note:</em> The explicit class definition is PyTorch’s idiomatic way, equivalent to TensorFlow’s Sequential API.</p><h4>1.4 The Heart of PINNs: Computing PDE Residuals with torch.autograd</h4><p>This is where the most significant difference lies. In TensorFlow, we used tf.GradientTape(persistent=True) to compute first and second derivatives:</p><pre>with tf.GradientTape(persistent=True) as tape:<br>    u = model(tf.concat([x, t], axis=1))<br>    u_x = tape.gradient(u, x)<br>    u_xx = tape.gradient(u_x, x)<br>    u_t = tape.gradient(u, t)</pre><p>In PyTorch, we use torch.autograd.grad() in a similar but slightly more explicit manner:</p><pre># Forward pass<br>u = model(torch.cat([x_int, t_int], dim=1))<br><br># Compute derivatives<br>u_x = torch.autograd.grad(u, x_int, grad_outputs=torch.ones_like(u), create_graph=True)[0]<br>u_xx = torch.autograd.grad(u_x, x_int, grad_outputs=torch.ones_like(u_x), create_graph=True)[0]<br>u_t = torch.autograd.grad(u, t_int, grad_outputs=torch.ones_like(u), create_graph=True)[0]</pre><p>The key points are:</p><ul><li>grad_outputs=torch.ones_like(u) provides the initial gradient vector</li><li>create_graph=True enables second-order differentiation (essential for PINNs)</li><li>We access the first element of the returned tuple (the actual gradient)</li></ul><h4>1.5 Training Loop</h4><p>The training loop follows the same structure as TensorFlow:</p><pre>def train_pinn(model, X_interior, X_ic, y_ic, X_bc, y_bc, ...):<br>    # Convert data to torch tensors<br>    X_int_t = torch.tensor(X_interior, requires_grad=True)<br>    # ... move to device, define optimizer, etc.<br>    <br>    for epoch in range(epochs):<br>        optimizer.zero_grad()<br>        <br>        # Compute PDE residual, IC, BC losses<br>        # ...<br>        <br>        loss_total.backward()<br>        torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)<br>        optimizer.step()<br>        scheduler.step()</pre><p>Key differences to note:</p><ul><li>PyTorch uses .zero_grad() explicitly before each backward pass</li><li>Gradient clipping with clip_grad_norm_ instead of tf.clip_by_global_norm</li><li>Explicit device management with .to(device)</li></ul><h3>2. Key Differences Between TensorFlow and PyTorch for PINNs</h3><pre>| Aspect                    | TensorFlow (tf.keras)                              | PyTorch (nn.Module)                          |<br>|---------------------------|----------------------------------------------------|----------------------------------------------|<br>| Model Definition          | Sequential API with layer objects                  | Class inheriting from `nn.Module`            |<br>| Automatic Differentiation | `tf.GradientTape(persistent=True)`                 | `torch.autograd.grad(..., create_graph=True)`|<br>| Gradient Application      | `optimizer.apply_gradients(zip(grads, variables))` | `optimizer.step()` after `loss.backward()`   |<br>| Gradient Zeroing          | Ephemeral tape (discarded each epoch)              | Explicit `optimizer.zero_grad()`             |<br>| Device Management         | Automatic with `tf.device`                         | Explicit with `.to(device)` and `.cuda()`    |</pre><p><em>Note:</em> For second‑order derivatives, PyTorch requires create_graph=True to retain the gradient graph – a small but important detail for PINNs.</p><h3>3. Results and Visualization</h3><p>After training for 8000 epochs, we achieve excellent agreement with the exact solution:</p><p>PyTorch PINN Results:</p><ul><li>Mean Squared Error (MSE): 2.592 × 10⁻⁵</li><li>L2 Error: 5.115 × 10⁻³</li><li>L∞ Error: 2.381 × 10⁻²</li></ul><p>The figures below show the 3D surface comparison, loss curves, and solution snapshots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Ifqsk9OjD7JPgeHXxV9mg.png" /><figcaption>Figure 1: 3D Solution Comparison</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_kvONz8DnESVqN2h07vr0w.png" /><figcaption>Figure 2: Solution Snapshots at Different Times</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3EIxX3SDxJJVz5gvJyT4KQ.png" /><figcaption>Figure 3: Loss Curves During Training</figcaption></figure><h3>4. Point-by-Point Comparison: PyTorch vs. TensorFlow</h3><p>I ran both implementations on the same hardware (NVIDIA RTX 4050 Laptop GPU) for a fair comparison. The hyperparameters were identical across both runs (8000 epochs, 3×64 architecture, polynomial learning rate schedule).</p><p>TensorFlow Environment: tensorflow-gpu 2.10.1, CUDA 11.8, cuDNN 8.1<br>PyTorch Environment: torch 2.5.1+cu118, CUDA 11.8</p><pre>| Metric                    | TensorFlow      | PyTorch          | Winner          <br>|---------------------------|-----------------|------------------|-----------------<br>| Final L2 Error            | 3.649 × 10⁻³    | 5.115 × 10⁻³     | TF (30% lower)  <br>| Final MSE                 | 1.319 × 10⁻⁵    | 2.592 × 10⁻⁵     | TF              <br>| L∞ Error                  | 1.814 × 10⁻²    | 2.381 × 10⁻²     | TF              <br>| Training Time (8000 ep.)  | 333.6 sec       | 119.6 sec        | PT (2.8× faster)</pre><p>Analysis:</p><ul><li>Accuracy: TensorFlow achieves approximately 30% lower L2 error, suggesting its optimization path and automatic differentiation may be slightly better suited for this particular PDE.</li><li>Speed: PyTorch trains nearly three times faster, making it more efficient for rapid experimentation and iterative development.</li></ul><h3>5. Why These Differences Occur</h3><p>Several factors explain the observed differences:</p><ol><li>Numerical Precision: By default, PyTorch disables TF32 for matrix multiplications, while TensorFlow may handle this differently depending on the version. Since these settings were not explicitly aligned, the two frameworks may have operated at slightly different numerical precisions, which could partially explain the observed accuracy gap.</li><li>Automatic Differentiation Implementation: TensorFlow’s GradientTape and PyTorch&#39;s autograd.grad use different graph construction strategies. While both produce correct results, subtle differences in how second derivatives are cached and reused can affect both speed and numerical stability.</li><li>Framework Maturity for PINNs: PINNs require second-order automatic differentiation, which both frameworks handle well. TensorFlow was used in the seminal PINN papers by Raissi et al. (2019), giving it historical precedence. However, modern PINN libraries (e.g., DeepXDE) support both frameworks, and the current landscape is largely framework‑agnostic.</li></ol><p><em>Note:</em> Even with identical seeds, the initial weight values differ because the random number generators are not synchronised across frameworks. This is unavoidable and does not bias the comparison — the statistical distribution (Xavier uniform) is the same.</p><h3>6. Conclusion and Recommendations</h3><p>For Research and Prototyping: PyTorch’s speed (2.8× faster) and Pythonic design make it ideal for rapid iteration and experimentation. The code is intuitive and easier to debug, which is valuable when trying new network architectures or loss formulations.</p><p>For Production and Highest Accuracy: TensorFlow’s slightly better final accuracy may be preferred for applications where every bit of precision matters, such as scientific simulations or engineering design. (<em>Note</em>: this conclusion is based on a single run; multiple random seeds would be needed to confirm statistical significance.)</p><p>What I Learned:</p><ul><li>Both frameworks are fully capable of implementing PINNs</li><li>The choice should be driven by your specific priorities (accuracy vs. speed)</li><li>Framework differences are smaller than often assumed — the same architecture and hyperparameters yield comparable results</li></ul><p>The complete PyTorch implementation is available on <a href="https://github.com/npallikarakis/heat_pinn">GitHub</a>. Feel free to adapt it for your own PDEs and experiments.</p><p><em>Tags: #MachineLearning #ScientificMachineLearning</em> <em>#PhysicsInformedNeuralNetworks #PINNs #ScientificComputing #DeepLearning #HeatEquation #PyTorch #TensorFlow</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b82d10fa5da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solving the Heat Equation with Physics-Informed Neural Networks: A Practical Guide]]></title>
            <link>https://medium.com/@pallikarakis.n/solving-the-heat-equation-with-physics-informed-neural-networks-a-practical-guide-25df376f1b04?source=rss-7ce73d3dd489------2</link>
            <guid isPermaLink="false">https://medium.com/p/25df376f1b04</guid>
            <category><![CDATA[physics-informed-learning]]></category>
            <category><![CDATA[machine-learning-python]]></category>
            <category><![CDATA[numerical-methods]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[differential-equations]]></category>
            <dc:creator><![CDATA[Nikolaos Pallikarakis, PhD]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 11:50:52 GMT</pubDate>
            <atom:updated>2026-05-18T14:21:30.581Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*mkxch8ltibuubxREAaF1yA.png" /></figure><h3>Introduction</h3><p>Physics-Informed Neural Networks (PINNs) represent a paradigm shift in scientific computing, merging the power of deep learning with the rigor of physics-based modeling. In this article, we’ll build a PINN from scratch to solve a non-trivial heat equation problem, demonstrating how neural networks can learn to satisfy partial differential equations (PDEs) without requiring labeled solution data (full code is available on my G<a href="https://github.com/npallikarakis/heat_pinn">itHub</a> page).</p><h3>1. What Are Physics-Informed Neural Networks?</h3><h3>The Core Idea</h3><p>Physics-Informed Neural Networks (PINNs), introduced by Raissi et al. (2019) in their seminal paper, encode physical laws directly into the loss function of a neural network.</p><p>Key Reference:</p><blockquote><a href="https://www.sciencedirect.com/science/article/pii/S0021999118307125"><em>Raissi, M., Perdikaris, P., &amp; Karniadakis, G. E. (2019). </em>Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations<em>. Journal of Computational Physics, 378, 686–707.</em></a></blockquote><h3>Why PINNs Matter</h3><p>Traditional numerical methods (finite differences, finite elements) discretize space and time, requiring mesh generation for complex geometries, having stability constraints on time-stepping and high computational cost for fine grids.</p><p>PINNs offer several advantages:</p><ol><li>Mesh-free: Neural networks are universal function approximators that don’t require discretization</li><li>Data-efficient: Can work with sparse measurements by leveraging physics</li><li>Inverse problem capability: Simultaneously learn solutions and unknown parameters</li><li>Automatic differentiation: TensorFlow/PyTorch compute derivatives exactly via backpropagation</li></ol><h3>How PINNs Work</h3><p>Instead of supervised learning with labeled pairs (<em>x</em>,<em>u</em>(<em>x</em>)), PINNs minimize a physics-based loss:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/0*s5aThaEfcBaA2kII" /></figure><p>Where:</p><ul><li>PDE Loss: Residual of the differential equation at interior collocation points</li><li>IC Loss: Violation of initial conditions</li><li>BC Loss: Violation of boundary conditions</li></ul><p>The network learns weights that make all three terms small simultaneously.</p><h3>2. Mathematical Problem Definition</h3><p>We consider a 1D heat equation with a source term on the domain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/0*EXgNugdExCNTnxXh" /></figure><p>Partial Differential Equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/0*CkPzsFeGJymoe628" /></figure><p>Initial Condition:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/0*zwd6X1sQsyR3IxoF" /></figure><p>Boundary Conditions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/155/0*ZTRSXOaHOBP2PriO" /></figure><p>Forcing Term:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*hxF6nGk4BcwwW7aS" /></figure><p>The above problem has an exact solution, which will we use for evaluating the PINN solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/0*NUOc8xZxJtk0zJq6" /></figure><p>This solution consists of an exponential decay term representing classical heat diffusion and an oscillatory boundary-driven term modeling time-varying forcing.</p><h3>3. Implementation: Breaking Down the Code</h3><p>Let’s build our PINN step by step using TensorFlow 2.x.</p><h3>Step 1: Define the Exact Solution and Forcing Term</h3><pre>import numpy as np<br>import tensorflow as tf<br><br>PI = np.pi<br>CONST = PI / 2<br>AC_AMPLITUDE = 0.3<br><br>def exact_solution(x, t):<br>    &quot;&quot;&quot;<br>    Exact solution: u(x,t) = sin(πx)·exp(-(π/2)²t) + 0.3·x·sin(2πt)<br>    &quot;&quot;&quot;<br>    x = np.asarray(x, dtype=np.float32)<br>    t = np.asarray(t, dtype=np.float32)<br><br>    const_sq = CONST ** 2<br>    exponential_part = np.sin(PI * x) * np.exp(-const_sq * t)<br>    oscillatory_part = AC_AMPLITUDE * x * np.sin(2 * PI * t)<br><br>    return exponential_part + oscillatory_part<br><br>def forcing_term(x, t):<br>    &quot;&quot;&quot;<br>    Source term f(x,t) derived from the exact solution<br>    &quot;&quot;&quot;<br>    x = np.asarray(x, dtype=np.float32)<br>    t = np.asarray(t, dtype=np.float32)<br><br>    const_sq = CONST ** 2<br>    pi_sq = PI ** 2<br><br>    # From exponential component<br>    f1 = (pi_sq - const_sq) * np.sin(PI * x) * np.exp(-const_sq * t)<br><br>    # From oscillatory component<br>    f2 = 2 * PI * AC_AMPLITUDE * x * np.cos(2 * PI * t)<br><br>    return f1 + f2</pre><h3>Step 2: Generate Training Data (Collocation Points)</h3><p>Unlike supervised learning, we don’t need solution values <em>u</em>(<em>x</em>,<em>t</em>) at interior points. We only need interior points to enforce the PDE and boundary/initial points with known values.</p><pre>def generate_training_data(n_interior=3000, n_ic=150, n_bc=20, <br>                           n_bc_grid=5, seed=42):<br>    &quot;&quot;&quot;<br>    Generate collocation points for PINN training.<br>    &quot;&quot;&quot;<br>    np.random.seed(seed)<br><br>    # Random interior points in [0,1] × [0,1]<br>    X_interior = np.random.rand(n_interior, 2).astype(np.float32)<br><br>    # Initial condition points at t=0<br>    x_ic = np.random.rand(n_ic, 1).astype(np.float32)<br>    t_ic = np.zeros((n_ic, 1), dtype=np.float32)<br>    X_ic = np.hstack([x_ic, t_ic])<br>    y_ic = np.sin(PI * x_ic).astype(np.float32)  # u(x,0) = sin(πx)<br><br>    # Boundary points (mix of grid + random for better coverage)<br>    n_bc_random = n_bc - 2 * n_bc_grid<br><br>    # x=0 boundary<br>    t_bc_0 = np.vstack([<br>        np.linspace(0, 1, n_bc_grid).reshape(-1, 1),<br>        np.random.rand(n_bc_random, 1)<br>    ]).astype(np.float32)<br>    X_bc0 = np.hstack([np.zeros_like(t_bc_0), t_bc_0])<br>    y_bc0 = np.zeros_like(t_bc_0)  # u(0,t) = 0<br><br>    # x=1 boundary<br>    t_bc_1 = np.vstack([<br>        np.linspace(0, 1, n_bc_grid).reshape(-1, 1),<br>        np.random.rand(n_bc_random, 1)<br>    ]).astype(np.float32)<br>    X_bc1 = np.hstack([np.ones_like(t_bc_1), t_bc_1])<br>    y_bc1 = (AC_AMPLITUDE * np.sin(2 * PI * t_bc_1)).astype(np.float32)<br><br>    # Combine boundaries<br>    X_bc = np.vstack([X_bc0, X_bc1])<br>    y_bc = np.vstack([y_bc0, y_bc1])<br><br>    return X_interior, X_ic, y_ic, X_bc, y_bc</pre><p>Design choice: We use 3000 interior points but only 20 boundary points per edge. This is because PDE residuals need dense sampling to capture physics, boundary conditions are simpler and need fewer points and mixing grid points + random points prevents overfitting to sparse data.</p><h3>Step 3: Create the Neural Network Architecture</h3><p>We use a simple feedforward network with tanh activation (standard for PINNs due to smooth derivatives).</p><pre>def create_pinn_model(hidden_layers=3, hidden_units=64, seed=42):<br>    &quot;&quot;&quot;<br>    Create a fully connected neural network.<br><br>    Architecture:<br>        Input: [x, t] (2 features)<br>        Hidden: 3 layers × 64 units (tanh activation)<br>        Output: u(x,t) (1 value)<br>    &quot;&quot;&quot;<br>    np.random.seed(seed)<br>    tf.random.set_seed(seed)<br><br>    layers = []<br><br>    # First hidden layer<br>    layers.append(tf.keras.layers.Dense(<br>        hidden_units, <br>        activation=&#39;tanh&#39;,<br>        input_shape=(2,),<br>        kernel_initializer=tf.keras.initializers.GlorotUniform(seed=seed)<br>    ))<br><br>    # Additional hidden layers<br>    for i in range(hidden_layers - 1):<br>        layers.append(tf.keras.layers.Dense(<br>            hidden_units,<br>            activation=&#39;tanh&#39;,<br>            kernel_initializer=tf.keras.initializers.GlorotUniform(seed=seed+i+1)<br>        ))<br><br>    # Output layer (linear)<br>    layers.append(tf.keras.layers.Dense(1))<br><br>    return tf.keras.Sequential(layers)</pre><p>Why this architecture?</p><p>tanh activation: Produces infinitely differentiable outputs (critical for computing second derivatives). Moderate size: 8,577 parameters is enough to capture smooth solutions without overfitting. Xavier initialization: Prevents vanishing/exploding gradients.</p><h3>Step 4: The Heart of PINNs — Computing the PDE Residual</h3><p>This is where the magic happens. We use automatic differentiation to compute derivatives:</p><pre>def train_pinn(model, X_interior, X_ic, y_ic, X_bc, y_bc,<br>               epochs=8000, lr_initial=2e-4, weight_ic=10.0, <br>               weight_bc=10.0):<br>    &quot;&quot;&quot;<br>    Train the PINN using physics-informed loss.<br>    &quot;&quot;&quot;<br>    # Learning rate schedule<br>    lr_schedule = tf.keras.optimizers.schedules.PolynomialDecay(<br>        initial_learning_rate=lr_initial,<br>        decay_steps=5000,<br>        end_learning_rate=1e-5,<br>        power=0.5<br>    )<br>    optimizer = tf.keras.optimizers.Adam(lr_schedule)<br><br>    # Convert data to TensorFlow constants<br>    X_int_tf = tf.constant(X_interior, dtype=tf.float32)<br>    X_ic_tf = tf.constant(X_ic, dtype=tf.float32)<br>    y_ic_tf = tf.constant(y_ic, dtype=tf.float32)<br>    X_bc_tf = tf.constant(X_bc, dtype=tf.float32)<br>    y_bc_tf = tf.constant(y_bc, dtype=tf.float32)<br><br>    for epoch in range(epochs):<br>        with tf.GradientTape(persistent=True) as tape:<br>            # Separate x and t for computing derivatives<br>            x = tf.reshape(X_int_tf[:, 0], (-1, 1))<br>            t = tf.reshape(X_int_tf[:, 1], (-1, 1))<br>            tape.watch([x, t])  # Track these variables<br><br>            # Forward pass<br>            u = model(tf.concat([x, t], axis=1), training=True)<br><br>            # Compute derivatives via automatic differentiation<br>            u_x = tape.gradient(u, x)       # ∂u/∂x<br>            u_xx = tape.gradient(u_x, x)    # ∂²u/∂x²<br>            u_t = tape.gradient(u, t)       # ∂u/∂t<br><br>            # Forcing term<br>            f = forcing_term(X_interior[:, 0], X_interior[:, 1])<br>            f_tf = tf.constant(f.reshape(-1, 1), dtype=tf.float32)<br><br>            # PDE residual: ∂u/∂t - ∂²u/∂x² - f = 0<br>            loss_pde = tf.reduce_mean(tf.square(u_t - u_xx - f_tf))<br><br>            # Initial condition loss: u(x,0) = sin(πx)<br>            loss_ic = tf.reduce_mean(<br>                tf.square(model(X_ic_tf, training=True) - y_ic_tf)<br>            )<br><br>            # Boundary condition loss<br>            loss_bc = tf.reduce_mean(<br>                tf.square(model(X_bc_tf, training=True) - y_bc_tf)<br>            )<br><br>            # Total weighted loss<br>            loss_total = (1.0 * loss_pde + <br>                         weight_ic * loss_ic + <br>                         weight_bc * loss_bc)<br><br>        # Backpropagation<br>        grads = tape.gradient(loss_total, model.trainable_variables)<br>        grads, _ = tf.clip_by_global_norm(grads, 1.0)  # Gradient clipping<br>        optimizer.apply_gradients(zip(grads, model.trainable_variables))<br>        del tape</pre><p>Key insights:</p><ol><li>Persistent GradientTape: Required to compute second derivatives</li><li>Loss weighting: We use weights=10 to emphasize boundary/initial conditions, which are often harder to satisfy</li><li>Gradient clipping: Prevents exploding gradients during early training when PDE residuals are large</li><li>No labeled PDE data: Notice we never use <em>u</em>(<em>x</em>,<em>t</em>) values at interior points — the network learns purely from physics!</li></ol><h3>4. Results and Analysis</h3><p>After training for 8000 epochs (a few minutes on CPU), we achieve excellent agreement with the exact solution</p><pre>Mean Squared Error (MSE):  1.319118e-05<br>L2 Error:                  3.648744e-03<br>L∞ Error:                  1.814345e-02</pre><h3>Visual Results</h3><p>Figure 1: 3D Solution Comparison</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q94_0TU96FCnTJ5erYhLUQ.png" /></figure><p>Figure 2: Solution Snapshots at Different Times</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57VeCN2IrNNiu56m5XT2CQ.png" /></figure><p>Figure 3: Loss Curves During Training</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aroHovfjKWCD9RNd9QGdrQ.png" /></figure><h3>5. Key Takeaways</h3><h3>What We Learned</h3><ol><li>PINNs work without labeled solution data by encoding PDEs in the loss function</li><li>Automatic differentiation is crucial for computing PDE residuals</li><li>Loss weighting (IC/BC = 10× PDE) is essential for satisfying constraints</li><li>Collocation point strategy matters: dense interior sampling + sparse boundary points</li></ol><h3>Limitations</h3><ul><li>Hyperparameter sensitivity: Learning rate, network width/depth, and loss weights require tuning</li><li>Stiff PDEs: High-frequency modes or sharp gradients remain challenging</li><li>Problem-dependent: Different PDEs and boundary/initial conditions require appropriate network configurations for accurate solutions</li></ul><h3>Conclusion</h3><p>Physics-Informed Neural Networks bridge the gap between data-driven deep learning and physics-based modeling. In this tutorial, we solved a non-trivial heat equation with time-varying boundaries using only TensorFlow and automatic differentiation — no mesh generation, no finite difference stencils, no time-stepping constraints.</p><p><strong>About the Author: </strong>Nikolaos Pallikarakis is a researcher specializing in inverse problems and applications of machine learning and numerical methods for PDEs. Connect on [<a href="https://npallikarakis.github.io/">Portfolio</a>/<a href="https://www.researchgate.net/profile/Nikolaos-Pallikarakis">ResearchGate</a>/<a href="https://www.linkedin.com/in/nikolaos-pallikarakis-b2919495/">LinkedIn</a>/<a href="https://github.com/npallikarakis">GitHub</a>].</p><p>Tags: #MachineLearning #PhysicsInformedNeuralNetworks #PINNs #ScientificComputing #DeepLearning #NumericalMethods #HeatEquation #TensorFlow #Python</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25df376f1b04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Numerical solution of the Sturm-Liouville eigenvalue problem — matslise (MATLAB) and pyslise…]]></title>
            <link>https://medium.com/@pallikarakis.n/numerical-solution-of-the-sturm-liouville-eigenvalue-problem-matslise-matlab-and-pyslise-a286166bd9d0?source=rss-7ce73d3dd489------2</link>
            <guid isPermaLink="false">https://medium.com/p/a286166bd9d0</guid>
            <category><![CDATA[eigenvalue]]></category>
            <category><![CDATA[sturm-liouville]]></category>
            <category><![CDATA[matlab]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[numerical-methods]]></category>
            <dc:creator><![CDATA[Nikolaos Pallikarakis, PhD]]></dc:creator>
            <pubDate>Wed, 04 Oct 2023 08:10:37 GMT</pubDate>
            <atom:updated>2023-10-04T08:10:37.949Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Numerical solution of the Sturm-Liouville eigenvalue problem — matslise (MATLAB) and pyslise (python) solvers</blockquote><p>In our <a href="https://medium.com/@pallikarakis.n/direct-and-inverse-eigenvalue-problems-a-gentle-introduction-15d441482bbd"><em>previous article</em></a><em>, we introduced some basic ideas about direct and inverse eigenvalue problems. Here, we will discuss in more detail about the Sturm-Liouville eigenvalue problem and the basic properties of its spectrum. But since we are also interested in the numerical solution, we will present two useful eigenvalue solvers in MATLAB and python, suitable for our boundary value problem.</em></p><h4><strong>The Sturm-Liouville eigenvalue problem — properties</strong></h4><p>We consider the two-point boundary value problem, defined in the unit interval, of the following general form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/0*X4SDZFB3AVa4cPvj" /></figure><p>together with the boundary conditions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*dzwAUy3guTruKhN4" /></figure><p>where we assume that the functions p, p’, q and r are continuous on the interval 0 ≤ x ≤ 1 and that p(x) &gt; 0 and r(x) &gt; 0 at all points in 0 ≤ x ≤ 1. We also assume that not both alphas and betas are equal to zero. <em>In this case the boundary value problem is said to be regular. </em>We can equivalently write the above as a differential operator eigenvalue problem for D:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/0*spr2Zw7cv6KmJSGP" /></figure><p>Each pair of (λ,y) is the corresponding eigenpair of the operator D.</p><p>As we explained in the <a href="https://medium.com/@pallikarakis.n/direct-and-inverse-eigenvalue-problems-a-gentle-introduction-15d441482bbd">previous article</a>, the direct eigenvalue consists on finding the eigenpairs, for known functions p, q and r. But DO these eigenpairs EXIST? How many are they? Are they real, complex, positive or negative? The following result answers the above questions:</p><blockquote><em>1. Let y and ψ are two eigenfunctions of the Sturm–Liouville problem corresponding to eigenvalues λ and μ, respectively. If λ is not equal with μ, then the eigenfunctions are orthogonal. That is:</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/0*CxvZExLFN2K3lMO6" /></figure><blockquote><em>2. The eigenvalues form an infinite real sequence and can be ordered according to increasing magnitude so that:</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*bFzUI5T45zXpnJ0g" /></figure><blockquote><em>and furthermore</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*xj9S0-AmEng2Kdn2" /></figure><p>The proof of the above is a consequence of the <a href="https://en.wikipedia.org/wiki/Hilbert%E2%80%93Schmidt_theorem">Hilbert-Schmidt</a> theory for compact and self-adjoint operators and is out of the scope of this article.</p><p>Enough with theory (for the time being). Lets see how to use two practical solvers to calculate these eigenpairs!</p><h4><strong>Numerical solution of the Sturm-Liouville eigenvalue problem</strong></h4><p>Since boundary value problems and especially Sturm-Liouville eigenvalue problem is of high interest in applications, a lot of numerical methods have been developed to solve these problems.</p><h4>1. Using matslise in MATLAB</h4><p><a href="https://dl.acm.org/doi/abs/10.1145/2839299">Matslise 2.0</a> is a MATLAB package which can be used to compute the eigenvalues and eigenfunctions of regular and singular self-adjoint Sturm-Liouville boundary value problems. It was created by <a href="https://dl.acm.org/profile/81310481286">Veerle Ledoux</a> and <a href="https://dl.acm.org/profile/81100105095">Marnix van Daele</a>.</p><p>As an example, we consider the following Sturm-Liouville eigenvalue problem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*c1yORlBrJhTq60wQ" /></figure><p>with Dirichlet boundary conditions y(0)=y(π/2)=0. The potential q(x) is shown in the following figure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*KbW031BBDGXaGZUGGQ90jg.jpeg" /><figcaption>The potential q(x)= (x-1)²+e^(2x), by author using Mathematica</figcaption></figure><p>The code using the matslise built-in slp class:</p><pre>function TestSturmLiouville<br>%illustration of the use of the MATSLISE-functions<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%Sturm-Liouvile problem, with functions p,q,w and dirichet boundary conditions<br>%%y(0)=y(pi/2)=0<br>o=slp(@p,@q,@w,0,pi/2,1,0,1,0);<br><br>%display classification information:<br>disp(classificationInfo(o))<br><br>%compute eigenvalues with indices between 0 and 10:<br>[E,meshData] = o.computeEigenvalues(0,9,1e-12,true);<br><br>%first eigenfunction evaluated in the mesh points:<br>[x,y,yp] = o.computeEigenfunction(E.eigenvalues(1),meshData);<br>figure<br>plot(x,y,x,yp)<br>xlabel(&#39;x&#39;)<br>legend(&#39;y&#39;,&#39;yp&#39;)<br><br>%the first 3 eigenfunctions evaluated in a range of user-specified points:<br>[x,y,yp] = o.computeEigenfunction(E.eigenvalues(1),meshData,linspace(0,pi/2,500));<br>[x,y2,yp] = o.computeEigenfunction(E.eigenvalues(2),meshData,linspace(0,pi/2,500));<br>[x,y3,yp] = o.computeEigenfunction(E.eigenvalues(3),meshData,linspace(0,pi/2,500));<br>figure<br>%plot(x,y,x,yp)<br>plot(x,y,x,y2,x,y3)<br>legend(&#39;y_{1}&#39;,&#39;y_{2}&#39;,&#39;y_{3}&#39;)<br>xlabel(&#39;x&#39;)<br>axis tight<br>%legend(&#39;y&#39;,&#39;yp&#39;) <br><br><br>plotMesh(o,meshData);<br><br>disp(&#39;The first 10 eigenvalues:&#39;)<br><br>line=&#39;-----------------------------------------&#39;;<br>disp(line)<br>disp(&#39;  k     E_k           estimated error&#39;)<br>disp(line)<br>for i=1:length(E.eigenvalues)<br>    fprintf(&#39;%4.0f  %16.12f  %+5.2e\n&#39;, E.indices(i),E.eigenvalues(i), E.errors(i))<br>end<br>disp(line)<br><br><br>disp(&#39;---------- orhtogonality test ---------- &#39;)<br>int1 = trapz(y.*y2);<br>int2 = trapz(y.*y3);<br>int3 = trapz(y2.*y3);<br>fprintf(&#39;integral of the y1 and y2 %s \n&#39;, int1);<br>fprintf(&#39;integral of the y1 and y3 %s \n&#39;, int2);<br>fprintf(&#39;integral of the y2 and y3 %s \n&#39;, int3);<br>disp(line)<br>end<br><br>function r=p(x)<br>r=1;<br>end<br><br>function r=q(x)<br>r=(x-1)^2 + exp(2*x);<br>end<br><br>function r=w(x)<br>r=1;<br></pre><p>In the output, we calculate the first 10 eigenvalues. We verify that they are an increasing sequence of positive numbers. We also verify the orthogonality between the first 3 eigenfunctions.</p><pre>&gt;&gt; TestSturmLiouville<br>The spectrum is simple, purely discrete and bounded below.<br>There is no continuous spectrum.<br><br>At endpoint A<br>   The problem is regular.<br>At endpoint B<br>   The problem is regular.<br><br><br>The first 10 eigenvalues:<br>-----------------------------------------<br>  k     E_k           estimated error<br>-----------------------------------------<br>   0    9.125618302908  -8.08e-13<br>   1   22.845873279784  -1.39e-12<br>   2   43.207474751000  -7.25e-13<br>   3   71.278107445561  +1.38e-12<br>   4  107.294741135566  +4.65e-12<br>   5  151.299367990309  +3.44e-12<br>   6  203.300719604859  +2.84e-14<br>   7  263.301043330762  -3.41e-13<br>   8  331.301022502680  -4.77e-12<br>   9  407.300889778476  -2.67e-12<br>-----------------------------------------<br>---------- orhtogonality test ---------- <br>integral of the y1 and y2 7.565334e-13 <br>integral of the y1 and y3 4.835973e-12 <br>integral of the y2 and y3 1.979751e-11 <br>-----------------------------------------</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ZvlN8G3R5kkRu-12291EdA.jpeg" /><figcaption>The first three eigenfunctions, by author using MATLAB.</figcaption></figure><p>Finally, matslise includes a nice GUI for those that don’t like coding:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAMzmfM0FY0_O1PIE3HHgQ.png" /></figure><h4>2. Using pyslise in Python</h4><p>Based on matslise, <a href="https://biblio.ugent.be/person/45022468-E42C-11E2-9D7A-1E9210BDE39D">Toon Baeyens</a> and <a href="https://biblio.ugent.be/person/F4619098-F0ED-11E1-A9DE-61C894A0A6B4">Marnix Van Daele</a> created a similar python package, called <a href="https://matslise.ugent.be/index.html">pyslice</a>. It is a package (written in C++) to solve Schrödinger equations of the form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/0*YWrU1vfuOo9Dxk6D" /></figure><p>i.e. Sturm Liouville equations with p(x)=r(x)=1.</p><p>We install pyslise</p><pre>pip install pyslise</pre><p>and test the above example to get the first 10 eigenvalues:</p><pre>from pyslise import Pyslise<br>from math import pi, exp<br>import numpy as np<br>import math<br>import matplotlib.pyplot as plt<br><br>problem = Pyslise(lambda x: (x-1)**2 + exp(2*x), 0, pi/2, tolerance=1e-12)<br>left = (0, 1)<br>right = (0, 1)<br>eigenvalues = problem.eigenvaluesByIndex(0, 10, left, right)<br><br>xs = np.linspace(0, pi/2, 300)<br><br>print(&#39;------------- the first 10 eigenvalues -----------&#39;)<br>print(&#39;index  eigenvalue    error&#39;)<br>for index, E in eigenvalues:<br>    error = problem.eigenvalueError(E, left, right)<br>    print(f&#39;{index:&gt;5} {E:&gt;11.5f} {error:&gt;9.1e}&#39;)</pre><p>and the results follow:</p><pre>------------- the first 10 eigenvalues -----------<br>index  eigenvalue    error<br>    0     9.12562   7.5e-13<br>    1    22.84587   1.9e-12<br>    2    43.20747   4.3e-12<br>    3    71.27811   1.1e-12<br>    4   107.29474   7.4e-12<br>    5   151.29937   1.3e-11<br>    6   203.30072   1.1e-11<br>    7   263.30104   3.2e-12<br>    8   331.30102   5.7e-12<br>    9   407.30089   1.2e-11<br><br>Process finished with exit code 0</pre><p>By comparing the outputs, we verify that both solvers give very close results.</p><p>Pyslise also includes a simple <a href="https://matslise.ugent.be/ti1d/">GUI</a>.</p><p>So, taking advantage of the nice properties of the Sturm-Liouville eigenvalue problems, both matslise and pyslise are very useful in solving the direct problems.</p><p><strong>References</strong></p><ol><li>Boyce W.E. and Diprima R.C. (2001), <em>Elementary Differential Equations and Boundary Value Problems,</em> 7th edn, John Wiley &amp; Sons Inc.</li><li>Renardy M. and Rogers R. (2004), <em>An Introduction to Partial Differential Equations</em>, Springer.</li><li>Ledoux V. and Van Daele M. (2016), <em>Matslise 2.0:</em> <em>A Matlab toolbox for Sturm-Liouville computations</em>, ACM Trans. Math. Softw.</li><li><a href="https://sourceforge.net/projects/matslise/">https://sourceforge.net/projects/matslise</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a286166bd9d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Direct and Inverse Eigenvalue Problems — a gentle introduction]]></title>
            <link>https://medium.com/@pallikarakis.n/direct-and-inverse-eigenvalue-problems-a-gentle-introduction-15d441482bbd?source=rss-7ce73d3dd489------2</link>
            <guid isPermaLink="false">https://medium.com/p/15d441482bbd</guid>
            <category><![CDATA[quantum-physics]]></category>
            <category><![CDATA[differential-equations]]></category>
            <category><![CDATA[eigenvalue]]></category>
            <category><![CDATA[mathematical-physics]]></category>
            <category><![CDATA[mathematical-modeling]]></category>
            <dc:creator><![CDATA[Nikolaos Pallikarakis, PhD]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 08:07:41 GMT</pubDate>
            <atom:updated>2023-09-11T13:59:48.873Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Direct and Inverse Eigenvalue Problems — a gentle introduction</strong></blockquote><p><em>Most people working with scientific problems are familiar with the ideas of eigenvalues from linear algebra, but what about eigenvalue problems arising in physics? What are the so-called “spectral problems” and how are they associated with ordinary or partial differential equations and boundary valued problems? Furthermore, how direct and inverse problems are defined for eigenvalue problems? In this article, we will try to give some brief ideas and examples.</em></p><h4>Eigenvalue problem for a square matrix — the finite dimensional case:</h4><p>Let’s start with the vary basics from linear algebra. The standard matrix eigenvalue problem can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/95/0*PugQolY1_Obc-7D6" /></figure><p>where A is a square matrix, x is the eigenvector and λ the eigenvalue. <em>The direct problem is to find the eigenvalues and the corresponding eigenvectors for a given matrix A. The corresponding inverse problem is to find a matrix that has those eigenvalues (and possibly eigenvectors).</em></p><h4>Eigenvalue problems for differential operators — the infinite dimensional case:</h4><p>Now instead of assuming a square matrix, we define the eigenvalue problem in an infinite dimensional space, by using an <a href="https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors">operator problem</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/98/0*DHFqrQNXH4AR5s3V" /></figure><p>where D is the (differential) operator and (λ,u) the corresponding eigenpair.</p><p>In general, spectral/eigenvalue problems are associated with the investigation of vibrations of physical systems like strings or membranes, mechanical systems, atoms or molecules etc.</p><p><em>The direct spectral problem consists on finding the frequencies and the mode shapes of the vibrations of a system for which all physical properties are known. The inverse spectral problem is to determine some properties of the system from a knowledge of its natural frequencies and modes of vibration.</em></p><p>From a mathematical perspective, inverse spectral problems concern the recovery of coefficients of a differential equation from the knowledge of the eigenvalues, i.e. the spectral values of the corresponding differential operator.</p><p>The first study on the spectral properties of the differential operator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/0*zC2t5NcFlUYJfr_Y" /></figure><p>was performed by Sturm and Liouville in 1836 and the corresponding inverse problem was firstly considered by Ambartsumyan in 1929.</p><p><strong>Example 1: The Sturm-Liouville eigenvalue problem</strong></p><p>We consider a string of length L and mass density ρ = ρ(x) &gt; 0, 0&lt;x&lt;L which is fixed at the endpoints x = 0 and x = L. If an external force sets the string into motion, tones are produced due to vibrations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*KQwhi2ukPJ72lQZlb_Ir7Q.jpeg" /><figcaption>Vibration of an non-homogeneous string, with density ρ(x), created by the author.</figcaption></figure><p>Let u(x, t) be the transverse displacement at x and time t. It obeys the wave equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/0*-ivy70BlBMNMWOB9" /></figure><p>with boundary conditions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/0*VtJDAT40XEaYPiXS" /></figure><p>A periodic vibration of the form :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/0*Bc2Ppz6D6eQd_fG9" /></figure><p>with frequency k is called <em>pure tone</em>. Thus, u solves the boundary value problem if and only if y and k satisfy the <strong>Sturm-Liouville eigenvalue problem:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/0*o3d2AfM8aIgx8LVZ" /></figure><p>The above is a boundary value problem for an ordinary differential equation of the second order, with homogeneous (Dirichlet) boundary conditions.</p><p><em>For the direct problem we assume that ρ(x) is known and we want to compute the eigenfrequencies k and the corresponding eigenfunctions. The inverse problem is to recover the density ρ(x) from a set of measured frequencies k.</em></p><p><strong>Example 2: The potential scattering eigenvalue problem</strong></p><p>We consider the scattering of a non-relativistic particle by a fixed force and we use the time-dependent Schrödinger equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*Ca69JkhF0GIAtoBJ" /></figure><p>where V(x,t) is the potential, Ψ the wave function, h is the Plank´s constant and m the mass of the particle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zCkagjjiqpuTVoZ80QA-Zg.jpeg" /><figcaption>Artistic rendering of particle scattering by the author with Bing Image Creator</figcaption></figure><p>We restrict ourselves to the time-independent Schrödinger equation in one space dimension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/0*VVWuKu1LMGB0JG5U" /></figure><p>where E corresponds to the energy in the particular mode of the state u(x) which represents the amplitude at the point x.</p><p>For the finite interval case (<a href="https://en.wikipedia.org/wiki/Particle_in_a_box">particle in a box</a>), the values of constant E are allowed to<strong> form a discrete sequence</strong> {En}, which means that not all energy levels are possible. <em>The direct problem is given the potential V, to find the energy levels and the corresponding wavefunctions. The inverse spectral problem is given the energy levels of the quantum mechanical system to reconstruct the unknown potential, and hence recover the qualitative characteristics of the underlying force.</em></p><blockquote>Spectral problems can be challenging to solve. Research has been focused both on theoretical aspects (existence and properties of the spectrum, geometrical properties of the eigenfunctions, uniqueness of the inverse problem e.a.) as well as the numerical solution (estimation of eigenvalues/eigenfunctions, convergence, reconstructions e.a.).</blockquote><blockquote>Inverse spectral problems are more interesting, because their solution is associated with applications like non-destructive testing of materials, medical imaging and seismic exploration among others. Unfortunately, their nature is more complicated and usually they are “ill-posed”. This could mean i.e. that the knowledge of the spectrum can not uniquely determine the unknown function we want to estimate (e.g. the density of the string or the scattering potential).</blockquote><p>Stay tuned for the next part of this article, for more inverse spectral problems, numerical solutions and (non)-uniqueness issues…</p><p><strong>References:</strong></p><ol><li>Chadan K., Colton D., Päivärinta L. and Rundell W. (1997), <em>An Introduction to Inverse Scattering and Inverse Spectral Problems</em>, (Philadelphia: SIAM Publications)</li><li>Kirsch A. (2011), <em>An Introduction to the Mathematical Theory of Inverse Problems</em>, 2nd edn (New York: Springer)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15d441482bbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>