Iterative spectral methods for Hamilton-Jacobi-Bellman quasi-variational inequality in finance Minlan Lei, Zhengyang Lu ABSTRACT This study proposes a novel computational scheme for utility-maximization problems involving optimal stopping, formulated as Hamilton-Jacobi-Bellman quasi-variational inequalities. The methodology integrates Gauss-Lobatto-Legendre spectral discretization with a penalization method and is solved efficiently via policy iteration. We establish the convergence of the penalized scheme and verify the effectiveness and robustness of the framework through a series of numerical experiments. Introduction In the broader context of financial optimization, Hamilton-Jacobi-Bellman (HJB) equations have become the fundamental tool for addressing complex dynamic decision-making problems, ranging from classic continuous-time portfolio selection [ 1 ] to general stochastic control theories [ 2 ]. This paper centers on utility maximization problems embedded with optimal stopping constraints, for which a series of theoretical studies have been developed over the past decades. Early foundational research was carried out by [ 3 ] and [ 4 ]. Later [ 5 ], and [ 6 ] analyzed the existence and equivalence of solutions, yet their work failed to provide a complete characterization of the free boundary. To remedy this limitation [ 7 ], and [ 8 ] adopted dual transformation techniques to convert the original problems into standard free boundary problems, while [ 9 ] proposed a global approximation strategy. Beyond these classical theoretical settings, the application of continuous-time differential models and boundary value problems has grown increasingly sophisticated, driving recent breakthroughs across diverse scientific domains. Such advanced continuous models have not only provided profound new insights into complex biological systems, such as population dynamics [ 10 ], but are also being actively deployed to solve intricate real-world financial problems, including optimal investment considerations for life insurance portfolios [ 11 ]. To construct reliable optimization models that meet these practical demands, incorporating realistic market dynamics—such as stochastic volatility, leverage effects, and long-memory features—is essential. Traditional constant-volatility frameworks represented by the classical Black-Scholes model enjoy analytical tractability but fail to reproduce typical empirical patterns like volatility smiles and return skewness. To overcome this critical defect, stochastic volatility models were first proposed by [ 12 ] and further extended to high-precision numerical and regime-switching frameworks in [ 13 ], evolving into the mainstream industry standard. Building on this foundation, the literature on non-constant volatility has recently expanded significantly to capture even more complex empirical features. For instance, extensive empirical evidence has shown that volatility time series exhibit rough behavior, leading to the rapid development of rough volatility models [ 14 ]. Furthermore, optimal portfolio selection in complex stochastic environments, such as those with fast mean-reverting or fractional volatility dynamics, continues to attract substantial academic interest [ 15 ]. Unfortunately, incorporating stochastic volatility features transforms the original HJB equations into degenerate multidimensional quasi-variational inequalities (QVIs), which pose severe theoretical and computational difficulties. Computationally, solving optimal stopping and stochastic control problems in these advanced stochastic volatility frameworks has seen a recent surge in machine learning techniques, such as neural-network-based HJB solvers [ 16 ] and deep optimal stopping algorithms [ 17 ]. While these deep learning approaches scale exceptionally well to high-dimensional problems, they often lack rigorous convergence analysis and struggle to provide sharp, highly accurate resolutions of the early exercise boundary. On the other hand, for low-to-medium dimensional problems such as the 2D Heston-type QVI, resolving the free boundary with mathematical rigor remains crucial. Conventional numerical discretization approaches, such as finite difference and finite element methods (see [ 18 – 20 ]), are frequently hampered by the curse of dimensionality and severe grid oscillations near free boundaries. Recent research has constructed refined penalty formulations and structure-preserving algorithms to cope with complicated financial constraints and regime shifts [ 13 , 21 ], as well as the spectral control frameworks established in [ 22 ]. Despite these methodological advances, it remains an unresolved and challenging task to achieve high-order convergence rates and accurate free-boundary resolution for multi-dimensional Heston-type utility maximization problems subject to optimal stopping constraints. Given the inherent complexity of the Heston framework, we first develop and validate our numerical scheme in the simpler Black-Scholes setting, and then extend it to the Heston model. To address this research gap and bridge the trade-off between high accuracy and computational efficiency, the present paper develops a discretization scheme based on Gauss-Lobatto-Legendre (GLL) spectral elements. By taking full advantage of the inherent high-order accuracy and outstanding approximation performance of spectral methods, the proposed scheme achieves faster convergence and more precise free boundary identification compared with traditional finite difference discretizations. The remainder of this paper is organized as follows. Section 2 presents the theoretical framework and numerical formulation of the proposed method. We first formulate the HJB variational inequality for the utility maximization problem under the Black-Scholes model. On this basis, the penalty method is adopted to reformulate the problem and the corresponding convergence results are established. This section also introduces the GLL spectral discretization scheme for the penalized HJB equation and the implementation of the policy iteration algorithm. Additionally, an extended framework based on the Heston model is formulated, and the corresponding discrete scheme is constructed. Section 3 provides numerical experiments to demonstrate the efficiency and improved convergence performance of the proposed scheme. Section 4 concludes the paper with a summary of the main results and research implications. Problem formulation and numerical scheme Model formulation under the Black-Scholes framework In this paper we consider a fixed time horizon [0, T ] with 0 < T < + ∞ . Let ( Ω , ℱ , P ) be a complete probability space, W be a standard Brownian motion, and let { ℱ t } t ∈ [ 0 , T ] be the filtration generated by W completed with all P -null sets. Assume the financial market consists of one risk-free bond with dynamic price B and one risky stock with dynamic price S . The bond price process B is assumed to follow the process d B τ = r B τ d τ , 0 ≤ τ ≤ T , where r > 0 is risk-free interest rate. The stock price process S follows d S τ = S τ ( μ d τ + σ d W τ ) , 0 ≤ τ ≤ T , (1) where μ > 0 and σ > 0 are return and volatility rates of the risky asset. The wealth process is given by d X τ X τ = [ π τ d S τ S τ + ( 1 − π τ ) d B τ B τ ] , where π τ is a progressively measurable control process and represents the proportion of wealth X τ invested in risky asset S τ . The wealth process is d X τ = X τ [ r d τ + π τ σ ( θ d τ + d W τ ) ] , 0 ≤ τ ≤ T , where θ : = μ − r σ denotes the market price of risk. Let 𝒜 denote the set of all admissible progressively measurable investment strategies, and let 𝒯 denote the set of all stopping times adapted to { ℱ t } t ∈ [ 0 , T ] . A random time ς is a valid stopping time if { ς ≤ t } ∈ ℱ t for all t ∈ [ 0 , T ] . The value function is defined as the following constrained expected utility maximization problem: V ~ ( τ , x ) : = sup π ∈ 𝒜 , ς ∈ 𝒯 𝔼 τ , x [ e − β ( ς − τ ) U ( X τ , x ς − K ) ] , (2) where 𝔼 τ , x [ · ] : = 𝔼 [ · ∣ X τ = x ] , U is a utility function that is continuous, strictly increasing and strictly concave on [ 0 , ∞ ) , β > 0 is the utility discount factor, and K ≥ 0 is the minimum wealth threshold. By the dynamic programming principle, it can be deduced that V ~ satisfies the HJB variational inequality, min { − V ~ τ ( τ , x ) − sup π ℒ π V ~ , V ~ − U ( x − K ) } = 0 , (3) ∀ ( τ , x ) ∈ ( 0 , T ) × ( 0 , ∞ ) , where ℒ π V ~ = 1 2 σ 2 π 2 x 2 · V ~ x x ( τ , x ) + [ π ( μ − r ) + r ] x · V ~ x ( τ , x ) − β V ~ . By the dynamic programming principle, it can be deduced that V ~ satisfies the HJB variational inequality, min { − V ~ τ ( τ , x ) − sup π ℒ π V ~ , V ~ − U ( x − K ) } = 0 , (4) ∀ ( τ , x ) ∈ ( 0 , T ) × ( 0 , ∞ ) , where ℒ π V ~ = 1 2 σ 2 π 2 x 2 · V ~ x x ( τ , x ) + [ π ( μ − r ) + r ] x · V ~ x ( τ , x ) − β V ~ . Using variable transformation t = T − τ , V ~ ( τ , x ) = V ~ ( T − t , x ) ≡ V ^ ( t , x ) , and V ^ ( t , x ) satisfies the following system of HJB variational inequality: min { V ^ t ( t , x ) − sup π ℒ π V ^ , V ^ − U ( x − K ) } = 0 , (5) ∀ ( t , x ) ∈ ( 0 , T ) × ( 0 , ∞ ) , where ℒ π V ^ = 1 2 σ 2 π 2 x 2 · V ^ x x ( t , x ) + [ π ( μ − r ) + r ] x · V ^ x ( t , x ) − β V ^ , (6) with the terminal and boundary conditions V ^ ( 0 , x ) = U ( x − K ) , x ∈ Ω : = ( K , x max ) , V ^ ( t , K ) = 0 , t ∈ [ 0 , T ] , V ^ ( t , x max ) = Ψ ( t , x max ) , t ∈ [ 0 , T ] . (7) Penalty reformulation and convergence analysis In this section, we transform the HJB variational inequality (5) into a penalized HJB equation using the penalty method (see, e.g.[ 23 – 25 ]). We further demonstrate the convergence of the viscosity solution of the resulting penalized equation to that of the original HJB variational inequality. We define the penalized HJB equation for the HJB variational inequalitie (5) as follows: V t ( t , x ) − sup π ℒ π V − λ ( U ( x − K ) − V ( t , x ) ) + = 0 , (8) on [ 0 , T ] × Ω , and the terminal and boundary conditions are given by V ( 0 , x ) = U ( x − K ) , x ∈ Ω V ( t , K ) = 0 , t ∈ [ 0 , T ] , V ( t , x max ) = Ψ ( t , x max ) t ∈ [ 0 , T ] , (9) where ( a ) + : = max ( a , 0 ) and λ > 0 . For ease of analysis, we write (43) as ∂ t V ( t , x ) − ℋ V ( t , x ) = 0 . ( t , x ) ∈ ( 0 , T ) × Ω , (10) where ℋ V ( t , x ) : = sup π ℒ π V + λ ( U ( x − K ) − V ( t , x ) ) + . (11) Subsequently, we establish the convergence of the viscosity solution to the penalized HJB equation (43) to that of the original variational inequality (5) as the penalty parameter approaches zero. For defining the viscosity solution to the HJB variational equations (5) , it is useful to express it in the form: ℱ ( V ^ x x ( t , x ) , V ^ x ( t , x ) , V ^ t ( t , x ) , V ^ ( t , x ) , t , x ) = 0 . (12) Since the HJB variational inequality (5) is fully nonlinear and degenerate, a classical smooth solution may fail to exist. We therefore work within the framework of viscosity solutions, which is the standard notion of weak solutions for such equations; see [2, Chapter 4] for a comprehensive treatment in the context of stochastic control. The penalized HJB equation (10) , being a uniformly elliptic second-order nonlinear PDE, admits a unique viscosity solution, whose existence and uniqueness are guaranteed by the comparison principle (see [2, Chapter 4]). We develop a set of limit definitions, viscosity solution characterizations, auxiliary lemmas and a core convergence theorem to analyze the penalized HJB variational inequality. The mathematical constructions presented below hold over the full feasible domain and all admissible parameters, and the derived theoretical results apply uniformly to both Black-Scholes constant-volatility and Heston stochastic-volatility models without restrictive parameter constraints. Definition 0.1. Suppose the operator ℱ : ℝ 3 × ℝ × [ 0 , T ] × ℝ + → ℝ is locally Lipschitz continuous, and let V ^ : [ 0 , T ] × ℝ + → ℝ be locally bounded. For arbitrary constants ρ > 0 , h > 0 , we use B(z,r) to denote the open neighborhood centered at z with radius r. For any state ( t , x ) ∈ [ 0 , T ] × ℝ + , the upper semi-continuous envelope ℱ ― ( t , x ) and lower semi-continuous envelope ℱ ― ( t , x ) of ℱ are defined as ℱ ― ( t , x ) ≡ lim sup t ~ → t x ~ → x t ~ ∈ B ( t , ρ ) x ~ ∈ B ( x , h ) ℱ ( V ^ x x ( t ~ , x ~ ) , V ^ x ( t ~ , x ~ ) , V ^ t ( t ~ , x ~ ) , V ^ ( t ~ , x ~ ) , t ~ , x ~ ) , ℱ ― ( t , x ) ≡ lim inf t ~ → t x ~ → x t ~ ∈ B ( t , ρ ) x ~ ∈ B ( x , h ) ℱ ( V ^ x x ( t ~ , x ~ ) , V ^ x ( t ~ , x ~ ) , V ^ t ( t ~ , x ~ ) , V ^ ( t ~ , x ~ ) , t ~ , x ~ ) . Definition 0.2. Let λ > 0 denote the positive penalty parameter, and V ^ : [ 0 , T ] × ℝ + → ℝ be locally bounded. For any state ( t , x ) ∈ [ 0 , T ] × ℝ + , the upper weak limit V ^ * ( t , x ) and lower weak limit V ^ * ( t , x ) of V ^ ( t , x ) are respectively defined by V ^ * ( t , x ) ≡ lim sup t ~ → t x ~ → x t ~ ∈ B ( t , 1 / λ ) x ~ ∈ B ( x , 1 / λ ) λ → ∞ V ^ ( t ~ , x ~ ) and V ^ * ( t , x ) ≡ lim inf t ~ → t x ~ → x t ~ ∈ B ( t , 1 / λ ) x ~ ∈ B ( x , 1 / λ ) λ → ∞ V ^ ( t ~ , x ~ ) , where the neighborhood notation B ( · , · ) follows Definition 0.1. Definition 0.3. Let Ω ― = [ 0 , T ] × ℝ + be the closed state domain, and V ^ : Ω ― → ℝ be locally bounded. (i) If for all test functions φ ∈ C 1 , 2 ( Ω ― ) , and every point ( t ― , x ― ) ∈ Ω ― such that V ^ * − φ attains a strict local maximum at ( t ― , x ― ) , the inequality ℱ ― ( φ x x ( t ― , x ― ) , φ x ( t ― , x ― ) , φ t ( t ― , x ― ) , V ^ * , x ― , t ― ) ≤ 0 holds, then V ^ is called a viscosity subsolution of (12) . (ii) If for all test functions φ ∈ C 1 , 2 ( Ω ― ) , and every point ( t ― , x ― ) ∈ Ω ― such that V ^ * − φ attains a strict local minimum at ( t ― , x ― ) , the inequality ℱ ― ( φ x x ( t ― , x ― ) , φ x ( t ― , x ― ) , φ t ( t ― , x ― ) , V ^ * , x ― , t ― ) ≥ 0 holds, then V ^ is called a viscosity supersolution of (12) . (iii) If V ^ is both a viscosity subsolution and a viscosity supersolution of (12) , we term V ^ a viscosity solution of (12) . Lemma 0.1. Let λ > 0 be an arbitrary penalty parameter, V ( t , x ) : Ω ― → ℝ denote the unique viscosity solution of penalized HJB equation (10) (w hose existence and uniqueness are guaranteed by the comparison principle; see [2, Chapter 4]), and define V ― ( t , x ) = V * ( t , x ) , V ― ( t , x ) = V * ( t , x ) as the upper and lower weak limits of V(t, x) via Definition 0.2. The following properties hold for all ( t , x ) ∈ Ω ― : (i) V ― ( t , x ) is upper semi-continuous on Ω ― and V ― ( t , x ) is lower semi-continuous on Ω ― . (ii) Suppose V ― is upper semi-continuous (resp. V ― lower semi-continuous), and ( t ― , x ― ) ∈ Ω ― is a strict local maximizer of V ― − φ (resp. strict local minimizer of V ― − φ ) for some test function φ ∈ C 1 , 2 ( Ω ― ) . Then there exists a subsequence { ( t λ , x λ ) } ⊂ Ω ― satisfying ( t λ , x λ ) → ( t ― , x ― ) and V ( t λ , x λ ) → V ― ( t ― , x ― ) (resp. V ― ( t ― , x ― ) ) as λ → ∞ . Moreover, ( t λ , x λ ) is a local maximizer (resp. local minimizer) of V − φ for each λ > 0 . Theorem 0.1. Fix any penalty parameter λ > 0 . Let V ( t , x ) : Ω ― → ℝ be the unique viscosity solution of penalized HJB equation (43), and define V ― ( t , x ) , V ― ( t , x ) as the upper and lower weak limits of V(t,x) according to Definition 0.2. Then V ― ( t , x ) is a viscosity subsolution and V ― ( t , x ) is a viscosity supersolution of the original HJB variational inequality (5) . Proof. Throughout this section, we work under the standard compactness assumption that the state domain is compact, or more generally, that the relevant sequences admit convergent subsequences; see [2, Chapter 4]. This assumption is standard in the viscosity solution framework for convergence proofs and is satisfied under our model settings. We first establish that V ― ( t , x ) is a viscosity subsolution of (5) . To this end, consider any test function ψ ( t , x ) ∈ C 1 , 2 ( [ 0 , T ] × Ω ― ) , and assume that ( t ¯ , x ¯ ) is a strict local maximizer of V ― ( t , x ) − ψ ( t , x ) . It then suffices to verify that the following inequality holds: ℱ ― ( ψ x x ( t ― , x ― ) , ψ x ( t ― , x ― ) , ψ t ( t ― , x ― ) , V ― ( t ― , x ― ) , t ― , x ― ) ≤ 0 , (13) that is, min { ψ t ( t ― , x ― ) − sup π { 1 2 σ 2 π 2 x ― 2 · ψ x x ( t ― , x ― ) + [ π ( μ − r ) + r ] x ― · ψ x ( t ― , x ― ) − β V ― ( t ― , x ― ) } , V ― ( t ― , x ― ) − U ( x ― − K ) } ≤ 0 . (14) Suppose, to the contrary, that condition (13) (equivalently, (14) ) is not satisfied, i.e., ℱ ― ( ψ x x ( t ― , x ― ) , ψ x ( t ― , x ― ) , ψ t ( t ― , x ― ) , V ― ( t ― , x ― ) , t ― , x ― ) > 0 . (15) By Lemma 0.1, there exists a subsequence { ( t λ , x λ ) } such that ( t λ , x λ ) → ( t ― , x ― ) and V ( t λ , x λ ) → V ― ( t ― , x ― ) as λ → ∞ , where each ( t λ , x λ ) is a local maximizer of V ( t , x ) − φ ( t , x ) . Since φ ∈ C 1 , 2 ( [ 0 , T ] × Ω ) and condition (14) is continuous, there exists a neighborhood B ( t ― , x ― ) ⊂ [ 0 , T ] × Ω such that the inequality holds for all ( t λ , x λ ) ∈ B ( t ― , x ― ) , ℱ ― ( ψ x x ( t λ , x λ ) , ψ x ( t λ , x λ ) , ψ t ( t λ , x λ ) , V ― ( t λ , x λ ) , t λ , x λ ) > 0 . (16) By the definition of ℱ and (43), we can derive that ∂ t ψ ( t λ , x λ ) − ℋ ψ ( t λ , x λ ) ) > 0 . (17) Given that V ― is a viscosity subsolution of (43) and each ( t λ , x λ ) is a strict local maximizer of V ― ( t , x ) − ψ , the definition of the viscosity solution for the penalized HJB equation (43) then yields: ∂ t ψ ( t ― , x ― ) − ℋ ψ ( t ― , x ― ) ≤ 0 . (18) Inequalities (17) and (18) contradict one another. Consequently, the initial assumption (15) must be false. Therefore, at least one of the conditions (13) or (14) holds, which proves that V ― is indeed a viscosity subsolution to (5) . We now prove that V ― ( t , x ) is a viscosity supersolution to (5) . It suffices to show that for any test function ψ ( t , x ) ∈ C 1 , 2 ( [ 0 , T ] × Ω ― ) , if ( t ― , x ― ) is a strict local minimizer of V ― ( t , x ) − ψ , then the associated differential inequality holds. ℱ ― ( ψ x x ( t ― , x ― ) , ψ x ( t ― , x ― ) , ψ t ( t ― , x ― ) , V ― ( t ― , x ― ) , t ― , x ― ) ≥ 0 , (19) that is, min { ψ t ( t ― , x ― ) − sup π { 1 2 σ 2 π 2 x ― 2 · ψ x x ( t ― , x ― ) + [ π ( μ − r ) + r ] x ― · ψ x ( t ― , x ― ) − β V ― ( t ― , x ― ) } , V ― ( t ― , x ― ) − U ( x ― − K ) } ≥ 0 . (20) Consider the following two cases: Assume that ψ t ( t ― , x ― ) − sup π { 1 2 σ 2 π 2 x ― 2 · ψ x x ( t ― , x ― ) + [ π ( μ − r ) + r ] x ― · ψ x ( t ― , x ― ) − β V ― ( t ― , x ― ) } < 0 . (21) By Lemma 0.1, we may extract a subsequence { ( t λ , x λ ) } satisfying ( t λ , x λ ) → ( t ― , x ― ) and V ( t λ , x λ ) → V ― ( t ― , x ― ) as λ → ∞ , with each ( t λ , x λ ) being a local minimizer of V ( t , x ) − φ ( t , x ) . Since φ ∈ C 1 , 2 ( [ 0 , T ] × Ω ) and condition (21) is continuous, one can find a neighborhood B ( t ― , x ― ) ⊂ [ 0 , T ] × Ω where the required inequality holds for all ( t λ , x λ ) ∈ B ( t ― , x ― ) , ψ t ( t λ , x λ ) − sup π { 1 2 σ 2 π 2 x λ 2 · ψ x x ( t λ , x λ ) + [ π ( μ − r ) + r ] x λ · ψ x ( t λ , x λ ) − β V ― ( t λ , x λ ) } < 0 . From this inequality, we deduce that for any λ > 0 , ψ t ( t λ , x λ ) − sup π { 1 2 σ 2 π 2 x λ 2 · ψ x x ( t λ , x λ ) + [ π ( μ − r ) + r ] x λ · ψ x ( t λ , x λ ) − β V ― ( t λ , x λ ) } − λ ( U ( x λ − K ) − V ― ( t λ , x λ ) ) + < 0 , that is, ∂ t ψ ( t λ , x λ ) − ℋ ψ ( t λ , x λ ) < 0 . (22) Under the hypotheses that V ― is a viscosity supersolution to (43) and each ( t λ , x λ ) is a strict local minimizer of V ― ( t , x ) − ψ for any λ , the definition of viscosity solution for (43) gives ∂ t ψ ( t ― , x ― ) − ℋ ψ ( t ― , x ― ) ≥ 0 . (23) This contradiction between (22) and (23) shows that the assumption (21) cannot hold. Assume that ψ t ( t ― , x ― ) − sup π { 1 2 σ 2 π 2 x ― 2 · ψ x x ( t ― , x ― ) + [ π ( μ − r ) + r ] x ― · ψ x ( t ― , x ― ) − β V ― ( t ― , x ― ) } ≡ ζ ≥ 0 , (24) and V ― ( t ― , x ― ) − U ( x ¯ − K ) ≡ η < 0 . (25) By Lemma 0.1, we can select a subsequence { ( t λ , x λ ) } such that ( t λ , x λ ) → ( t ― , x ― ) and V ( t λ , x λ ) → V ― ( t ― , x ― ) as λ → ∞ , with each ( t λ , x λ ) acting as a local minimizer of V ( t , x ) − φ ( t , x ) . Since φ ∈ C 1 , 2 ( [ 0 , T ] × Ω ) , and in view of the continuity of (24) and (25) , one may choose a neighborhood B ( t ― , x ― ) ⊂ [ 0 , T ] × Ω where the preceding inequality holds for all ( t λ , x λ ) ∈ B ( t ― , x ― ) , ζ − | η | 2 ≤ ψ t ( t λ , x λ ) − sup π { 1 2 σ 2 π 2 x λ 2 · ψ x x ( t λ , x λ ) + [ π ( μ − r ) + r ] x λ · ψ x ( t λ , x λ ) − β V ― ( t λ , x λ ) } ≤ ζ + | η | 2 . (26) and η − | η | 2 ≤ V ― ( t λ , x λ ) − U ( x λ − K ) ≤ η + | η | 2 . (27) For λ > ( 2 ζ + | η | ) / | η | , we can combine (26) with (27) to obtain ψ t ( t λ , x λ ) − sup π { 1 2 σ 2 π 2 x λ 2 · ψ x x ( t λ , x λ ) + [ π ( μ − r ) + r ] x k ( t ) · ψ x ( t λ , x λ ) − β V ― ( t λ , x λ ) } − λ ( U ( x λ − K ) − V ― ( t λ , x λ ) ) + < ζ + | η | 2 + 2 ζ + | η | | η | ( η + | η | 2 ) = ζ − η 2 − 2 ζ − η η ( η − η 2 ) = 0 , that is, ∂ t ψ ( t λ , x λ ) − ℋ ψ ( t λ , x λ ) < 0 . (28) Since V ― is assumed to be a viscosity supersolution to the penalized HJB equation (43) , and each ( t λ , x λ ) is a strict local minimizer of V ― ( t , x ) − ψ for all λ , the definition of viscosity supersolution for (43) yields that ∂ t ψ ( t ― , x ― ) − ℋ ψ ( t ― , x ― ) ≥ 0 . (29) A contradiction arises from (28) and (29) ; accordingly, assumptions (24) and (25) cannot hold. Combining the two cases considered above, we infer that V ― is a viscosity supersolution to (5) , i.e., either (19) or (20) is satisfied. □ GLL spectral discretization with policy iteration In this section, we develop an iterative GLL spectral method to solve the penalized HJB equation (43) , based on the framework established in [ 22 ]. The Legendre polynomials { L n ( ξ ) , n ≥ 0 } form an orthogonal set on [ − 1 , 1 ] under a unit weight (see [26, Chapter 3] for their definitions and properties). Building upon them, the GLL quadrature rule is defined to include the two endpoints ξ = ± 1 . ∫ − 1 1 f ( ξ ) d ξ ≈ I ¯ n GLL { f } : = ∑ k = 0 n ω k f ( ξ k ) = ω 0 f ( − 1 ) + ∑ k = 1 n − 1 ω k f ( ξ k ) + ω n f ( 1 ) , (30) where { ξ k } k = 0 n denotes the roots of L n + 1 ( ξ ) − L n − 1 ( ξ ) ; these nodes are distinct, with the endpoints − 1 and 1 fixed and all other nodes lying strictly in ( − 1 , 1 ) (see [ 26 , Chapter 3] for the standard proof of this property). The corresponding quadrature weights associated with these grid points are defined as ω k = 2 n ( n + 1 ) L n 2 ( ξ k ) , k = 0 , 1 , . . . , n . (31) The GLL basis function ϕ ¯ k ( ξ ) is constructed in the form of a Lagrange interpolation polynomial and is defined by ϕ ¯ k ( ξ ) : = L n + 1 ( ξ ) − L n − 1 ( ξ ) ( 2 n + 1 ) ( ξ − ξ k ) L n ( ξ k ) , k = 0 , 1 , . . . , n . These basis functions possess the interpolation property ϕ ¯ k ( ξ l ) = δ k l (see [ 27 , 28 ]). Moreover, for 0 ≤ k ≤ n , the first-order derivative of ϕ ¯ l ( ξ ) evaluated at the grid point ξ k is D k l : = ∂ ϕ ¯ l ( ξ k ) ∂ ξ = { L n ( ξ k ) ( ξ k − ξ l ) L n ( ξ l ) , if k ≠ l ; 0 , if k = l ≠ 0 , n ; − n ( n + 1 ) 4 , if k = l = 0 ; n ( n + 1 ) 4 , if k = l = n . (32) The second-order derivative of the GLL basis function is also given by B k l : = ∂ 2 ϕ ¯ l ( ξ k ) ∂ ξ 2 = { − 2 L n ( ξ k ) ( ξ k − ξ l ) 2 L n ( ξ l ) , if k ≠ l , k ≠ 0 , n ; ( − 1 ) n n ( n + 1 ) ( ξ k − ξ l ) − 4 2 ( ξ k − ξ l ) 2 L n ( ξ l ) , if k ≠ l , k = 0 ; n ( n + 1 ) ( 1 − ξ l ) − 4 2 ( 1 − ξ l ) 2 L n ( ξ l ) , if k ≠ l , k = n ; − n ( n + 1 ) 3 ( 1 − ξ k 2 ) , if k = l ≠ 0 , n ; ( n − 1 ) n ( n + 1 ) ( n + 2 ) 24 , if k = l = 0 , n . (33) The computational domain Ω is mapped onto the reference interval Ω ¯ = [ − 1 , 1 ] via x − K x max − K = ξ + 1 2 or x = J ξ + x max + K 2 , J = x max − K 2 , ξ ∈ Ω ¯ , x ∈ Ω . (34) On a general interval ( K , x max ) , the GLL quadrature rule (30) takes the form ∫ K x max f ( x ) d x = J ∫ − 1 1 f ( J ξ + x max + K 2 ) d ξ : = J ∫ − 1 1 f ¯ ( ξ ) d ξ ≈ J I ¯ n GLL { f ¯ } : = I n , ( K , x max ) GLL { f } . (35) Define polynomial space 𝕍 n ( Ω ) : = span { ϕ 0 ( x ) , ϕ 1 ( x ) , ⋯ , ϕ n ( x ) } , where ϕ l is respectively the transformation of the GLL basis ϕ ¯ l into Ω using (34) , namely, ϕ ¯ l ( ξ ) = ϕ ¯ l ( 2 ( x − K ) x max − K − 1 ) = : ϕ l ( x ) , l = 0 , 1 , . . . , n . Define inner product ( ν , μ ) : = ∫ Ω ν ( x ) μ ( x ) d x . Then using the expansion V ( t , x ) ≈ ∑ l = 0 n V l ( t ) ϕ l ( x ) , to replace V in (43) and taking inner product by ϕ k ( x ) for k = 1 , . . . , n − 1 give that 0 = ∑ l = 1 n V l ′ ( t ) ( ϕ l , ϕ k ) − { ∑ l = 1 n V l ( t ) [ 1 2 σ 2 ( π * 2 ( t , x ) x 2 ϕ l ″ , ϕ k ) + [ ( μ − r ) + r ] ( π * ( t , x ) x ϕ l ′ , ϕ k ) − β ( ϕ l , ϕ k ) ] } − λ ( ( U ( x − K ) − ∑ l = 0 n V l ( t ) ϕ l ) + , ϕ k ) , k = 1 , . . . , n − 1 , (36) where π * ( t , x ) ∈ arg sup π ℒ π V = arg sup π [ 1 2 σ 2 π 2 x 2 · V x x ( t , x ) + [ π ( μ − r ) + r ] x · V x ( t , x ) − β V ( t , x ) ] . Define temporal grids t i = i Δ t , i = 0 , 1 , . . . , m with Δ t = T m + 1 , and let V l i ≈ V l ( t i ) . Then with the time discretization of (46), the fully discretized scheme for (43) is defined as ∑ l = 0 n ( V l i + 1 − V l i ) ( ϕ l , ϕ k ) = Δ t { ∑ l = 1 n [ 1 2 σ 2 ( π * 2 ( t , x ) x 2 ϕ l ″ , ϕ k ) + [ ( μ − r ) + r ] ( π * ( t , x ) x ϕ l ′ , ϕ k ) − β ( ϕ l , ϕ k ) ] ( η k , l V l i + ( 1 − η k , l ) V l i + 1 ) + λ ( ( U ( x − K ) − ∑ l = 0 n V l i ϕ l ) + , ϕ k ) } , (37) k = 1 , . . . , n − 1 , where V 0 i = 0 and V n i = Ψ ( t i , x max ) , and η k , l = 0 or 1 will be specified later. We adopt GLL quadrature to evaluate the integrals in (47) , which preserves spectral accuracy. The resulting stiffness, advection, and mass matrices are given as follows: S k l = ∫ Ω ∂ 2 ϕ l ( x ) ∂ x 2 ϕ k ( x ) d x = 1 J ∫ − 1 1 ∂ 2 ϕ ¯ l ( ξ ) ∂ ξ ϕ ¯ k ( ξ ) d ξ ≈ 1 J ∑ s = 0 n w s B s l δ s k = 1 J ω k B k l , A k l = ∫ Ω ∂ ϕ l ( x ) ∂ x ϕ k ( x ) d x = ∫ − 1 1 ∂ ϕ ¯ l ( ξ ) ∂ ξ ϕ ¯ k ( ξ ) d ξ ≈ ∑ s = 0 n w s D s l δ s k = ω k D k l , M k l = ∫ Ω ϕ l ( x ) ϕ k ( x ) d x = J ∫ − 1 1 ϕ ¯ l ( ξ ) ϕ ¯ k ( ξ ) d ξ ≈ J ∑ s = 0 n w s ϕ l ( ξ s ) ϕ k ( ξ s ) = J ω l δ k l . Applying GLL quadrature to (47) yields the following discrete system: V k i + 1 − V k i = Δ t J ω k { ∑ l = 0 n [ 1 2 σ 2 π k 2 x k 2 S k l + [ π k ( μ − r ) + r ] x k A k l − β M k l ] ( η k , l V l i + ( 1 − η k , l ) V l i + 1 ) + λ J ω k ( U ( x k − K ) − V k i ) + } , (38) where π k = π * ( t i + 1 , x k ) . For analytical convenience, we transform the system (48) into the following matrix-vector notation: 𝐕 i = [ V 0 i , V 1 i , ⋯ , V n i ] ⊤ , [ 𝐕 i ] 1 : n − 1 = [ V 1 i , . . . , V n − 1 i ] ⊤ , 𝐏 𝐕 i = [ λ ( U ( x 0 − K ) − V 0 i ) + , λ ( U ( x 1 − K ) − V 1 i ) + , ⋯ , λ ( U ( x n − K ) − V n i ) + ] ⊤ . Define matrices [ 𝐄 i π ] k , l = η k , l J ω k [ 𝐐 i π ] k , l , [ 𝐈 i π ] k , l = 1 − η k , l J ω k [ 𝐐 i π ] k , l , (39) where k = 1 , . . . , n − 1 , l = 0 , . . . , n , where ω k and J given by (31) and (34) respectively are positive, [ 𝐐 i π ] k , l : = 1 2 σ 2 π k 2 x k 2 S k l + [ π k ( μ − r ) + r ] x k A k l − β M k l , and η k , l = { 0 , [ 𝐐 i π ] k , l > 0 , 1 , [ 𝐐 i π ] k , l ≤ 0 . Then (48) can be written as I d [ 𝐕 i + 1 ] 1 : n − 1 − I d [ 𝐕 i ] 1 : n − 1 − Δ t { 𝐄 i π 𝐕 i + 𝐈 i π 𝐕 i + 1 + [ 𝐏 𝐕 i ] 1 : n − 1 } = 0 . (40) To implement the scheme (40), we employ the following policy iteration algorithm. Algorithm 1 Iteration policy for solving (40) 1: for i = 0 , 1 , . . . , m − 1 do 2: let [ 𝐕 i + 1 , ( 0 ) ] 1 : n − 1 = [ 𝐕 i ] 1 : n − 1 , 3: for s = 0 , 1 , 2 , . . . do 4: solve I d [ 𝐕 i + 1 , ( s + 1 ) ] 1 : n − 1 − I d [ 𝐕 i ] 1 : n − 1 − Δ t { 𝐄 i π ( s ) 𝐕 i + 𝐈 i π ( s ) 𝐕 i + 1 , ( s + 1 ) + [ 𝐏 𝐕 i ] 1 : n − 1 } = 0 5: where π ( s ) ∈ arg sup π ℒ π 𝐕 i + 1 , ( s ) , 6: if [ max ( | 𝐕 i + 1 , ( s + 1 ) − 𝐕 i + 1 , ( s ) | max ( 1 , | 𝐕 i + 1 , ( s + 1 ) | ) ) < tolerance ] , 7: ley 𝐕 i + 1 = 𝐕 i + 1 , ( s + 1 ) , then quit. 8: end if 9: end for 10: end for Extended model: Heston stochastic volatility framework The Black-Scholes (BS) model in the model formulation section under the Black-Scholes framework is established under constant volatility. To further enrich the model framework and introduce time-varying volatility characteristics, this section extends the baseline model to the Heston stochastic volatility framework. This extension adds instantaneous variance as a new state variable to construct a two-dimensional optimal stopping system. Consistent with the modeling framework in the BS model setup described above, this paper retains the same probability space, market assumptions, utility function, admissible strategy set and time transformation rule. Only the asset price dynamics, wealth process and infinitesimal generator are updated to adapt to the stochastic volatility environment. We introduce two correlated Brownian motions W τ s and W τ v defined on the pre-specified probability space, with correlation coefficient ρ ∈ ( − 1 , 1 ) . The instantaneous variance v τ follows a mean-reverting CIR process, and the joint dynamic equations of asset price and variance are formulated as { d S τ = μ S τ d τ + v τ S τ d W τ s , d v τ = κ ( θ − v τ ) d τ + ζ v τ d W τ v , where κ represents the mean-reversion speed of variance, θ denotes the long-run equilibrium variance level, and ζ is the volatility-of-volatility parameter. The Feller condition 2 κ θ ≥ ζ 2 is imposed to guarantee the non-negativity of the variance process. All other fundamental market parameters remain consistent with the baseline model. The updated wealth process under the stochastic volatility setting is expressed as d X τ = ( r X τ + π τ ( μ − r ) X τ ) d τ + π τ X τ v τ d W τ s . Consistent with the model settings in the BS model setup described above, we adopt the same investment strategy constraint, discount factor, wealth threshold and utility function. Correspondingly, we define the forward value function for the extended two-dimensional state system composed of wealth x and instantaneous variance v as V ~ ( τ , x , v ) = sup π ∈ 𝒜 , ς 𝔼 [ e − β ς U ( X ς − K ) | X τ = x , v τ = v ] , The value function follows the same optimization objective and wealth constraint as the baseline model. Based on the dynamic programming principle applied in the BS model setup, the value function satisfies the variational inequality with the updated Heston infinitesimal generator. We employ the identical time transformation t = T − τ and define the backward value function V ^ ( t , x , v ) = V ~ ( T − t , x , v ) . The backward variational inequality maintains the same min-max structure as the baseline framework, and the Heston infinitesimal generator is given by ℒ Heston π V ^ = ( r x + π x ( μ − r ) ) V ^ x + κ ( θ − v ) V ^ v + 1 2 π 2 x 2 v V ^ x x + 1 2 ζ 2 v V ^ v v + ρ π x ζ v V ^ x v . (41) Following the unified economic specification criterion of the baseline model, we define the terminal and boundary conditions for the Heston model over the feasible domain of time, wealth and variance: { V ^ ( 0 , x , v ) = U ( x − K ) , ( x , v ) ∈ Ω × Ω ′ : = [ v min , v max ] , V ^ ( t , K , v ) = 0 , ( t , v ) ∈ [ 0 , T ] × Ω ′ , V ^ ( t , x max , v ) = Ψ ( t , x max ) , ( t , v ) ∈ [ 0 , T ] × Ω ′ . (42) The terminal condition specifies the utility payoff at maturity determined by excess wealth, while the lower and upper boundary conditions follow the identical constraint rules of the baseline model, which are valid for all feasible variance values within the defined interval. Following the penalty equation derivation framework established in the penalty reformulation and convergence analysis section, we can directly obtain the penalty HJB equation under the Heston model, V t ( t , x , v ) − sup π ℒ Heston π V − λ ( U ( x − K ) − V ( t , x , v ) ) + = 0 , (43) on [ 0 , T ] × Ω × Ω ′ , and the terminal and boundary conditions are given by V ( 0 , x , v ) = U ( x − K ) , ( x , v ) ∈ Ω × Ω ′ V ( t , K , v ) = 0 , ( t , v ) ∈ [ 0 , T ] × Ω ′ , V ( t , x max , v ) = Ψ ( t , x max , v ) ( t , v ) ∈ [ 0 , T ] × Ω ′ . (44) The convergence of the viscosity solution of the resulting penalized equation to that of the original HJB variational inequality is consistent with the BS model. Thus, the relevant proof is not repeated here. Now we develop an iterative GLL spectral method to solve the penalized HJB equation (43) . The computational domain Ω ′ is mapped onto the reference interval Ω ¯ = [ − 1 , 1 ] via v − v min v max − v min = ξ + 1 2 or v = J ′ ξ + v max + v min 2 , J ′ = v max − v min 2 , ξ ∈ Ω ¯ , v ∈ Ω ′ , (45) Define polynomial space 𝕍 n 1 , n 2 ( Ω × Ω ′ ) : = span { ( ϕ 0 ( x ) , ϕ 1 ( x ) , ⋯ , ϕ n 1 ( x ) ) × ( ψ 0 ( v ) , ψ 1 ( v ) , ⋯ , ψ n 2 ( v ) ) } , where ψ k is respectively the transformation of the GLL basis ϕ ¯ k into Ω ′ using (45), namely, ϕ ¯ k ( ξ ) = ϕ ¯ k ( 2 ( v − v min ) v max − v min − 1 ) = : ψ k ( v ) , k = 0 , 1 , . . . , n 2 . Then using the expansion V ( t , x , v ) ≈ ∑ k = 0 n 2 ∑ l = 0 n 1 V l k ( t ) ϕ l ( x ) ψ k ( v ) , to replace V in (43) and taking inner product by ϕ p ( x ) and ψ q ( v ) for p = 1 , . . . , n 1 − 1 and q = 0 , . . . , n 2 give that 0 = ∑ k = 0 n 2 ∑ l = 0 n 1 V l k ′ ( t ) ( ϕ l ( x ) , ϕ p ( x ) ) ( ψ k ( v ) , ψ q ( v ) ) − { ∑ l = 0 n 1 ∑ k = 0 n 2 V l k ( t ) [ r ( x ϕ l ′ ( x ) , ϕ p ( x ) ) ( ψ k ( v ) , ψ q ( v ) ) + A ( ( x π * ( t , x , v ) ϕ l ′ ( x ) , ϕ p ( x ) ) v ψ k ( v ) , ψ q ( v ) ) + κ θ ( ϕ l ( x ) , ϕ p ( x ) ) ( ψ k ′ ( v ) , ψ q ( v ) ) − κ ( ϕ l ( x ) , ϕ p ( x ) ) ( v ψ k ′ ( v ) , ψ q ( v ) ) + 1 2 ( ( π * 2 ( t , x , v ) x 2 ϕ l ″ ( x ) , ϕ p ( x ) ) v ψ k ( v ) , ψ q ( v ) ) + 1 2 ζ 2 ( ϕ l ( x ) , ϕ p ( x ) ) ( v ψ k ″ ( v ) , ψ j ( v ) ) + ρ ζ ( ( x π * ( t , x , v ) ϕ l ′ ( x ) , ϕ p ( x ) ) v ψ k ′ ( v ) , ψ q ( v ) ) − β ( ϕ l ( x ) , ϕ p ( x ) ) ( ψ k ( v ) , ψ q ( v ) ) ] } − λ ( ( U ( x − K ) − ∑ k = 0 n 2 ∑ l = 0 n 1 V l k ( t ) ϕ l ( x ) ψ k ( v ) ) + , ϕ p ( x ) ) , ψ q ( v ) ) , (46) where π * ( t , x , v ) ∈ arg sup π ℒ Heston π V = arg sup π [ ( r x + π x A v ) V x + κ ( θ − v ) V v + 1 2 π 2 x 2 v V x x + 1 2 ζ 2 v V v v + ρ π x ζ v V x v − β V ] . Define temporal grids t i = i Δ t , i = 0 , 1 , . . . , m with Δ t = T m + 1 , and let V l k i ≈ V l k ( t i ) . Then with the time discretization of (46), the fully discretized scheme for (43) is defined as ∑ k = 0 n 2 ∑ l = 0 n 1 ( V l k i + 1 − V l k i ) ( ϕ l ( x ) , ϕ p ( x ) ) ( ψ k ( v ) , ψ q ( v ) ) = Δ t { ∑ l = 0 n 1 ∑ k = 0 n 2 ( η l k V l k i + ( 1 − η l k ) V l k i + 1 ) [ r ( x ϕ l ′ ( x ) , ϕ p ( x ) ) ( ψ k ( v ) , ψ q ( v ) ) + A ( ( x π * ( t , x , v ) ϕ l ′ ( x ) , ϕ p ( x ) ) v ψ k ( v ) , ψ q ( v ) ) + κ θ ( ϕ l ( x ) , ϕ p ( x ) ) ( ψ k ′ ( v ) , ψ q ( v ) ) − κ ( ϕ l ( x ) , ϕ p ( x ) ) ( v ψ k ′ ( v ) , ψ q ( v ) ) + 1 2 ( ( π * 2 ( t , x , v ) x 2 ϕ l ″ ( x ) , ϕ p ( x ) ) v ψ k ( v ) , ψ q ( v ) ) + 1 2 ζ 2 ( ϕ l ( x ) , ϕ p ( x ) ) ( v ψ k ″ ( v ) , ψ j ( v ) ) + ρ ζ ( ( x π * ( t , x , v ) ϕ l ′ ( x ) , ϕ p ( x ) ) v ψ k ′ ( v ) , ψ q ( v ) ) − β ( ϕ l ( x ) , ϕ p ( x ) ) ( ψ k ( v ) , ψ q ( v ) ) ] − λ ( ( U ( x − K ) − ∑ k = 1 n 2 ∑ l = 1 n 1 V l k i ϕ l ( x ) ψ k ( v ) ) + , ϕ p ( x ) ) , ψ q ( v ) ) } , (47) where V 0 k i = 0 and V n k i = Ψ ( t i , x max ) , and η l k = 0 or 1 will be specified later. Applying GLL quadrature to (47) yields the following discrete system: V p q i + 1 − V p q i = Δ t J J ′ ω p ω q { ∑ l = 0 n 1 ∑ k = 0 n 2 ( η l k V l k i + ( 1 − η l k ) V l k i + 1 ) [ J ′ J ( r x p + A x p π p q v q ) A p l M q k + κ θ ( 1 − V q ) M p l A q k + J ′ 2 J π p q 2 x p 2 v q S p l M q k + J 2 J ′ ζ 2 v p M p l S q k + ρ ζ x p π p q v j A p l A q k − β J ′ J M p l M q k ] − λ J J ′ ω p ω q ( ( U ( x p − K ) − V p q i ) } , (48) where π p q = π * ( t i + 1 , x p , v q ) . Now let’s discuss the value of η l k , η l k = { 0 , [ 𝐐 i π ] l k > 0 , 1 , [ 𝐐 i π ] l k ≤ 0 . [ 𝐐 i π ] l k : = J ′ J ( r x p + A x p π p q v q ) A p l M q k + κ θ ( 1 − V q ) M p l A q k + J ′ 2 J π p q 2 x p 2 v q S p l M q k + J 2 J ′ ζ 2 v p M p l S q k + ρ ζ x I π p q v j A p l A q k − β J ′ J 1 M p l M q k . We apply the policy iteration scheme in Algorithm 1 to compute the solution of (48). The overall iteration logic is consistent, with only slight adjustments needed, and we thus skip detailed restatement. Numerical examples In this section, we conduct numerical experiments to assess the performance of the proposed GLL spectral method for the penalized HJB equations. The results demonstrate linear convergence in time and exponential convergence in space. Furthermore, the exercise boundaries are accurately captured and visualized, and we verify the convergence of the penalized solution to that of (5) as the penalty parameter λ → ∞ . Example 0.1. This example employs two utility functions to examine the convergence of Algorithm 1: the power utility U ( x − K ) = x 1 / 2 1 / 2 and the non-HARA utility function U ( x ) = 1 3 H − 3 ( x ) + H − 1 ( x ) + x H ( x ) , where H ( x ) = 2 ( − 1 + 1 + 4 x ) − 1 / 2 (see [ 29 ] ). To comprehensively evaluate the robustness of the numerical scheme, the values of the risk-free rate (r), return rate ( μ ), volatility of risky assets ( σ ), discount factor ( β ), and minimum wealth threshold value (K) in the HJB equation are specified into two distinct parameter sets: Set I : r = 0.05 , μ = 0.1 , σ = 0.3 , β = 0.1 , K = 1 . Set II : r = 0.03 , μ = 0.15 , σ = 0.2 , β = 0.08 , K = 1 . For the numerical experiment, we take x max = 10 , the initial wealth x 0 = 1, and the investment horizon T = 0.1. Meanwhile, the iteration in Algorithm 1 stops when the tolerance reaches 10 –8 . The boundary conditions are specified below: V ( t , x max ) = ϕ ( t , x max ) = e − β t U ( x max − K ) . Benchmark values are obtained via computations using a dense discretization with n = 64 spatial and m = 128000 temporal meshes, and a penalty parameter λ = 10 3 . Throughout the experiments, all relative errors are measured in the global L 2 -norm. Fig 1 , which plots the data from Table 1 , demonstrates that the GLL spectral method achieves exponential convergence in space under both parameter sets. Correspondingly, Fig 2 (based on Table 2 ) illustrates its linear convergence in time across different settings. The evolution of relative L 2 errors with increasing λ , displayed in Fig 3 , confirms the convergence of the penalized HJB solution to that of the original variational inequality (5) as λ → ∞ for both Set I and Set II ( Table 3 ). 10.1371/journal.pone.0359303.t001 Table 1 Spatial convergence of the GLL spectral method with respect to n ( m = 2 14 , λ = 10 3 ). Utility n Error Avg. Iterations Time (sec) Set I Set II Set I Set II Set I Set II Power 4 4.80E-01 4.81E-01 2.05 2.05 0.144 0.128 8 3.43E-01 3.46E-01 3.00 3.00 0.257 0.258 16 2.36E-01 2.41E-01 3.00 3.00 0.374 0.370 32 1.57E-01 1.62E-01 3.00 3.00 0.819 0.826 64 8.65E-02 1.00E-01 3.04 3.10 2.271 2.343 Non-HARA 4 5.04E-01 5.06E-01 2.05 3.00 0.145 0.229 8 3.60E-01 3.64E-01 3.00 3.00 0.262 0.264 16 2.48E-01 2.53E-01 3.00 3.00 0.376 0.371 32 1.65E-01 1.70E-01 3.00 3.00 0.823 0.834 64 9.10E-02 1.05E-01 3.06 3.13 2.269 2.373 10.1371/journal.pone.0359303.t002 Table 2 Temporal convergence of the GLL spectral method with respect to m ( n = 64, λ = 10 3 ). Utility m Error Avg. Iterations Time (sec) Set I Set II Set I Set II Set I Set II Power 2 14 8.88E-07 2.24E-06 3.78 3.00 1.058 0.697 2 15 4.71E-07 1.04E-06 3.01 3.00 1.398 1.413 2 16 2.23E-07 4.47E-07 3.00 3.00 2.794 2.820 2 17 7.98E-08 1.49E-07 3.00 3.00 5.592 5.616 Non-HARA 2 14 9.23E-07 3.75E-06 4.05 3.00 1.145 0.710 2 15 4.91E-07 1.75E-06 3.02 3.00 1.429 1.418 2 16 2.33E-07 7.50E-07 3.00 3.00 2.817 2.839 2 17 8.39E-08 2.50E-07 3.00 3.00 5.708 5.792 10.1371/journal.pone.0359303.t003 Table 3 Convergence of the penalized HJB equations to the original QVI with respect to λ ( n = 64, m = 2 14 ). Utility λ Error Avg. Iterations Time (sec) Set I Set II Set I Set II Set I Set II Power 4 2.28E-01 1.56E-01 3.43 3.50 2.237 2.237 8 2.07E-01 1.49E-01 3.15 3.52 1.920 2.269 16 1.64E-01 1.29E-01 3.45 3.47 2.185 2.224 32 1.16E-01 8.26E-02 3.23 3.23 2.005 1.995 64 6.82E-02 5.19E-02 3.11 3.01 1.892 1.801 128 3.66E-02 2.70E-02 3.03 3.00 1.851 1.809 256 1.77E-02 1.10E-02 3.01 3.00 1.808 1.856 512 6.18E-03 4.73E-03 3.02 3.00 1.808 1.831 Non-HARA 4 2.46E-01 1.64E-01 3.40 3.54 2.270 2.253 8 2.18E-01 1.56E-01 3.10 3.45 1.913 2.229 16 1.72E-01 1.36E-01 3.25 3.34 2.037 2.126 32 1.22E-01 8.68E-02 3.04 3.37 1.844 2.128 64 7.17E-02 5.44E-02 3.03 3.01 1.832 1.815 128 3.85E-02 2.83E-02 3.03 3.00 1.844 1.793 256 1.86E-02 1.15E-02 3.01 3.00 1.836 1.814 512 6.50E-03 5.07E-03 3.03 3.00 1.852 1.796 10.1371/journal.pone.0359303.g001 Fig 1 Convergence of penalized HJB equations toward the HJB variational inequality as n varies. ( m = 2 14 ), λ = 10 3 . 10.1371/journal.pone.0359303.g002 Fig 2 Convergence of penalized HJB equations toward the HJB variational inequality as m varies. ( n = 64, λ = 10 3 ). 10.1371/journal.pone.0359303.g003 Fig 3 Convergence of penalized HJB equations toward the HJB variational inequality as λ varies. ( n = 64, m = 2 14 ). Example 0.2. This example extends the framework to a two-dimensional Heston stochastic volatility model to investigate the performance of the numerical method. The value function is governed by the wealth x and the variance v. We adopt the power utility function U ( x − K ) = x 1 / 2 1 / 2 with the minimum wealth threshold K = 1. The baseline parameters of the Heston model and the market are chosen as follows: r = 0.05 , μ = 0.1 , β = 0.06 , A = 0.5 , κ = 0.3 , θ = 0.02 , ζ = 0.3 , ρ = − 0.7 . For the numerical discretization and simulation, the spatial domain is chosen as [ x min , x max ] × [ v min , v max ] = [ 1 , 10 ] × [ 10 − 7 , 0.6 ] , the investment horizon is set to T = 0.1, and the inner-layer iteration tolerance of algorithm is 10 –8 . The reference benchmark solutions are computed using a refined mesh with n 1 = 16, n 2 = 16, m = 128, and a penalty parameter λ = 900 . To comprehensively analyze the convergence behavior of the proposed GLL spectral scheme, all relative errors are evaluated in the global L 2 -norm. Similar to the one-dimensional case, Table 4 and Fig 4 demonstrates the method’s high-order spatial convergence, linear temporal convergence, and asymptotic convergence as the penalty parameter λ increases. 10.1371/journal.pone.0359303.t004 Table 4 Sensitivity analysis of the GLL spectral method for the 2D Heston QVI with respect to n 1 , n 2 , m , and λ . Parameter: n 1 Parameter: n 2 n 1 Error Avg. Iter Time (sec) n 2 Error Avg. Iter Time (sec) 2 1.00E-01 1.00 0.028 2 1.07E-04 1.02 0.076 4 4.11E-02 1.79 0.046 4 9.81E-05 1.00 0.146 6 2.31E-02 1.14 0.043 6 8.00E-05 1.00 0.225 8 1.47E-02 1.02 0.056 8 6.56E-05 1.00 0.343 10 9.62E-03 1.01 0.092 10 5.10E-05 1.00 0.489 12 6.04E-03 1.01 0.109 12 3.58E-05 1.00 0.818 14 3.09E-03 1.01 0.138 14 1.88E-05 1.00 1.036 Parameter: m Parameter: λ m Error Avg. Iter Time (sec) λ Error Avg. Iter Time (sec) 2 8 6.43E-05 1.01 0.173 4 1.48E-03 1.29 0.182 2 9 3.74E-05 1.00 0.289 8 1.13E-03 1.21 0.166 2 10 1.87E-05 1.00 0.564 16 7.75E-04 1.15 0.157 2 11 9.26E-06 1.00 1.120 32 4.52E-04 1.10 0.149 2 12 4.49E-06 1.00 2.238 64 2.32E-04 1.06 0.144 2 13 2.10E-06 1.00 4.432 128 1.13E-04 1.04 0.140 2 14 9.00E-07 1.00 8.890 256 4.86E-05 1.02 0.141 2 15 3.00E-07 1.00 17.784 512 1.63E-05 1.01 0.139 10.1371/journal.pone.0359303.g004 Fig 4 The relative L 2 -norm errors with respect to the spatial nodes ( n 1 , n 2 ), temporal steps ( m ), and the penalty parameter ( λ ). Conclusions In summary, this work addresses a utility maximization problem involving optimal stopping, mathematically formulated as a HJB QVI. We develop a novel computational framework that integrates GLL spectral discretization with a penalization method, implemented via a policy iteration scheme. The convergence of the penalized system is theoretically established. Finally, the efficacy and precision of the proposed methodology are verified through a comprehensive set of numerical experiments. Supporting information S1 File Source code used to reproduce the numerical experiments and results reported in this study. (RAR)